Skip to content

Commit

Permalink
added support for appium to test ios & android native apps
Browse files Browse the repository at this point in the history
  • Loading branch information
bkone committed Jan 14, 2016
1 parent 3b51533 commit 34fb49b
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ gem 'selenium-webdriver'
gem 'syntax'
gem 'watir-webdriver'
gem 'watir-webdriver-performance'
gem 'page-object'
gem 'page-object'
gem 'rspec-expectations'
gem 'appium_lib'
gem 'rest-client'
gem 'rspec'
10 changes: 10 additions & 0 deletions features/reactnative.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Feature: Movies App
In order to revolutionize Movie ticketing
As an iOS developer
I want to be able to automate testing React native apps

@appium
Scenario: As a user I should be able to view movie listing and search for movies
Given I type "creed" into the search text field
And I tap " Creed 2015 • Critics 93%"
Then the result should be displayed as "Creed"
12 changes: 12 additions & 0 deletions features/step_definitions/appium_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Given(/^I type "([^"]*)" into the search text field$/) do |arg1|
find_element(:xpath, "//UIAApplication[1]/UIAWindow[1]/UIATextField[1]").send_keys arg1
find_element(:name, "Return").click
end

Given(/^I tap "([^"]*)"$/) do |arg1|
find_element(:name,arg1).click
end

Then(/^the result should be displayed as "(.*?)"$/) do |expected|
assert_includes(first_text.value,expected)
end
19 changes: 19 additions & 0 deletions features/support/appium.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require 'rspec/expectations'
require 'appium_lib'
require 'cucumber/ast'

class AppiumWorld
end

caps = Appium.load_appium_txt file: File.expand_path('./', __FILE__), verbose: true

Appium::Driver.new(caps)
Appium.promote_appium_methods AppiumWorld

World do
AppiumWorld.new
end


Before ('@appium'){ $driver.start_driver }
After ('@appium'){ $driver.driver_quit }
10 changes: 10 additions & 0 deletions features/support/appium.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[caps]
platformName = "ios"
deviceName = "iPhone 6"
platformVersion = "9.2"
waitForAppScript = true
app = "apps/Movies.app"

[appium_lib]
sauce_username = false
sauce_access_key = false
1 change: 1 addition & 0 deletions features/support/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require 'minitest/unit'
require 'watir-webdriver-performance'


if ENV['HEADLESS']
require 'headless'
headless = Headless.new
Expand Down
2 changes: 1 addition & 1 deletion features/support/hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def get_browser
end
end

After do
After ('~@appium')do
@browser.close
end

Expand Down

0 comments on commit 34fb49b

Please sign in to comment.