diff --git a/Gemfile b/Gemfile
new file mode 100644
index 0000000..21d0c8a
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+source "https://rubygems.org"
+
+# gem "rails"
+
+gem "appium_lib", "~> 16.1"
+
+gem "selenium-webdriver", "~> 4.40"
+
+gem "test-unit", "~> 3.7"
diff --git a/Gemfile.lock b/Gemfile.lock
new file mode 100644
index 0000000..226ec7c
--- /dev/null
+++ b/Gemfile.lock
@@ -0,0 +1,66 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ appium_lib (16.1.1)
+ appium_lib_core (>= 9.2.1, < 12.0)
+ nokogiri (~> 1.8, >= 1.8.1)
+ tomlrb (>= 1.1, < 3.0)
+ appium_lib_core (11.2.0)
+ faye-websocket (>= 0.11, < 0.13)
+ selenium-webdriver (~> 4.21)
+ base64 (0.3.0)
+ eventmachine (1.2.7)
+ faye-websocket (0.12.0)
+ eventmachine (>= 0.12.0)
+ websocket-driver (>= 0.8.0)
+ logger (1.7.0)
+ nokogiri (1.19.0-x64-mingw-ucrt)
+ racc (~> 1.4)
+ power_assert (3.0.1)
+ racc (1.8.1)
+ rexml (3.4.4)
+ rubyzip (3.2.2)
+ selenium-webdriver (4.40.0)
+ base64 (~> 0.2)
+ logger (~> 1.4)
+ rexml (~> 3.2, >= 3.2.5)
+ rubyzip (>= 1.2.2, < 4.0)
+ websocket (~> 1.0)
+ test-unit (3.7.7)
+ power_assert
+ tomlrb (2.0.4)
+ websocket (1.2.11)
+ websocket-driver (0.8.0)
+ base64
+ websocket-extensions (>= 0.1.0)
+ websocket-extensions (0.1.5)
+
+PLATFORMS
+ x64-mingw-ucrt
+
+DEPENDENCIES
+ appium_lib (~> 16.1)
+ selenium-webdriver (~> 4.40)
+ test-unit (~> 3.7)
+
+CHECKSUMS
+ appium_lib (16.1.1) sha256=d53402b41846c1e1431ed44ba49cb7c9ff8f56f2a51c433b57f167b68afe9cb7
+ appium_lib_core (11.2.0) sha256=677040cceb7ff5e07276df55791106fee398101b69e82edf9e382a6609d18a70
+ base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
+ eventmachine (1.2.7) sha256=994016e42aa041477ba9cff45cbe50de2047f25dd418eba003e84f0d16560972
+ faye-websocket (0.12.0) sha256=ad9f7dfcd0306d0a13baeee450729657661129af15bb5f38716c242484ab42e1
+ logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
+ nokogiri (1.19.0-x64-mingw-ucrt) sha256=05d7ed2d95731edc9bef2811522dc396df3e476ef0d9c76793a9fca81cab056b
+ power_assert (3.0.1) sha256=8ce9876716cc74e863fcd4cdcdc52d792bd983598d1af3447083a3a9a4d34103
+ racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
+ rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142
+ rubyzip (3.2.2) sha256=c0ed99385f0625415c8f05bcae33fe649ed2952894a95ff8b08f26ca57ea5b3c
+ selenium-webdriver (4.40.0) sha256=16ef7aa9853c1d4b9d52eac45aafa916e3934c5c83cb4facb03f250adfd15e5b
+ test-unit (3.7.7) sha256=3c89d5ff0690a16bef9946156c4624390402b9d54dfcf4ce9cbd5b06bead1e45
+ tomlrb (2.0.4) sha256=262f77947ac3ac9b3366a0a5940ecd238300c553e2e14f22009e2afcd2181b99
+ websocket (1.2.11) sha256=b7e7a74e2410b5e85c25858b26b3322f29161e300935f70a0e0d3c35e0462737
+ websocket-driver (0.8.0) sha256=ed0dba4b943c22f17f9a734817e808bc84cdce6a7e22045f5315aa57676d4962
+ websocket-extensions (0.1.5) sha256=1c6ba63092cda343eb53fc657110c71c754c56484aad42578495227d717a8241
+
+BUNDLED WITH
+ 4.0.5
diff --git a/README.md b/README.md
index ff11c88..bc79644 100644
--- a/README.md
+++ b/README.md
@@ -6,11 +6,108 @@
](https://accounts.lambdatest.com/register)
+
+## Table of Contents
+
+* [Pre-requisites](#pre-requisites)
+* [Setting Up Your Authentication](#setting-up-your-authentication)
+* [Upload Your Application](#upload-your-application)
+* [Run Your First Test](#run-your-first-test)
+* [Executing The Tests](#executing-the-tests)
+* [Troubleshooting](#troubleshooting)
+* [About LambdaTest](#about-lambdatest)
+
+---
+
+## Pre-requisites
+
+Before you can start performing Ruby automation testing with Appium, you would need to:
+
+1. Install **Ruby**: Ensure you have Ruby 3.4+ installed.
+
+ - For **Windows**, download from [RubyInstaller](https://rubyinstaller.org/downloads/).
+ - For **macOS**, run `brew install ruby`.
+ - For **Linux** or **Ubuntu**, you can run a simple apt command like below:
+ sudo apt-get install ruby-full
+
+2. **Clone The Sample Project**:
+
+```bash
+git clone [https://github.com/Priya2224/LT-appium-ruby.git](https://github.com/Priya2224/LT-appium-ruby.git)
+cd LT-appium-ruby
+
+```
+
+## Setting Up Your Authentication
+
+Make sure you have your LambdaTest credentials with you to run test automation scripts. To obtain your access credentials, purchase a plan or access the access the [App Automation Dashboard](https://appautomation.lambdatest.com/)
+
+Set LambdaTest Username and Access Key in environment variables.
+
+For Linux/macOS:
+
+```bash
+export LT_USERNAME=YOUR_LAMBDATEST_USERNAME
+export LT_ACCESS_KEY=YOUR_LAMBDATEST_ACCESS_KEY
+```
+
+For Windows:
+
+```bash
+set LT_USERNAME=YOUR_LAMBDATEST_USERNAME
+set LT_ACCESS_KEY=YOUR_LAMBDATEST_ACCESS_KEY
+```
+
+## Upload Your Application
+
+Upload your iOS application (.ipa file) or android application (.apk file) to the LambdaTest servers using our REST API. You need to provide your Username and AccessKey in the format Username:AccessKey in the cURL command for authentication. Make sure to add the path of the appFile in the cURL request. Here is an example cURL request to upload your app using our REST API:
+
+Using App File:
+
+For Linux/macOS:
+
+```bash
+curl -u "YOUR_LAMBDATEST_USERNAME:YOUR_LAMBDATEST_ACCESS_KEY" \
+--location --request POST 'https://manual-api.lambdatest.com/app/upload/realDevice' \
+--form 'name="Android_App"' \
+--form 'appFile=@"/Users/macuser/Downloads/proverbial_android.apk"'
+```
+
+For Windows:
+
+```bash
+curl -u "USER:KEY" -X POST "https://manual-api.lambdatest.com/app/upload/realDevice" -F "appFile=@"C:/path/to/proverbial_android.apk""
+```
+
+Using App URL:
+
+For Linux/macOS:
+
+```bash
+curl -u "YOUR_LAMBDATEST_USERNAME:YOUR_LAMBDATEST_ACCESS_KEY" \
+--location --request POST 'https://manual-api.lambdatest.com/app/upload/realDevice' \
+--form 'name="Android_App"' \
+--form 'url="https://prod-mobile-artefacts.lambdatest.com/assets/docs/proverbial_android.apk"'
+```
+
+For Windows:
+
## Getting Started
+```bash
+curl -u "YOUR_LAMBDATEST_USERNAME:YOUR_LAMBDATEST_ACCESS_KEY" -X POST "https://manual-api.lambdatest.com/app/upload/realDevice" -d "{"url":"https://prod-mobile-artefacts.lambdatest.com/assets/docs/proverbial_android.apk","name":"sample.apk"}"
+```
[TestMu AI](https://www.testmuai.com/) (Formerly LambdaTest) is the world's first full-stack AI Agentic Quality Engineering platform that empowers teams to test intelligently, smarter, and ship faster. Built for scale, it offers a full-stack testing cloud with 10K+ real devices and 3,000+ browsers. With AI-native test management, MCP servers, and agent-based automation, TestMu AI supports Selenium, Appium, Playwright, and all major frameworks.
+Tip:
With TestMu AI (Formerly LambdaTest), you can run Appium tests in Ruby across real Android and iOS devices. This sample shows how to configure Ruby Appium tests to run on the TestMu AI Real Device Cloud.
+1. If you do not have any .apk or .ipa file, you can run your sample tests on LambdaTest by using our sample 🔗 [Android App](https://prod-mobile-artefacts.lambdatest.com/assets/docs/proverbial_android.apk) or sample 🔗 [iOS App](https://prod-mobile-artefacts.lambdatest.com/assets/docs/proverbial_ios.ipa).
+2. Response of above cURL will be a JSON object containing the App URL of the format - lt://APP123456789123456789 and will be used in the next step.
- [Sign up on TestMu AI](https://www.testmuai.com/register/) (Formerly LambdaTest).
- Follow the [TestMu AI Documentation](https://www.testmuai.com/support/docs/) for the full setup walkthrough.
@@ -24,13 +121,109 @@ With TestMu AI (Formerly LambdaTest), you can run Appium tests in Ruby across re
### Setup
Clone and install dependencies:
+Test Scenario: Check out [Android.rb](https://github.com/LambdaTest/LT-appium-ruby/blob/master/android/android-sample.rb) file to view the sample test script for android and [iOS.rb](https://github.com/LambdaTest/LT-appium-ruby/blob/master/ios/ios-sample.rb) for iOS.
+
+### Configuring Your Test Capabilities (Ruby 3.4/W3C Fix)
+Update the caps object in your scripts. For Ruby 3.4, keys must be Symbols.
+
+Android Configuration
+
+```bash
+caps = {
+ "lt:options" => {
+ :deviceName => "Galaxy S24",
+ :platformName => "Android",
+ :platformVersion => "14",
+ :isRealMobile => true,
+ :app => "YOUR_APP_URL",
+ :w3c => true
+ },
+ :platformName => "Android"
+}
+```
+
+iOS Configuration
+
+```bash
+caps = {
+ "lt:options" => {
+ :deviceName => "iPhone 17 Pro",
+ :platformName => "iOS",
+ :platformVersion => "26",
+ :isRealMobile => true,
+ :app => "YOUR_APP_URL",
+ :w3c => true
+ },
+ :platformName => "iOS"
+}
+```
+
+Info Note:
+
+1. You must add the generated APP_URL to the "app" capability in the config file.
+2. You can generate capabilities for your test requirements with the help of our inbuilt [Capabilities Generator tool](https://www.lambdatest.com/capabilities-generator/). A more Detailed Capability Guide is available [here](https://www.lambdatest.com/support/docs/desired-capabilities-in-appium/).
+
+## Executing The Tests
+
+1. Install dependencies:
+
+```bash
+bundle install
+```
+
+2. Run the scripts:
+
+Running on Android
+
+Navigate to the corresponding directory based on your app.
+
+```bash
+cd android
+```
+
+Execute the following command to run your test on LambdaTest platform:
+
+```bash
+ruby android-sample.rb
+```
+
+Running on iOS
+
+Navigate to the corresponding directory based on your app.
+
+```bash
+cd ios
+```
+
+Execute the following command to run your test on LambdaTest platform:
```bash
git clone https://github.com/LambdaTest/LT-appium-ruby && cd LT-appium-ruby
gem install appium_lib -v 10.6.0
+ruby ios-sample.rb
+```
+
+Note: Ensure you have updated the YOUR_APP_URL in each respective file before running these commands. Your test results will be displayed on the terminal and can also be viewed in detail on the [App Automation Dashboard](https://appautomation.lambdatest.com/).
+
+## Troubleshooting
+
+1. Ruby 3.4 ArgumentError (String to Symbol)
+
+ If you encounter an ArgumentError stating "String cannot be converted to Symbol," it is because Ruby 3.4 requires explicit symbols for the driver initialization keys. Update your initialization to include the :caps and :appium_lib symbols exactly as shown below:
+
+```bash
+@appium_driver = Appium::Driver.new({
+ :caps => caps,
+ :appium_lib => { :server_url => server_url }
+}, true)
```
Set your credentials as environment variables.
+2. Gem Installation Issues
+
+ If you encounter an error like No such file or directory @ rb_sysopen during gem installation, you can resolve it by using administrator privileges or ensuring the directory exists:
+
+ - macOS/Linux: Use sudo gem install appium_lib -v 10.6.0.
**macOS / Linux:**
@@ -67,6 +260,11 @@ Add the following to your capabilities:
```js
tunnel: true,
```
+ - Windows: Open Command Prompt as Administrator and run gem install appium_lib -v 10.6.0.
+
+3. W3C Protocol Compatibility
+
+ Ensure your capabilities object includes the :w3c => true option and wraps custom LambdaTest options inside the "lt:options" key to stay compatible with modern Appium standards.
## Contributions
@@ -77,6 +275,13 @@ Contributions are welcome. Open an issue to discuss your idea before submitting
Connect with testers and developers in the [TestMu AI Community](https://community.testmuai.com/). Ask questions, share what you are building, and discuss best practices in test automation and DevOps.
## TestMu AI (Formerly LambdaTest) Certifications
+## Documentation & Resources 📚
+
+Visit the following links to learn more about LambdaTest's features, setup and tutorials around test automation, mobile app testing, responsive testing, and manual testing.
+
+ - [LambdaTest Documentation](https://www.lambdatest.com/support/docs/?utm_source=github&utm_medium=repo&utm_campaign=LT-appium-ruby)
+ - [LambdaTest Blog](https://www.lambdatest.com/blog/?utm_source=github&utm_medium=repo&utm_campaign=LT-appium-ruby)
+ - [LambdaTest Learning Hub](https://www.lambdatest.com/learning-hub/?utm_source=github&utm_medium=repo&utm_campaign=LT-appium-ruby)
Earn free [TestMu AI Certifications](https://www.testmuai.com/certifications/) for testers, developers, and QA engineers. Validate your skills in Selenium, Cypress, Playwright, Appium, Espresso and more. Industry-recognized, shareable on LinkedIn, and built by practitioners, not marketers.
diff --git a/android/android-sample.rb b/android/android-sample.rb
index a9d787a..6c04813 100644
--- a/android/android-sample.rb
+++ b/android/android-sample.rb
@@ -1,51 +1,51 @@
require 'rubygems'
require 'appium_lib'
-username= ENV["LT_USERNAME"] || "LT_Username" #Enter your username here
-accessToken= ENV["LT_ACCESS_KEY"] || "LT_AccessKey" #Enter your Access Key here
+username= ENV["LT_USERNAME"] || "LT_Username" # Enter your username here
+accessToken= ENV["LT_ACCESS_KEY"] || "LT_AccessKey" # Enter your Access Key here
-caps = {
- "lt:options" => {
- :deviceName => "Pixel 6",
+caps = {
+ "lt:options" => {
+ :deviceName => "Galaxy S24",
:platformName => "Android",
- :platformVersion => "13",
+ :platformVersion => "14",
:build => "Ruby Vanilla - Android",
:name => "Ruby Android Test",
:isRealMobile => true,
:queueTimeout => 300,
- :app => "lt://proverbial-android", #Enter the App URL here
+ :app => "lt://proverbial-android", # Enter the App URL here
:w3c => true
},
:platformName => "Android"
}
+# The fix is here: Changed 'caps' to :caps and 'appium_lib' to :appium_lib
appium_driver = Appium::Driver.new({
- 'caps' => caps,
- 'appium_lib' => {
+ :caps => caps,
+ :appium_lib => {
:server_url => "https://"+username+":"+accessToken+"@mobile-hub.lambdatest.com/wd/hub"
- }},true)
+ }}, true)
- driver = appium_driver.start_driver
+driver = appium_driver.start_driver
- wait = Selenium::WebDriver::Wait.new(:timeout => 30)
- el1 = driver.find_element(:id, "com.lambdatest.proverbial:id/color")
- el1.click
- el2 = driver.find_element(:id, "com.lambdatest.proverbial:id/geoLocation")
- el2.click
- sleep(5)
- driver.back
- el3 = driver.find_element(:id, "com.lambdatest.proverbial:id/Text")
- el3.click
- el4 = driver.find_element(:id, "com.lambdatest.proverbial:id/notification")
- el4.click
- el5 = driver.find_element(:id, "com.lambdatest.proverbial:id/toast")
- el5.click
- el6 = driver.find_element(:id, "com.lambdatest.proverbial:id/speedTest")
- el6.click
- sleep(10)
- driver.back
-
- puts "Found results - Test Passed"
+wait = Selenium::WebDriver::Wait.new(:timeout => 30)
+el1 = driver.find_element(:id, "com.lambdatest.proverbial:id/color")
+el1.click
+el2 = driver.find_element(:id, "com.lambdatest.proverbial:id/geoLocation")
+el2.click
+sleep(5)
+driver.back
+el3 = driver.find_element(:id, "com.lambdatest.proverbial:id/Text")
+el3.click
+el4 = driver.find_element(:id, "com.lambdatest.proverbial:id/notification")
+el4.click
+el5 = driver.find_element(:id, "com.lambdatest.proverbial:id/toast")
+el5.click
+el6 = driver.find_element(:id, "com.lambdatest.proverbial:id/speedTest")
+el6.click
+sleep(10)
+driver.back
-
- driver.quit
+puts "Found results - Test Passed"
+
+driver.quit
\ No newline at end of file