Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1 from sivart84/radio_button_group_tests

Initial commit for radio button group tests
  • Loading branch information...
commit d8965812cc4995c22a48b94dba5240925a967b63 2 parents 6e25956 + 284e860
@sivart84 sivart84 authored
View
7 features/html/static_elements.html
@@ -69,6 +69,13 @@
<input type="radio" id="milk_id" name="milk_name" class="milk_class" value="Milk"> Milk <br/>
<input type="radio" id="butter_id" name="butter_name" class="butter_class" value="Butter">Butter
+ <br/>
+ <label>Radio Button Group</label>
+ <input type="radio" name="fav_cheese" value="ched">Cheddar</input>
+ <input type="radio" name="fav_cheese" value="emmen">Emmental</input>
+ <input type="radio" name="fav_cheese" value="muen">Muenster</input>
+ <br/>
+
<div id="div_id" name="div_name" class="div_class" title="div_title">
page-object rocks!
</div>
View
40 features/radio_button_group.feature
@@ -0,0 +1,40 @@
+Feature: Radio Button Groups
+ In order to interact with radio button groups
+ Testers will need access and interrogation ability
+
+
+ Background:
+ Given I am on the static elements page
+
+ Scenario: Confirm existence of a radio button group
+ When a page has a radio button group
+ Then I should see that the radio button group exists
+
+ Scenario: No radio buttons in the group have been selected
+ When no radio buttons have been selected
+ Then no radio buttons should be selected
+
+ Scenario: Selecting grouped radio buttons by text
+ When I select the "Cheddar" radio button
+ Then the "Cheddar" radio button should be selected
+ Then the "Emmental" radio button should not be selected
+ Then the "Muenster" radio button should not be selected
+ When I select the "Emmental" radio button
+ Then the "Cheddar" radio button should not be selected
+ Then the "Emmental" radio button should be selected
+ Then the "Muenster" radio button should not be selected
+
+ Scenario: Selecting grouped radio buttons by value
+ When I select the "ched" radio button
+ Then the "Cheddar" radio button should be selected
+ Then the "Emmental" radio button should not be selected
+ Then the "Muenster" radio button should not be selected
+ When I select the "muen" radio button
+ Then the "Cheddar" radio button should not be selected
+ Then the "Emmental" radio button should not be selected
+ Then the "Muenster" radio button should be selected
+
+ Scenario: Getting an array of elements for each radio button in the group
+ When I ask for the elements of a radio button group
+ Then I should have an array with elements for each radio button
+ And the radio button element values should be "ched", "emmen", "muen"
View
36 features/step_definitions/radio_button_group_steps.rb
@@ -0,0 +1,36 @@
+When /^no radio buttons have been selected$/ do
+ # nothing to do here
+end
+
+Then /^no radio buttons should be selected$/ do
+ @page.favorite_cheese_selected?.should == false
+end
+
+When /^I select the "([^\"]*)" radio button$/ do |how|
+ @page.send "select_favorite_cheese(#{how})"
+end
+
+Then /^the "([^\"]*)" radio button should be selected$/ do |how|
+ @page.favorite_cheese_selected?.should == "#{how}"
+end
+
+Then /^the "([^\"]*)" radio button should not be selected$/ do |how|
+ @page.favorite_cheese_selected?.should != "#{how}"
+end
+
+Then /^I should see that the radio button group exists$/ do
+ @page.favorite_cheese?.should == true
+end
+
+When /^I ask for the elements of a radio button group$/ do
+ @elems = @page.favorite_cheese_elements
+end
+
+Then /^I should have an array with elements for each radio button$/ do
+ @elems.length.should == 3
+end
+
+And /^the radio button element values should be "([^\"]*)", "([^\"]*)", "([^\"]*)"$/ do |val1, val2, val3|
+ elem_arr = @elems.collect { |elem| elem.value }
+ elem_arr.should == [val1, val2, val3]
+end
View
2  features/support/page.rb
@@ -100,6 +100,8 @@ class Page
radio_button(:butter_id, :id => 'butter_id')
+ radio_button_group(:favorite_cheese, name: 'fav_cheese')
+
div(:div_id, :id => 'div_id')
div(:div_name, :name => 'div_name')
div(:div_class, :class => 'div_class')
Please sign in to comment.
Something went wrong with that request. Please try again.