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

Commit

Permalink
Replaced wait function with Selenium wait.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sathish Gogineni committed Apr 10, 2015
1 parent 8d2595b commit 7ed3c6c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,22 @@
# https://www.relishapp.com/rspec/rspec-expectations/docs
Given(/^I have entered ([^"]*) into Email field$/) do |value|
@driver.find_element(id:'fbemail').send_keys(value)
wait(timeout:2,message:'Text not entered into email').until { @driver.find_element(id:'fbemail').attribute('value').eql?value }
Selenium::WebDriver::Wait.new(timeout:2,message:'Text not entered into email').until { @driver.find_element(id:'fbemail').attribute('value').eql?value }
end

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

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

Then(/^I am on other page$/) do
element = @driver.find_element(id:'i_am_an_id')
element.displayed?
raise "Doesn't open next page" unless element.text.eql?'I am another div'
end
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ class AppiumWorld

@driver = $driver.start_driver
@driver.get('http://saucelabs.com/test/guinea-pig')
wait(timout:3).until { @driver.title.start_with?'I am a page title' }

Selenium::WebDriver::Wait.new(timout:3).until { @driver.title.start_with?'I am a page title' }
}
After { $driver.driver_quit }

def wait(opts={})
Selenium::WebDriver::Wait.new(opts)
end

0 comments on commit 7ed3c6c

Please sign in to comment.