Skip to content

Instantly share code, notes, and snippets.

@LutherBaker
Last active May 24, 2022 23:22
Show Gist options
  • Save LutherBaker/b091aae1596246603996 to your computer and use it in GitHub Desktop.
Save LutherBaker/b091aae1596246603996 to your computer and use it in GitHub Desktop.
Appium Cheatsheet
##
## minimize 'sudo' as much as possible
##
##
## note that this file is not meant to be RUN directly
## - consider this specific file simply a list of steps to complete
## - ie: copy and paste parts of this to your command line!
##
##
## Upgrade brew
##
$ brew update
##
## Upgrade ruby via rbenv
##
$ brew upgrade rbenv ruby-build
##
## Upgrade node
##
$ brew upgrade[install] node
##
## Make sure 'bundle' is installed/updated
##
$ sudo gem install bundle
##
## Place 'Gemfile' in root directory of project
##
source "https://www.rubygems.org"
gem "rest-client"
gem "rspec"
gem "selenium-webdriver"
gem "cucumber"
gem "rspec-expectations"
$ bundle install
##
## Install/Update Appium components
##
$ brew install node # get node.js
$ npm install -g appium # get appium ?? sudo necessary?
$ npm install wd # get appium client
$ sudo authorize_ios # enable developer use of iOS sim
##
## Run the server
##
$ appium & # start appium
##
## Local filesystem
##
$ touch [project root]/features/test.feature
$ touch [project root]/features/step_definitions/first_step.rb
$ touch [project root]/features/support/env.rb
##
## Run tests
##
$ bundle exec cucumber features/test.feature
## or
$ node your-appium-test.js
##
## Ruby version using Selenium::WebDriver
##
require 'rspec/expectations'
require 'selenium-webdriver'
APP_PATH = '/Users/luther/Library/Developer/Xcode/DerivedData/RedditBrowser-fcwgmysbyxqirmaqykpmzjjhugzz/Build/Products/Debug-iphonesimulator/RedditBrowser.app'
CAPABILITIES = {
'browserName' => 'iOS',
'platform' => 'Mac',
'version' => '6.0',
'app' => APP_PATH
}
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
After { @driver.quit }
Feature: Start The App
Scenario: Open first screen
Given I launch the app
Then I should see "Subreddits" in the navigation item
Given(/^I launch the app$/) do
# selenium.start
end
Then(/^I should see "Subreddits" in the navigation item$/) do
selenium.find_element(:name, "Subreddits").click
end
##
## Reference
##
http://shashikantjagtap.net/ios-automated-testing-in-the-bdd-with-appium-cucumber-on-mac-osx/
http://prototest.com/setting-up-appium-in-ios/
http://sauceio.com/index.php/2013/10/setting-up-ios-automation-on-saucelabs-with-cucumber-and-appium/
##
## Appium
##
http://rdoc.info/github/appium/ruby_lib/Appium
https://github.com/appium/appium/blob/master/sample-code/examples/ruby/simple_test.rb
http://prototest.com/setting-up-appium-in-ios/
https://github.com/appium/appium/blob/master/docs/en/appium-bindings.md
##
## Selenium
##
https://code.google.com/p/selenium/source/browse/spec-draft.md?repo=mobile
http://saucelabs.com/mobile/selenium-mobile
http://sauceio.com/index.php/2012/08/testing-your-site-with-mac-os-ios-and-android/
http://testingbot.com/support/getting-started/appium.html
http://unmesh.me/2013/02/06/ios-automation-with-appium/
https://code.google.com/p/selenium/wiki/IPhoneDriver
http://www.seleniumhq.org/projects/webdriver/
http://docs.seleniumhq.org/docs/03_webdriver.jsp
https://code.google.com/p/selenium/
http://selenium.googlecode.com/git/docs/api/rb/index.html
http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/WebDriver.html
http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/WebElement.html
http://www.slideshare.net/hugs/selenium-appium
http://elementalselenium.com/tips/30-mobile
http://www.slideshare.net/hugs/selenium-appium
http://www.ibm.com/developerworks/library/wa-selenium2/
http://grepcode.com/file/repo1.maven.org/maven2/org.seleniumhq.selenium/selenium-api/2.0b2/org/openqa/selenium/WebElement.java
##
## Ruby
##
http://assertselenium.com/2013/10/06/getting-started-with-ruby-webdriver/
https://www.ruby-toolbox.com/categories/testing_frameworks
http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
##
## Rbenv
##
https://github.com/sstephenson/rbenv
##
## Environment
##
https://groups.google.com/forum/#!msg/appium-discuss/IUBRjySIzng/-_mddMqoXPwJ
##
## Examples
##
https://github.com/appium/appium/tree/master/sample-code/examples/node
##
## Inspector
##
https://github.com/appium/appium/blob/master/docs/en/finding-elements.md
https://github.com/appium/appium-dot-app
##
## RSpec
##
http://rspec.info/
http://code.tutsplus.com/tutorials/ruby-for-newbies-testing-with-rspec--net-21297
##
## Shashikant
##
http://www.youtube.com/watch?v=Hv9A9WfYF4g
http://www.slideshare.net/Shashikant86/ios-developers-conferenceios-automation-with-cucumber-appium-and-saucelabs
https://github.com/Shashikant86/cucumber-appium
http://shashikantjagtap.net/bdd-code-analysis-with-cuke_sniffer/
##
## Capybara
##
https://github.com/jnicklas/capybara
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment