Skip to content

Commit

Permalink
Updated script and ReadMe file (#1)
Browse files Browse the repository at this point in the history
* Updated Automation script and readme file

* Delete .idea directory

* Delete output.xml

* Delete LambdaTestStatus.py
  • Loading branch information
Private1647 authored Apr 27, 2022
1 parent 526a64b commit a3a55ee
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 1 deletion.
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
run_all_in_parallel:
make -j test_Android1 test_Android2 test_iOS1 test_iOS2

test_Android1:
robot --variable version:10 --variable platform:Android --variable deviceName:"Galaxy S20" --variable isRealMobile:true --variable visual:true --variable network:false --variable console:false --variable app:"lt://" Tests/Android.robot

test_Android2:
robot --variable version:10 --variable platform:Android --variable deviceName:"Galaxy S10" --variable isRealMobile:true --variable visual:true --variable network:false --variable console:false --variable app:"lt://" Tests/Android.robot

test_iOS1:
robot --variable version:14 --variable platform:iOS --variable deviceName:"iPhone 11" --variable isRealMobile:true --variable visual:true --variable network:false --variable console:false --variable app:"lt://" Tests/IOS.robot

test_iOS2:
robot --variable version:14 --variable platform:iOS --variable deviceName:"iPhone 12" --variable isRealMobile:true --variable visual:true --variable network:false --variable console:false --variable app:"lt://" Tests/IOS.robot
70 changes: 69 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,70 @@
# LT-appium-python-robot
LT appium python
Sample repo to run app automation on robot framework real device on LambdaTest

## Pre-requisites

---

Before you can start performing App automation testing with Appium, you would need to follow these steps:

- Install the latest stable Python build from the [official website](https://www.python.org/downloads/). We recommend using the latest version.
- Make sure **pip** is installed in your system. You can install **pip** from [here](https://pip.pypa.io/en/stable/installation/).

### Clone The Sample Project

**Step-1:** Clone the LambdaTest's [LT-appium-python-robot](https://github.com/LambdaTest/LT-appium-python-robot) and navigate to the code directory as shown below:

```bash
git clone https://github.com/LambdaTest/LT-appium-python-robot
cd LT-appium-python-robot
```


### Setting Up Your Authentication

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) or access the [Automation Dashboard](https://appautomation.lambdatest.com/).

**Step-2:** Set LambdaTest `Username` and `Accesskey` in the Common.robot file.

### Upload Your Application

**Step-3:** 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:

```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"'
```

> **Note:**
>
> - Ensure to add the app_url received in the makefile.
> - 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).
> - 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.
### Executing The Tests

**Step-4:** Run the following command in the directory wto install the relevant dependencies.

```bash
pip install -r requirements.txt
```

**Step-5:** Run the following command in the directory where your project has been saved to execute your build.

```bash
make test_iOS1
```

```bash
make test_Android1
```

**Running tests in Parallel :** Run the following command to run tests in parallel

```bash
make -j test_Android1 test_Android2 test_iOS1 test_iOS2
```

Your test results would be displayed on the test console (or command-line interface if you are using terminal/cmd) and on the [LambdaTest App Automation Dashboard](https://appautomation.lambdatest.com/build).
16 changes: 16 additions & 0 deletions Resources/Common.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
*** Settings ***
Library AppiumLibrary

*** Variables ***

${username} username
${accesskey} accesskey
${REMOTE_URL} https://${username}:${accesskey}@beta-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
29 changes: 29 additions & 0 deletions Tests/Android.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
*** Settings ***

Resource ../Resources/Common.robot

Test Setup Common.Open test app
Test Teardown Common.Close test app

*** Variables ***
${TIMEOUT} 3000

*** Test Cases ***

Example of connecting to Lambdatest via Robot Framework
[Timeout] ${TIMEOUT}
Click element id=color
Click element id=Text
Click element id=toast

Click element id=notification
Click element id=geoLocation
Sleep 2 seconds
Click element id=Home
Sleep 2 seconds
Click element id=speedTest
Sleep 2 seconds

Click element id=Browser
Input Text id=url https://lambdatest.com
Click element id=find
20 changes: 20 additions & 0 deletions Tests/IOS.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
*** Settings ***

Resource ../Resources/Common.robot

Test Setup Common.Open test app
Test Teardown Common.Close test app

*** Variables ***
${TIMEOUT} 3000

*** Test Cases ***

Example of connecting to Lambdatest via Robot Framework
[Timeout] ${TIMEOUT}
Click element id=color
Click element id=Text
Click element id=toast
Click element id=notification
Click element id=geoLocation

Binary file added make.exe
Binary file not shown.
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
selenium
robotframework
robotframework-appiumlibrary

0 comments on commit a3a55ee

Please sign in to comment.