Skip to content

Commit

Permalink
more matchers cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cheezy committed Dec 22, 2016
1 parent fd1cb7d commit 9ec37c3
Show file tree
Hide file tree
Showing 15 changed files with 92 additions and 113 deletions.
2 changes: 1 addition & 1 deletion features/step_definitions/file_field_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
end

Then /^its\' value should equal that file$/ do
__FILE__.should include @page.file_field_id_element.value[/[^\\]*$/]
expect(__FILE__).to include @page.file_field_id_element.value[/[^\\]*$/]
end

When /^I search for the file field by "([^\"]*)"$/ do |how|
Expand Down
2 changes: 1 addition & 1 deletion features/step_definitions/form_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
end

Then /^I should see that the form exists$/ do
@page.form_id?.should == true
expect(@page.form_id?).to be true
end
14 changes: 5 additions & 9 deletions features/step_definitions/frames_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,16 @@ class IFramePage

Then /^I should verify "([^\"]*)" is in the text field for frame 2 using "([^\"]*)"$/ do |text, arg_type|
result = @page.send "text_field_2_#{arg_type.gsub(' ', '_')}".to_sym
result.should == text
expect(result).to eql text
end

#Then /^I should be able to get the text fields text from frame 2 using "([^\"]*)"$/ do |arg_type|
# @page.send("text_field_2_#{arg_type}_element").text
#end

When /^I type "([^\"]*)" into the text field from frame 1 using "([^\"]*)"$/ do |text, arg_type|
@page.send "text_field_1_#{arg_type.gsub(' ', '_')}=".to_sym, text
end

Then /^I should verify "([^\"]*)" is in the text field for frame 1 using "([^\"]*)"$/ do |text, arg_type|
result = @page.send "text_field_1_#{arg_type.gsub(' ', '_')}".to_sym
result.should == text
expect(result).to eql text
end

class NestedFramePage
Expand All @@ -107,7 +103,7 @@ class NestedFramePage

Then /^I should be able to click the link in the frame$/ do
@page.nested_link
@page.text.should include "Success"
expect(@page.text).to include "Success"
end

When /^I type "([^\"]*)" into the text field from frame 1 identified dynamically$/ do |value|
Expand All @@ -118,7 +114,7 @@ class NestedFramePage

Then /^I should verify "([^\"]*)" in the text field for frame 1 identified dynamically$/ do |value|
@page.in_frame(:id => 'frame_one_1') do |frame|
@page.text_field_element(:name => 'senderElement', :frame => frame).value.should == value
expect(@page.text_field_element(:name => 'senderElement', :frame => frame).value).to eql value
end
end

Expand All @@ -130,7 +126,7 @@ class NestedFramePage

Then /^I should verify "([^\"]*)" in the text field for iframe 1 identified dynamically$/ do |value|
@page.in_iframe(:id => 'frame_one_1') do |frame|
@page.text_field_element(:name => 'senderElement', :frame => frame).value.should == value
expect(@page.text_field_element(:name => 'senderElement', :frame => frame).value).to eql value
end
end

Expand Down
4 changes: 2 additions & 2 deletions features/step_definitions/generic_element_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
end

Then /^the svg width should be "(.*?)"$/ do |width|
@svg.attribute('width').should == width
expect(@svg.attribute('width')).to eql width
end

Then /^the svg height should be "(.*?)"$/ do |height|
@svg.attribute('height').should == height
expect(@svg.attribute('height')).to eql height
end
2 changes: 1 addition & 1 deletion features/step_definitions/headings_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
end

Then /^I should see "([^\"]*)"$/ do |text|
@heading.should == text
expect(@heading).to eql text
end

When /^I search for the heading(\d+) by "([^"]*)"$/ do |head_type, type|
Expand Down
6 changes: 3 additions & 3 deletions features/step_definitions/hidden_field_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
end

Then /^I should see the hidden field contains "([^\"]*)"$/ do |text|
@page.hidden_field_id.should == text
expect(@page.hidden_field_id).to eql text
end

When /^I search for the hidden field by "([^\"]*)"$/ do |how|
@element = @page.send "hidden_field_#{how}_element"
end

Then /^the hidden field element should contain "([^\"]*)"$/ do |text|
@element.value.should == text
expect(@element.value).to eql text
end

