cheezy / page-object

Gem to implement PageObject pattern in watir-webdriver and selenium-webdriver
MIT License
653 stars 220 forks source link

populate_page_with broken for selecting select list option by text #437

Closed phebus closed 7 years ago

phebus commented 7 years ago

page_object 2.2 watir 6.6.3

def populate_select_list(key, value)
      select_element = self.send("#{key}_element")
      if select_element.options.include?(value)
        select_element.select(value)
      else
        select_element.select_value(value)
      end
    end

The conditional above does not correctly trigger when text is being used to find a select list option. Everything falls to the else and it attempts to find by value. Setting the select list with page.select_list = 'whatever' works fine so it's just populate_page_with functionality that's broken.

I've confirmed that doing an if select_element.options.map(&:text).include?(value) works but I haven't had time to work on a proper pull request with tests and might not be able to get to it till later this week so if someone has the time, please fix.

Thanks!

cheezy commented 7 years ago

I've merged the PR and hope to have a release today.