goodwill / capybara-select2

Helper for capybara to be able to trigger select on select2 javascript (needed for js enabled test only)
MIT License
80 stars 111 forks source link

Individual selectors instead of nested selectors #53

Closed bbuchalter closed 6 years ago

bbuchalter commented 7 years ago

The downsides of using an individual selector like this: find(:xpath, "//body").find("#{drop_container} li.select2-result-selectable", text: value)

Instead of this:

body = find(:xpath, "//body")
drop_container = body.find("#{drop_container}")
drop_container.find("li.select2-result-selectable", text:value)

are two fold:

  1. Debugging is much easier, as you now have a line number to understand which part of the selector failed.
  2. Readability