Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

framework for appium ruby #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ browser_caps:

## Executing The Tests

- Switch to `run_first_test` directory under [Android examples](android/examples) or [iOS examples](ios/examples)
- Switch to `run-first-test` directory under [Android examples](android/examples) or [iOS examples](ios/examples)

- Go to `config/first.config.yml` and edit the username, acessKey and add your app url.

Expand All @@ -208,7 +208,7 @@ bundle exec rake first

### **Speed up test execution with parallel testing :**

- Switch to `run_parallel_test` directory under [Android examples](android/examples/) or [iOS examples](ios/examples/)
- Switch to `run-parallel-test` directory under [Android examples](android/examples/) or [iOS examples](ios/examples/)


### **Use Local testing for apps that access resources hosted in development or testing environments :**
Expand Down
4 changes: 2 additions & 2 deletions android/examples/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ source 'http://rubygems.org'

gem 'cucumber'
gem 'selenium-cucumber'
gem 'selenium-webdriver', '~> 3.142', '>= 3.142.5'
gem 'selenium-webdriver'
gem 'rspec'
gem 'rake'
gem 'parallel_tests'
gem 'appium_lib'
gem 'appium_lib'
105 changes: 0 additions & 105 deletions android/examples/Gemfile.lock

This file was deleted.

11 changes: 4 additions & 7 deletions android/examples/run-first-test/config/first.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ key: "LT_ACCESS_KEY" # Add Lambdtest accessKey here


common_caps:

"build": "br-1"


browser_caps:
-
"isRealMobile": "true"
"platformName": "android"
"automationName": "UiAutomation2"
"deviceName": "Galaxy S21 5G"
"platformVersion": "11"
"app": "lt://proverbial-android" # Add your app url here
"platformName": "Android"
"deviceName": "Galaxy S22 5G"
"platformVersion": "12"
"app": "lt://proverbial-android"
89 changes: 32 additions & 57 deletions android/examples/run-first-test/features/support/env.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'yaml'
require 'rspec'
require 'selenium-cucumber'

require 'appium_lib'

TASK_ID = (ENV['TASK_ID'] || 0).to_i
Expand All @@ -11,66 +10,42 @@

@caps = CONFIG['common_caps'].merge(CONFIG['browser_caps'][TASK_ID])


#$bs_local = nil


puts @caps.inspect

us= @caps["user"].inspect
ak= @caps["key"].inspect
is= @caps["isRealMobile"].inspect
pl= @caps["platform"].inspect
dn= @caps["deviceName"].inspect
pv= @caps["platformVersion"].inspect
ap= @caps["app"].inspect



user= us.gsub("\"", "")
accessKey=ak.gsub("\"", "")
isRealMobile= is.gsub("\"", "")
platform= pl.gsub("\"", "")
deviceName= dn.gsub("\"", "")
platformVersion= pv.gsub("\"", "")
app= ap.gsub("\"", "")
puts isRealMobile


caps={

"LT:Options" => {

"build" => "Cucumber Android Single",
"name" => "Cucumber Sample Test",
"platformName" => platform,
"isRealMobile" => isRealMobile,
"deviceName" => deviceName,
"platformVersion" => platformVersion,
"app" => app,
"w3c" => true

},


platform_name = ENV['PLATFORM_NAME'] ? ENV['PLATFORM_NAME'] : @caps["platformName"].inspect.gsub("\"", "")
is_real_mobile = ENV['IS_REAL_MOBILE'] ? ENV['IS_REAL_MOBILE'] : @caps["isRealMobile"].inspect.gsub("\"", "")
device_name = ENV['DEVICE_NAME'] ? ENV['DEVICE_NAME'] : @caps["deviceName"].inspect.gsub("\"", "")
platform_version = ENV['PLATFORM_VERSION'] ? ENV['PLATFORM_VERSION'] : @caps["platformVersion"].inspect.gsub("\"", "")
app = ENV['APP'] ? ENV['APP'] : @caps["app"].inspect.gsub("\"", "")

caps = {
"LT:Options": {
build: "Cucumber Android Single",
name: "Cucumber Sample Test",
w3c: true,
platformName: platform_name,
isRealMobile: is_real_mobile,
deviceName: device_name,
platformVersion: platform_version,
app: app
}
}

user = ENV['LT_USER'] ? ENV['LT_USER'] : CONFIG['user']
access = ENV['LT_ACCESS'] ? ENV['LT_ACCESS'] : CONFIG['key']
server = ENV['LT_SERVER'] ? ENV['LT_SERVER'] : CONFIG['server']

appium_driver = Appium::Driver.new({
'caps' => caps,
'appium_lib' => {
:server_url => "https://#{CONFIG['user']}:#{CONFIG['key']}@#{CONFIG['server']}/wd/hub"
#server_url: "https://webhook.site/5958677a-4db9-4253-bb76-5b98e97e4880"
}}, true)


$appium_driver = Appium::Driver.new(
{
caps: caps,
appium_lib: {
server_url: "https://#{user}:#{access}@#{server}/wd/hub"
}
},
true
)

begin
#$appium_driver = Appium::Driver.new(desired_caps, true)
$driver = appium_driver.start_driver
#example.run
puts caps
$driver = $appium_driver.start_driver
ensure
#$driver.quit
# $driver.driver_quit
end


Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ browser_caps:
"isRealMobile": "true"
"platformName": "android"
"deviceName": "Galaxy S21 5G"
"platformVersion": "11"
"automationName": "UiAutomation2"
"platformVersion": "12"
"app": "lt://proverbial-android" # Add your app url here
-
"isRealMobile": "true"
Expand Down
104 changes: 0 additions & 104 deletions ios/examples/Gemfile.lock

This file was deleted.