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

Already on GitHub? Sign in to your account

New accessor for radio button groups. #204

Merged
merged 11 commits into from Jan 23, 2014

Conversation

Projects
None yet
2 participants
Contributor

sivart84 commented Jan 15, 2014

As radio buttons are typically grouped by a shared name attribute, and selections within the group are mutually exclusive, it makes sense to model and interact with these groups of elements through a single accessor. This new method allows users to easily model a group of radio buttons like:

class CheesePage
  include PageObject

  radio_button_group(:favorite_cheese, name: 'cheeses')
  # or via the alias `radio_group()`
end

And then perform actions on the radio buttons in the group like:

visit CheesePage do |page|
  page.wait_until { page.favorite_cheese? }
  page.favorite_cheese_values.each do |cheese|
    page.select_favorite_cheese(cheese)
    expect(page.favorite_cheese_selected?).to eql(cheese)
  end
end

I've made an attempt at writing cucumber tests for these methods, but I'm much more familiar with rspec, so please make sure they are sufficient.

cheezy added a commit that referenced this pull request Jan 23, 2014

Merge pull request #204 from sivart84/master
New accessor for radio button groups.

@cheezy cheezy merged commit 220f204 into cheezy:master Jan 23, 2014

1 check passed

default The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment