Skip to content
This repository was archived by the owner on Mar 23, 2020. It is now read-only.

Commit 7ed3c6c

Browse files
author
Sathish Gogineni
committed
Replaced wait function with Selenium wait.
1 parent 8d2595b commit 7ed3c6c

File tree

2 files changed

+4
-10
lines changed
  • sample-code/examples/ruby/cucumber_ios_web/features

2 files changed

+4
-10
lines changed

sample-code/examples/ruby/cucumber_ios_web/features/step_definitions/steps.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,22 @@
1515
# https://www.relishapp.com/rspec/rspec-expectations/docs
1616
Given(/^I have entered ([^"]*) into Email field$/) do |value|
1717
@driver.find_element(id:'fbemail').send_keys(value)
18-
wait(timeout:2,message:'Text not entered into email').until { @driver.find_element(id:'fbemail').attribute('value').eql?value }
18+
Selenium::WebDriver::Wait.new(timeout:2,message:'Text not entered into email').until { @driver.find_element(id:'fbemail').attribute('value').eql?value }
1919
end
2020

2121
And(/^I have entered ([^"]*) into Comments field$/) do |value|
2222
@driver.find_element(id:'comments').send_keys(value)
23-
wait(timeout:2,message:'Text not entered into comments').until { @driver.find_element(id:'comments').attribute('value').eql?value }
23+
Selenium::WebDriver::Wait.new(timeout:2,message:'Text not entered into comments').until { @driver.find_element(id:'comments').attribute('value').eql?value }
2424
end
2525

2626
When(/^I click on ([^"]*)$/) do |va|
2727
element = @driver.find_element(id:va)
2828
raise 'No link found' unless element.displayed?
2929
element.click
30-
wait.until { @driver.title.start_with?'I am another page title' }
30+
Selenium::WebDriver::Wait.new.until { @driver.title.start_with?'I am another page title' }
3131
end
3232

3333
Then(/^I am on other page$/) do
3434
element = @driver.find_element(id:'i_am_an_id')
35-
element.displayed?
3635
raise "Doesn't open next page" unless element.text.eql?'I am another div'
3736
end

sample-code/examples/ruby/cucumber_ios_web/features/support/env.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ class AppiumWorld
2626

2727
@driver = $driver.start_driver
2828
@driver.get('http://saucelabs.com/test/guinea-pig')
29-
wait(timout:3).until { @driver.title.start_with?'I am a page title' }
30-
29+
Selenium::WebDriver::Wait.new(timout:3).until { @driver.title.start_with?'I am a page title' }
3130
}
3231
After { $driver.driver_quit }
33-
34-
def wait(opts={})
35-
Selenium::WebDriver::Wait.new(opts)
36-
end

0 commit comments

Comments
 (0)