Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Evaluation] Bulk element definitions #140

Open
Castone22 opened this issue Nov 30, 2018 · 5 comments
Open

[Feature Evaluation] Bulk element definitions #140

Castone22 opened this issue Nov 30, 2018 · 5 comments
Labels

Comments

@Castone22
Copy link
Contributor

I'm thinking on this a little bit but.. something like the following pattern might be somewhat more user friendly when defining a lot of the same element type

add_links({
  link_one: {href: '/one'},
  link_two: {href: '/two'},
  link_three: {href: '/three'}
})

Implementation wouldn't be too hard and it reduces repetition as well as reduces cyclic complexity of some of the methods we write in our base pages, also would let particularly complex pages be extracted into a yaml file in some situations a lot more easily.

def add_link_elements(element_hash)
  element_hash.each { |name, selectors| add_link(name, selectors) }
end
@Castone22 Castone22 changed the title [Feature] Bulk element definitions [Feature Evaluation] Bulk element definitions Nov 30, 2018
@greenarrowdb
Copy link
Member

This is a very interesting concept so far. I'd like to discuss this further. What do you mean by "let particularly complex pages be extracted into a yaml file in some situations a lot more easily"

@Castone22
Copy link
Contributor Author

Castone22 commented Nov 30, 2018

A Pattern like this

#~! pages/yaml_page.rb
class YamlPage < BasePage
  include Oz::YamlLoadedPage
end
#~! yaml_page_elements.rb
:links:
  :submit:
    :id: 'submit-button'

:text_fields:
  :first_name:
    :id: 'first_name'
  :last_name:
    :id: 'last_name'

etc etc

@greenarrowdb
Copy link
Member

Why? I don't see an advantage to this level of abstraction. You loose all ability to be dynamic this way and I don't see a good reason to do it.

@Castone22
Copy link
Contributor Author

Castone22 commented Nov 30, 2018

Eh, just an idea. The core thing is really the replication reduction we would get from being able to bulk add

@greenarrowdb
Copy link
Member

There is definitely something to that statement for sure. I think there are a couple ways we could potentially go about it (they are pretty much all variations similar to this). We should chat about this one over discord soon :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants