mirror of
https://github.com/appium/appium.git
synced 2026-05-03 08:51:18 -05:00
Created a cucumber example along with documentation about what it means.
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
# Features describe what something should allow a user to accomplish. They're
|
||||
# high-level things, like you'd put in your manual or marketing copy. For more
|
||||
# information about features, check out the documentation at:
|
||||
|
||||
|
||||
Feature: Addition
|
||||
In order to revolutionize maths teaching
|
||||
As an iOS developer
|
||||
I want to be able to sum two numbers
|
||||
|
||||
Scenario: Add two numbers
|
||||
Given I have entered 4 into field 1 of the calculator
|
||||
And I have entered 7 into field 2 of the calculator
|
||||
When I press button 1
|
||||
Then the result should be displayed as 11
|
||||
@@ -0,0 +1,17 @@
|
||||
# These are the 'step definitions' which Cucumber uses to
|
||||
#
|
||||
Given /^I have entered (\d+) into field (\d+) of the calculator$/ do |value, field|
|
||||
puts "Called: #{value} #{field}"
|
||||
elements = selenium.find_elements(:tag_name, "textField")
|
||||
elements[field.to_i - 1].send_keys value
|
||||
end
|
||||
|
||||
Then /^the result should be displayed as (\d+)$/ do |expected|
|
||||
result = selenium.find_element(:tag_name, "staticText")
|
||||
result.attribute("value").should eq expected
|
||||
end
|
||||
|
||||
And /^I press button (\d+)$/ do |button_index|
|
||||
button = selenium.find_elements(:tag_name, "button")[button_index.to_i - 1]
|
||||
button.click
|
||||
end
|
||||
@@ -0,0 +1,25 @@
|
||||
require 'rspec/expectations'
|
||||
require 'selenium-webdriver'
|
||||
|
||||
APP_PATH = '../../../../../apps/TestApp/build/release-iphonesimulator/TestApp.app'
|
||||
|
||||
def capabilities
|
||||
{
|
||||
'browserName' => 'iOS',
|
||||
'platform' => 'Mac',
|
||||
'version' => '6.0',
|
||||
'app' => absolute_app_path
|
||||
}
|
||||
end
|
||||
|
||||
def absolute_app_path
|
||||
File.join(File.dirname(__FILE__), APP_PATH)
|
||||
end
|
||||
|
||||
def server_url
|
||||
"http://127.0.0.1:4723/wd/hub"
|
||||
end
|
||||
|
||||
def selenium
|
||||
@driver ||= Selenium::WebDriver.for(:remote, :desired_capabilities => capabilities, :url => server_url)
|
||||
end
|
||||
Reference in New Issue
Block a user