features/step_definitions/accessor_steps.rb in page-object-0.0.3 vs features/step_definitions/accessor_steps.rb in page-object-0.0.4

- old
+ new

@@ -12,10 +12,26 @@ Then /^I should be able to type "([^\"]*)" into the field$/ do |value| @page.send "text_field_#{@how}=".to_sym, value end +When /^I type "([^"]*)" into the text area$/ do |text| + @page.text_area_id = text +end + +Then /^the text area should contain "([^"]*)"$/ do |expected_text| + @page.text_area_id.should == expected_text +end + +When /^I search for the text area by "([^"]*)"$/ do |how| + @how = how +end + +Then /^I should be able to type "([^"]*)" into the area$/ do |value| + @page.send "text_area_#{@how}=".to_sym, value +end + When /^I select the link labeled "([^\"]*)"$/ do |text| @page.google_search_id end When /^I search for the link by "([^\"]*)"$/ do |how| @@ -147,5 +163,60 @@ When /^I get the image element by "([^"]*)"$/ do |how| @element = @page.send "image_#{how}_image" end +When /^I retrieve the hidden field element$/ do + @element = @page.hidden_field_id_hidden_field +end + +Then /^I should see the hidden field contains "([^"]*)"$/ do |text| + @page.hidden_field_id.should == text +end + +When /^I search for the hidden field by "([^"]*)"$/ do |how| + @element = @page.send "hidden_field_#{how}_hidden_field" +end + +Then /^hidden field element should contains "([^"]*)"$/ do |text| + @element.value.should == text +end + +Then /^I should be able to submit the form$/ do + @element.submit +end + +When /^I locate the form by "([^"]*)"$/ do |how| + @element = @page.send "form_#{how}_form" +end + +When /^I get the text from the list item$/ do + @text = @page.li_id +end + +When /^I search for the list item by "([^"]*)"$/ do |how| + @text = @page.send "li_#{how}" +end + +When /^I get the first item from the unordered list$/ do + @element = @page.ul_id_unordered_list[0] +end + +Then /^the list item's text should be "([^"]*)"$/ do |expected_text| + @element.text.should == expected_text +end + +When /^I search for the unordered list by "([^"]*)"$/ do |how| + @list = @page.send "ul_#{how}_unordered_list" +end + +When /^I get the first item from the list$/ do + @element = @list[0] +end + +When /^I get the first item from the ordered list$/ do + @element = @page.ol_id_ordered_list[0] +end + +When /^I search for the ordered list by "([^"]*)"$/ do |how| + @list = @page.send "ol_#{how}_ordered_list" +end