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
42 changes: 18 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,26 +53,20 @@ cd LT-appium-python-robot

Make sure you have your LambdaTest credentials with you to run test automation scripts on LambdaTest. To obtain your access credentials, [purchase a plan](https://billing.lambdatest.com/billing/plans?utm_source=github&utm_medium=repo&utm_campaign=LT-appium-python-robot) or access the [Automation Dashboard](https://appautomation.lambdatest.com/?utm_source=github&utm_medium=repo&utm_campaign=LT-appium-python-robot).

Replace LambdaTest `username` and `accesskey` in the `common.robot` file as mentioned below:

```bash title="common.robot"
*** Settings ***
Library AppiumLibrary

*** Variables ***
// highlight-start
${username} username
${accesskey} accesskey
// highlight-end
${REMOTE_URL} https://${username}:${accesskey}@mobile-hub.lambdatest.com/wd/hub
${TIMEOUT} 3000

*** Keywords ***
Open test app
Open Application ${REMOTE_URL} platformName=${platform} platformVersion=${version} deviceName=${deviceName} visual=${visual} network=${network} isRealMobile=${isRealMobile} app=${app} name=Robot Framework Sample Test build=Appium Python Robot

Close test app
Close Application
Set LambdaTest `Username` and `Access Key` in environment variables.

**For Linux/macOS:**

```js
export LT_USERNAME=YOUR_LAMBDATEST_USERNAME \
export LT_ACCESS_KEY=YOUR_LAMBDATEST_ACCESS_KEY
```

**For Windows:**

```js
set LT_USERNAME=YOUR_LAMBDATEST_USERNAME
set LT_ACCESS_KEY=YOUR_LAMBDATEST_ACCESS_KEY
```

### Upload Your Application
Expand Down Expand Up @@ -122,11 +116,11 @@ curl -u "YOUR_LAMBDATEST_USERNAME:YOUR_LAMBDATEST_ACCESS_KEY" -X POST "https://m

Once you are done with the above-mentioned steps, you can initiate your first Robot test on LambdaTest.

**Test Scenario:** Check out [Android.robot](https://github.com/LambdaTest/LT-appium-python-robot/blob/master/Tests/Android.robot) file to view the sample test script for android and [iOS.java](https://github.com/LambdaTest/LT-appium-python-robot/blob/master/Tests/IOS.robot) for iOS.
**Test Scenario:** Check out [Android.robot](https://github.com/LambdaTest/LT-appium-python-robot/blob/master/Tests/Android.robot) file to view the sample test script for android and [IOS.robot](https://github.com/LambdaTest/LT-appium-python-robot/blob/master/Tests/IOS.robot) for iOS.

### Configuring Your Test Capabilities

You need to update your capabilities in `Makefile` files. In this sample project, we have provided the examples for running tests on both **Android** and **iOS** apps. We are passing platform name, platform version, device name and app url (generated earlier) along with other capabilities like build name and test name via capabilities object. The capabilities object in the sample code for a single test are defined as:
You need to update your capabilities in the `Resources` files. In this sample project, we have provided the examples for running tests on both **Android** and **iOS** apps. We are passing platform name, platform version, device name and app url (generated earlier) along with other capabilities like build name and test name via capabilities object. The capabilities object in the sample code for a single test are defined as:

```bash title="Makefile"
test_Android1:
Expand Down Expand Up @@ -156,15 +150,15 @@ Execute the following command to run your test on LambdaTest platform:
<TabItem value="ios" label="iOS" default>

```bash
make test_ios1
robot .\Tests\IOS.robot
```

</TabItem>

<TabItem value="android" label="Android" default>

```bash
make test_Android1
robot .\Tests\Android.robot
```

</TabItem>
Expand Down
42 changes: 23 additions & 19 deletions Resources/AndroidCommon.robot
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@
Library AppiumLibrary

*** Variables ***

${username} %{LT_USERNAME}
${accesskey} %{LT_ACCESS_KEY}
${LT_GRID_URL} https://${username}:${accesskey}@mobile-hub.lambdatest.com/wd/hub
${platformName} android
${platformVersion} 12 # Set your default version
${platformVersion} 12
${deviceName} Galaxy.*
${visual} True
${network} True
${network} False
${isRealMobile} True
${LT_APP_ID} ''
${LT_GRID_URL} ''
${LT_APP_ID} lt://proverbial-android
${TIMEOUT} 3000
${devicelog} True

*** Keywords ***

Open test app
[Timeout] ${TIMEOUT}
${CAPABILITIES}= Create Dictionary
... platformName=${platformName}
... platformVersion=${version}
... platformVersion=${platformVersion}
... deviceName=${deviceName}
... visual=${visual}
... network=${network}
Expand All @@ -28,19 +30,21 @@ Open test app
... name=LT_Appium_Robot_App_Android
... build=LT_Appium_Robot_App_Automation
... app=${LT_APP_ID}
TRY
${REMOTE_URL}= Set Variable If '%{LT_GRID_URL}' == '' mobile-hub.lambdatest.com %{LT_GRID_URL}
EXCEPT
${REMOTE_URL}= Set Variable mobile-hub.lambdatest.com
END
TRY
${APP_ID}= Set Variable If '%{LT_APP_ID}' == '' lt://proverbial-android %{LT_APP_ID}
EXCEPT
${APP_ID}= Set Variable lt://proverbial-android
END
${REMOTE_URL}= Set Variable https://%{LT_USERNAME}:%{LT_ACCESS_KEY}@${REMOTE_URL}/wd/hub

Open Application ${REMOTE_URL} platformName=android platformVersion=${version} deviceName=${deviceName} visual=${visual} network=${network} devicelog=${devicelog} isRealMobile=${isRealMobile} app=${APP_ID} name=LT_Appium_Robot_App_Android build=LT_Appium_Robot_App_Automation
${REMOTE_URL}= Set Variable https://${username}:${accesskey}@mobile-hub.lambdatest.com/wd/hub
${APP_ID}= Set Variable ${LT_APP_ID}

Open Application
... ${REMOTE_URL}
... platformName=${platformName}
... platformVersion=${platformVersion}
... deviceName=${deviceName}
... network=${network}
... devicelog=${devicelog}
... isRealMobile=${isRealMobile}
... app=${APP_ID}
... name=LT_Appium_Robot_App_Android
... build=LT_Appium_Robot_App_Automation

Close test app
Close All Applications
Close All Applications
29 changes: 12 additions & 17 deletions Resources/Common.robot
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
Library AppiumLibrary

*** Variables ***

${username} %{LT_USERNAME}
${accesskey} %{LT_ACCESS_KEY}
${LT_GRID_URL} https://${username}:${accesskey}@mobile-hub.lambdatest.com/wd/hub
${platformName} ios
#${platformVersion} 15 # Set your default version
${platformVersion} 15 # Set your default version
${deviceName} iPhone.*
${visual} True
${network} True
${isRealMobile} True
${LT_APP_ID} ''
${LT_GRID_URL} ''
${LT_APP_ID} lt://proverbial-ios
${TIMEOUT} 3000
${devicelog} True



*** Keywords ***
Expand All @@ -20,7 +23,7 @@ Open test app
[Timeout] ${TIMEOUT}
${CAPABILITIES}= Create Dictionary
... platformName=${platformName}
... platformVersion=${version}
... platformVersion=${platformVersion}
... deviceName=${deviceName}
... visual=${visual}
... network=${network}
Expand All @@ -29,19 +32,11 @@ Open test app
... name=LT_Appium_Robot_App_iOS
... build=LT_Appium_Robot_App_Automation
... app=${LT_APP_ID}
TRY
${REMOTE_URL}= Set Variable If '%{LT_GRID_URL}' == '' mobile-hub.lambdatest.com %{LT_GRID_URL}
EXCEPT
${REMOTE_URL}= Set Variable mobile-hub.lambdatest.com
END
TRY
${APP_ID}= Set Variable If '%{LT_APP_ID}' == '' lt://proverbial-ios %{LT_APP_ID}
EXCEPT
${APP_ID}= Set Variable lt://proverbial-ios
END
${REMOTE_URL}= Set Variable https://%{LT_USERNAME}:%{LT_ACCESS_KEY}@${REMOTE_URL}/wd/hub

Open Application ${REMOTE_URL} platformName=ios platformVersion=${version} deviceName=${deviceName} visual=${visual} network=${network} devicelog=${devicelog} isRealMobile=${isRealMobile} app=${APP_ID} name=LT_Appium_Robot_App_iOS build=LT_Appium_Robot_App_Automation
${REMOTE_URL}= Set Variable https://${username}:${accesskey}@mobile-hub.lambdatest.com/wd/hub
${APP_ID}= Set Variable ${LT_APP_ID}

Open Application ${REMOTE_URL} platformName=ios platformVersion=${platformVersion} deviceName=${deviceName} visual=${visual} network=${network} devicelog=${devicelog} isRealMobile=${isRealMobile} app=${APP_ID} name=LT_Appium_Robot_App_iOS build=LT_Appium_Robot_App_Automation

Close test app
Close All Applications
18 changes: 8 additions & 10 deletions Resources/CommonWeb.robot
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
Library AppiumLibrary

*** Variables ***

${username} %{LT_USERNAME}
${accesskey} %{LT_ACCESS_KEY}
${LT_GRID_URL} https://${username}:${accesskey}@mobile-hub.lambdatest.com/wd/hub
${platformName} android
${platformVersion} 11 # Set your default version
${deviceName} Galaxy.*
Expand All @@ -11,7 +13,6 @@ ${devicelog} True
${network} True
${console} True
${isRealMobile} True
${LT_GRID_URL} ''
${TIMEOUT} 3000


Expand All @@ -21,7 +22,7 @@ Open test app
[Timeout] ${TIMEOUT}
${CAPABILITIES}= Create Dictionary
... platformName=${platformName}
... platformVersion=${version}
... platformVersion=${platformVersion}
... deviceName=${deviceName}
... visual=${visual}
... network=${network}
Expand All @@ -30,14 +31,11 @@ Open test app
... isRealMobile=${isRealMobile}
... name=LT_Appium_Robot_App_Android
... build=LT_Appium_Robot_App_Automation
TRY
${REMOTE_URL}= Set Variable If '%{LT_GRID_URL}' == '' mobile-hub.lambdatest.com %{LT_GRID_URL}
EXCEPT
${REMOTE_URL}= Set Variable mobile-hub.lambdatest.com
END
${REMOTE_URL}= Set Variable https://%{LT_USERNAME}:%{LT_ACCESS_KEY}@${REMOTE_URL}/wd/hub


${REMOTE_URL}= Set Variable https://${username}:${accesskey}@mobile-hub.lambdatest.com/wd/hub

Open Application ${REMOTE_URL} platformName=${platformName} platformVersion=${version} deviceName=${deviceName} visual=${visual} console=${console} network=${network} devicelog=${devicelog} isRealMobile=${isRealMobile} name=LT_Appium_Robot_Web build=LT_Appium_Robot_Web_Automation
Open Application ${REMOTE_URL} platformName=${platformName} platformVersion=${platformVersion} deviceName=${deviceName} visual=${visual} console=${console} network=${network} devicelog=${devicelog} isRealMobile=${isRealMobile} name=LT_Appium_Robot_Web build=LT_Appium_Robot_Web_Automation

Close test app
Close All Applications
54 changes: 54 additions & 0 deletions Tests/network.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
*** Settings ***
Library AppiumLibrary

*** Variables ***

${username} shivanks
${accesskey} LT_V6UEGtFRGiIPH4QcUdNKQv4RIetJjVfXKKIEkrP3Sk15opJ
${LT_GRID_URL} https://${username}:${accesskey}@mobile-hub.lambdatest.com/wd/hub
${platformName} android
${platformVersion} 12 # Set your default version
${deviceName} Galaxy.*
${visual} True
${network} True
${isRealMobile} True
${LT_APP_ID} lt://proverbial-android
${TIMEOUT} 3000
${devicelog} True

*** Keywords ***

Open test app
[Timeout] ${TIMEOUT}
${CAPABILITIES}= Create Dictionary
... platformName=${platformName}
... platformVersion=${platformVersion}
... deviceName=${deviceName}
... visual=${visual}
... network=${network}
... devicelog=${devicelog}
... isRealMobile=${isRealMobile}
... name=LT_Appium_Robot_App_Android
... build=LT_Appium_Robot_App_Automation
... app=${LT_APP_ID}
TRY
${REMOTE_URL}= Set Variable If '%{LT_GRID_URL}' == '' mobile-hub.lambdatest.com %{LT_GRID_URL}
EXCEPT
${REMOTE_URL}= Set Variable mobile-hub.lambdatest.com
END
# TRY
# ${APP_ID}= Set Variable If '%{LT_APP_ID}' == '' lt://proverbial-android %{LT_APP_ID}
# EXCEPT
# ${APP_ID}= Set Variable lt://proverbial-android
# END
${APP_ID}= Set Variable If '${LT_APP_ID}' != '' ${LT_APP_ID} lt://proverbial-android


# ${REMOTE_URL}= Set Variable https://%{username}:%{accesskey}@${REMOTE_URL}/wd/hub
${REMOTE_URL}= Set Variable https://${username}:${accesskey}@${REMOTE_URL}/wd/hub


Open Application ${REMOTE_URL} platformName=android platformVersion=${platformVersion} deviceName=${deviceName} network=${network} devicelog=${devicelog} isRealMobile=${isRealMobile} app=${APP_ID} name=LT_Appium_Robot_App_Android build=LT_Appium_Robot_App_Automation

Close test app
Close All Applications
10 changes: 6 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
selenium==3.141.0
urllib3==1.26.6
robotframework
robotframework-appiumlibrary
# selenium==4.12.0
# urllib3==1.26.6
# robotframework
# robotframework-appiumlibrary