This repository has been archived by the owner on Mar 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Added Cucumber web for iOS to run through appium on simulator #42
Open
Goginenni
wants to merge
4
commits into
appium-boneyard:master
Choose a base branch
from
Goginenni:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
sample-code/examples/ruby/cucumber_ios_web/features/step_definitions/steps.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# These are the 'step definitions' which Cucumber uses to implement features. | ||
# | ||
# Each step starts with a regular expression matching the step you write in | ||
# your feature description. Any variables are parsed out and passed to the | ||
# step block. | ||
# | ||
# The instructions in the step are then executed with those variables. | ||
# | ||
# The '$driver' object is the appium_lib driver, set up in the cucumber/support/env.rb | ||
# file, which is a convenient place to put it as we're likely to use it often. | ||
# For more on step definitions, check out the documentation at | ||
# https://github.com/cucumber/cucumber/wiki/Step-Definitions | ||
# | ||
# For more on rspec assertions, check out | ||
# 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) | ||
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) | ||
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 | ||
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') | ||
raise "Doesn't open next page" unless element.text.eql?'I am another div' | ||
end | ||
10 changes: 10 additions & 0 deletions
10
sample-code/examples/ruby/cucumber_ios_web/features/support/appium.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[caps] | ||
platformName = "ios" | ||
deviceName = "iPhone Simulator" | ||
platformVersion = "7.1" | ||
browserName = "Safari" | ||
custom_url = "http://localhost:4723/wd/hub" | ||
|
||
[appium_lib] | ||
sauce_username = false | ||
sauce_access_key = false |
30 changes: 30 additions & 0 deletions
30
sample-code/examples/ruby/cucumber_ios_web/features/support/env.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# This file provides setup and common functionality across all features. It's | ||
# included first before every test run, and the methods provided here can be | ||
# used in any of the step definitions used in a test. This is a great place to | ||
# put shared data like the location of your app, the capabilities you want to | ||
# test with, and the setup of selenium. | ||
|
||
require 'rspec/expectations' | ||
require 'appium_lib' | ||
require 'cucumber/ast' | ||
require 'selenium-webdriver' | ||
|
||
# Create a custom World class so we don't pollute `Object` with Appium methods | ||
class AppiumWorld | ||
end | ||
|
||
# Load the desired configuration from appium.txt, create a driver then | ||
# Add the methods to the world | ||
caps = Appium.load_appium_txt file: File.expand_path('./', __FILE__), verbose: true | ||
Appium::Driver.new(caps) | ||
|
||
World do | ||
AppiumWorld.new | ||
end | ||
|
||
Before { | ||
@driver = $driver.start_driver | ||
@driver.get('http://saucelabs.com/test/guinea-pig') | ||
Selenium::WebDriver::Wait.new(timeout:3).until { @driver.title.start_with?'I am a page title' } | ||
} | ||
After { $driver.driver_quit } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should end in a newline for git