cheezy/page-object

populate_page_with broken for selecting select list option by text

phebus opened this issue · 1 comments

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!

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