When /^I search for the hidden field by "([^"]*)" and "([^"]*)"$/ do |param1, param2|
Expand All @@ -23,5 +23,5 @@
end

Then /^I should see that the hidden field exists$/ do
@page.hidden_field_id?.should == true
expect(@page.hidden_field_id?).to eql true
end
10 changes: 5 additions & 5 deletions features/step_definitions/image_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
end

Then /^the image should be "([^\"]*)" pixels wide$/ do |width|
@element.width.should == width.to_i
expect(@element.width).to eql width.to_i
end

Then /^the image should be "([^\"]*)" pixels tall$/ do |height|
@element.height.should == height.to_i
expect(@element.height).to eql height.to_i
end

When /^I get the image element by "([^\"]*)"$/ do |how|
Expand All @@ -31,13 +31,13 @@
end

Then /^I should see that the image exists$/ do
@page.image_id?.should == true
expect(@page.image_id?).to be true
end

Then /^I should see that the image loaded$/ do
@status.should be true
expect(@status).to be true
end

Then /^I should see that the image is not loaded$/ do
@status.should be false
expect(@status).to be false
end
15 changes: 7 additions & 8 deletions features/step_definitions/indexed_property_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,43 +44,43 @@ def page
end

Then /^The table's indexed text field by id should contain "([^\"]*)"$/ do |val|
page.table[@index].text_table.should == val
expect(page.table[@index].text_table).to eql val
end

Then /^I type "([^\"]*)" into the table's indexed text field by name$/ do |val|
page.table[@index].text_name = val
end

Then /^The table's indexed text field by name should contain "([^\"]*)"$/ do |val|
page.table[@index].text_name.should == val
expect(page.table[@index].text_name).to eql val
end

Then /^I select the indexed radio button$/ do
page.table[@index].select_radio
end

Then /^The indexed radio button should be selected$/ do
page.table[@index].radio_selected?.should == true
expect(page.table[@index].radio_selected?).to be true
end

Then /^I check the indexed checkbox$/ do
page.table[@index].check_check
end

Then /^The indexed checkbox should be checked$/ do
page.table[@index].check_checked?.should == true
expect(page.table[@index].check_checked?).to be true
end

Then /^I type "([^\"]*)" into the table's indexed text area$/ do |val|
page.table[@index].area = val
end

Then /^The table's indexed text area should contain "([^\"]*)"$/ do |val|
page.table[@index].area.should == val
expect(page.table[@index].area).to eql val
end

Then /^I should see that the indexed button exists$/ do
page.table[@index].button?.should == true
expect(page.table[@index].button?).to be true
end

Then /^I should be able to click the indexed button$/ do
Expand All @@ -92,10 +92,9 @@ def page
end

Then /^The regular indexed text field by id should contain "([^\"]*)"$/ do |val|
page.nottable[@index].text_nottable.should == val
expect(page.nottable[@index].text_nottable).to eql val
end


When(/^I search for an element not on my indexed property but on another$/) do
@index = 'foo'
end
Expand Down
2 changes: 1 addition & 1 deletion features/step_definitions/italic_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
end

Then /^I should see "([^\"]*)" in italic$/ do |text|
@i.should == text
expect(@i).to eql text
end

When /^I search italic text for the (\w+) by "([^"]*)"$/ do |text_decorator, type|
Expand Down
4 changes: 2 additions & 2 deletions features/step_definitions/javascript_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def build_url(page)

Then /^I should be able to wait for the answer "([^\"]*)"$/ do |answer|
@page.wait_for_ajax
@page.results.should == answer
expect(@page.results).to eql answer
end

Given /^I execute the javascript "([^\"]*)"$/ do |script|
Expand All @@ -49,5 +49,5 @@ def build_url(page)
end

Then /^I should get the answer "([^\"]*)"$/ do |answer|
@answer.should == answer.to_i
expect(@answer).to eql answer.to_i
end
2 changes: 1 addition & 1 deletion features/step_definitions/label_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
end

Then /^I should see that the label exists$/ do
@page.label_id?.should be true
expect(@page.label_id?).to be true
end
4 changes: 2 additions & 2 deletions features/step_definitions/link_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
end

Then(/^I should see that the link exists$/) do
@page.link_id?.should == true
expect(@page.link_id?).to be true
end

When(/^I get the href for the link$/) do
@href = @page.google_search_id_element.href
end

Then(/^I should know it was "(.*?)"$/) do |href|
@href.should include href
expect(@href).to include href
end

When(/^I get the link using the href success$/) do
Expand Down
2 changes: 1 addition & 1 deletion features/step_definitions/list_item_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
end

Then /^I should see that the list item exists$/ do
@page.li_id?.should == true
expect(@page.li_id?).to eql true
end
24 changes: 4 additions & 20 deletions features/step_definitions/modal_dialog_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class AnotherModalDialog


Given /^I am on the modal page$/ do
ModalPage.new(@browser).navigate_to(UrlHelper.modal)
ModalPage.new(@browser).navigate_to(UrlHelper.modal)
end

When /^I open a modal dialog$/ do
Expand All @@ -40,23 +40,7 @@ class AnotherModalDialog

When /^I open another modal dialog from that one$/ do
dialog = ModalDialog.new(@browser)
dialog.attach_to_window(:title => 'Modal 1') #do
dialog.modal_dialog #do
# dialog.launch_another_modal
# end
dialog.launch_another_modal
# end
end

Then /^I should be able to close both modals$/ do
pending
# another = AnotherModalDialog.new(@browser)
# another.attach_to_window(:title => 'Modal 2') do
# another.close_window
# end

# dialog = ModalDialog.new(@browser)
# dialog.attach_to_window(:title => 'Modal 1') do
# dialog.close_window
# end
dialog.attach_to_window(:title => 'Modal 1')
dialog.modal_dialog
dialog.launch_another_modal
end
Loading

0 comments on commit 9ec37c3

Please sign in to comment.