Skip to content
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

.idea/
46 changes: 46 additions & 0 deletions ExecutionSteps_Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# LambdaTest Appium Ruby Automation - Execution Steps

## Prerequisites
- Ruby >= 2.7
- Bundler (`gem install bundler`)
- LambdaTest credentials (username and access key)

## 1. Install Dependencies

### For Native (Appium) Android & iOS Tests
```
bundle install
```

### For Web (Selenium) Android & iOS Tests
```
BUNDLE_GEMFILE=Gemfile.web bundle install
```

## 2. Run Tests

### Native Android
```
LT_USERNAME=<your_username> LT_ACCESS_KEY=<your_access_key> BUNDLE_GEMFILE=Gemfile bundle exec ruby android/android-sample.rb
```

### Native iOS
```
LT_USERNAME=<your_username> LT_ACCESS_KEY=<your_access_key> BUNDLE_GEMFILE=Gemfile bundle exec ruby ios/ios-sample.rb
```

### Web Android
```
LT_USERNAME=<your_username> LT_ACCESS_KEY=<your_access_key> BUNDLE_GEMFILE=Gemfile.web bundle exec ruby android/android-web-sample.rb
```

### Web iOS
```
LT_USERNAME=<your_username> LT_ACCESS_KEY=<your_access_key> BUNDLE_GEMFILE=Gemfile.web bundle exec ruby ios/ios-web-sample.rb
```

## Notes
- Use the correct Gemfile for each test type.
- If you see network or timeout errors, retry the command.
- Only two Gemfiles are needed: `Gemfile` (native) and `Gemfile.web` (web).
- No extra files or changes are required beyond this setup.
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source 'https://rubygems.org'

gem 'appium_lib', '~> 11.0'
gem 'rspec', '~> 3.12'
gem 'selenium-webdriver', '< 4.0'
gem 'dotenv', '~> 2.8'
76 changes: 76 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
GEM
remote: https://rubygems.org/
specs:
appium_lib (11.2.0)
appium_lib_core (~> 4.1)
nokogiri (~> 1.8, >= 1.8.1)
tomlrb (~> 1.1)
appium_lib_core (4.7.1)
faye-websocket (~> 0.11.0)
selenium-webdriver (~> 3.14, >= 3.14.1)
base64 (0.2.0)
childprocess (3.0.0)
diff-lcs (1.6.2)
dotenv (2.8.1)
eventmachine (1.2.7)
faye-websocket (0.11.4)
eventmachine (>= 0.12.0)
websocket-driver (>= 0.5.1, < 0.8.0)
nokogiri (1.18.8-aarch64-linux-gnu)
racc (~> 1.4)
nokogiri (1.18.8-aarch64-linux-musl)
racc (~> 1.4)
nokogiri (1.18.8-arm-linux-gnu)
racc (~> 1.4)
nokogiri (1.18.8-arm-linux-musl)
racc (~> 1.4)
nokogiri (1.18.8-arm64-darwin)
racc (~> 1.4)
nokogiri (1.18.8-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.18.8-x86_64-linux-gnu)
racc (~> 1.4)
nokogiri (1.18.8-x86_64-linux-musl)
racc (~> 1.4)
racc (1.8.1)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.3)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.4)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.4)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.3)
rubyzip (2.4.1)
selenium-webdriver (3.142.7)
childprocess (>= 0.5, < 4.0)
rubyzip (>= 1.2.2)
tomlrb (1.3.0)
websocket-driver (0.7.7)
base64
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)

PLATFORMS
aarch64-linux-gnu
aarch64-linux-musl
arm-linux-gnu
arm-linux-musl
arm64-darwin
x86_64-darwin
x86_64-linux-gnu
x86_64-linux-musl

DEPENDENCIES
appium_lib (~> 11.0)
dotenv (~> 2.8)
rspec (~> 3.12)
selenium-webdriver (< 4.0)

BUNDLED WITH
2.6.9
6 changes: 6 additions & 0 deletions Gemfile.web
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source 'https://rubygems.org'

gem 'selenium-webdriver', '~> 4.8.0'
gem 'rspec', '~> 3.12'
gem 'dotenv', '~> 2.8'
gem 'base64'
39 changes: 39 additions & 0 deletions Gemfile.web.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
GEM
remote: https://rubygems.org/
specs:
base64 (0.2.0)
diff-lcs (1.6.2)
dotenv (2.8.1)
rexml (3.4.1)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.3)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.4)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.4)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.3)
rubyzip (2.4.1)
selenium-webdriver (4.8.6)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
websocket (1.2.11)

PLATFORMS
arm64-darwin-24
ruby

DEPENDENCIES
base64
dotenv (~> 2.8)
rspec (~> 3.12)
selenium-webdriver (~> 4.8.0)

BUNDLED WITH
2.6.9
3 changes: 2 additions & 1 deletion android/android-sample.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
:isRealMobile => true,
:queueTimeout => 300,
:app => "lt://proverbial-android", #Enter the App URL here
:w3c => true
:w3c => true,
:autoGrantPermissions => true
},
:platformName => "Android"
}
Expand Down
9 changes: 5 additions & 4 deletions android/android-web-sample.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require 'rubygems'
require 'appium_lib'
require 'selenium-webdriver'

username= ENV["LT_USERNAME"] || "LT_Username" #Enter your username here
Expand All @@ -19,11 +18,13 @@
:platformName => "Android"
}

capabilities = Selenium::WebDriver::Remote::Capabilities.new(caps)

driver = Selenium::WebDriver.for :remote,
:url => "https://"+username+":"+accessToken+"@mobile-hub.lambdatest.com/wd/hub",
:desired_capabilities => caps
url: "https://"+username+":"+accessToken+"@mobile-hub.lambdatest.com/wd/hub",
capabilities: capabilities

wait = Selenium::WebDriver::Wait.new(:timeout => 30)
wait = Selenium::WebDriver::Wait.new(timeout: 30)
driver.navigate.to("https://mfml.in/api/getInfo")
el1 = driver.find_element(:id => "resolution")
el1.click
Expand Down
9 changes: 5 additions & 4 deletions ios/ios-web-sample.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require 'rubygems'
require 'appium_lib'
require 'selenium-webdriver'

username= ENV["LT_USERNAME"] || "LT_Username" #Enter your username here
Expand All @@ -19,11 +18,13 @@
:platformName => "ios"
}

capabilities = Selenium::WebDriver::Remote::Capabilities.new(caps)

driver = Selenium::WebDriver.for :remote,
:url => "https://"+username+":"+accessToken+"@mobile-hub.lambdatest.com/wd/hub",
:desired_capabilities => caps
url: "https://"+username+":"+accessToken+"@mobile-hub.lambdatest.com/wd/hub",
capabilities: capabilities

wait = Selenium::WebDriver::Wait.new(:timeout => 30)
wait = Selenium::WebDriver::Wait.new(timeout: 30)
driver.navigate.to("https://mfml.in/api/getInfo")
el1 = driver.find_element(:id => "resolution")
el1.click
Expand Down