You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/appium-rokutv.md
+85-72Lines changed: 85 additions & 72 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,13 +50,14 @@ import TabItem from '@theme/TabItem';
50
50
51
51
## Tutorial To Run Your First Test On LambdaTest
52
52
53
-
---
54
53
55
54
In this topic, you will learn how to configure and run your **Roku TV** automation testing scripts with **Roku WebDriver** on **LambdaTest Real Device Cloud platform**.
56
55
56
+
---
57
+
57
58
## Objective
58
59
59
-
---
60
+
60
61
61
62
By the end of this topic, you will be able to:
62
63
@@ -70,19 +71,18 @@ All the code samples in this documentation can be found on **LambdaTest's Github
70
71
71
72
:::
72
73
73
-
## Prerequisites
74
-
75
74
---
75
+
## Prerequisites
76
76
77
77
Before you can start performing App automation testing with Appium, you would need to follow these steps:
78
78
79
79
- You have access to LambdaTest username and accessKey. If you have not registered yet, you can do the same by visiting our [website](https://accounts.lambdatest.com/register). You will be able to access the credentials in the [LambdaTest Profile](https://accounts.lambdatest.com/detail/profile)
80
80
- Install the latest Python build from the [official website](https://www.python.org/downloads/). We recommend using the latest version.
81
81
- Make sure **pip** is installed in your system. You can install **pip** from [pip documentation](https://pip.pypa.io/en/stable/installation/).
82
82
83
+
---
83
84
## Run your first test
84
85
85
-
---
86
86
87
87
### 1. Upload your application
88
88
Upload your **Roku TV** application (.zip 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:
@@ -161,64 +161,75 @@ An automation script for the sample application available above has been provide
161
161
Before running the script, please make sure that the file webDriver.py from Step 2, is in the same directory as this file.
162
162
163
163
```python title="main.py"
164
-
from webDriver import WebDriver
164
+
from appium import webdriver
165
+
import os
165
166
import time
167
+
from appium.options.android import UiAutomator2Options
166
168
167
-
defrun(hub_url: str, caps: dict):
168
-
try:
169
-
web_driver = WebDriver(hub_url, caps)
170
-
171
-
172
-
web_driver.apps()
173
-
time.sleep(5)
174
-
web_driver.launch_the_channel("dev")
175
-
176
-
for i inrange(5):
177
-
t = time.time()
178
-
web_driver.press_btn("select")
179
-
t2 = time.time()
180
-
print("select time :",t2-t)
181
-
time.sleep(2)
182
169
170
+
defgetCaps():
171
+
desired_caps = {
172
+
"automationName": "Roku",
173
+
"deviceName": "Roku Ultra",
174
+
"platformVersion": "11",
175
+
"platformName": "roku",
176
+
"isRealMobile": True,
177
+
"build": "Roku Testing",
178
+
"app": "APP_URL", # Enter app url here
179
+
"network": False,
180
+
"devicelog": True,
181
+
"privateCloud": True,
182
+
"visual": True,
183
+
"idleTimeout": 1800,
184
+
}
185
+
return desired_caps
183
186
184
-
web_driver.quiet()
185
-
print("Test passed")
186
-
exceptExceptionas e:
187
-
print(f"Error: {e}")
188
-
print("Test failed")
189
-
190
-
if__name__=="__main__":
191
187
188
+
defrunTest():
192
189
if os.environ.get("LT_USERNAME") isNone:
193
-
# Enter LT username here if environment variables have not been added
194
-
username ="username"
190
+
# Enter LT username below if environment variables have not been added
191
+
username ="<YOUR_LT_USERNAME>"
195
192
else:
196
193
username = os.environ.get("LT_USERNAME")
194
+
197
195
if os.environ.get("LT_ACCESS_KEY") isNone:
198
-
# Enter LT accesskey here if environment variables have not been added
199
-
accessToken="accessToken"
196
+
# Enter LT accesskey below if environment variables have not been added
|\*deviceName | TYPE: STRING <br/> `iPhone 13`| Name of the device. |
282
-
| isRealDevice | TYPE: BOOLEAN <br/> DEFAULT: TRUE <br/> `video=TRUE` <br/> OR <br/> `video=FALSE`| It makes sure that the device being allocated is a Real device. |
283
-
|\*platformName | TYPE: STRING <br/> `ios`| Name of the OS. |
284
-
|\*platformVersion | TYPE: STRING <br/> `14`| OS version. |
285
-
| build | TYPE: STRING <br/> DEFAULT: Untitled <br/> `build=iOS Small Run`| You can group your tests like a job containing multiple tests. |
286
-
|\*app | TYPE: STRING <br/> `app=lt://APP100201061631704657918380`| Accepts App URL returned after uploading an app on the LambdaTest servers. ||
287
-
| visual | TYPE: BOOLEAN <br/> DEFAULT: FALSE <br/> `visual=TRUE` <br/> OR <br/> `visual=FALSE`| Command by command screenshots will be recorded at each test step. By default the flag is set as off. Note: test execution time will increase if it’s set as ‘true’. |
288
-
| video | TYPE: BOOLEAN <br/> DEFAULT: TRUE <br/> `video=TRUE` <br/> OR <br/> `video=FALSE`| Video recording of the complete screen. |
| automationName | TYPE: STRING <br/> `roku`| Tells Appium to use the Roku Appium Driver. |
294
+
|*deviceName | TYPE: STRING <br/> `Roku Ultra`| Name of the device. |
295
+
| isRealDevice | TYPE: BOOLEAN <br/> DEFAULT: TRUE <br/> `video=TRUE` <br/> OR <br/> `video=FALSE`| It makes sure that the device being allocated is a Real device. |
296
+
|*platformName | TYPE: STRING <br/> `roku`| Name of the OS. |
297
+
|*platformVersion | TYPE: STRING <br/> `11`| OS version. |
298
+
| build | TYPE: STRING <br/> DEFAULT: Untitled <br/> `build=iOS Small Run`| You can group your tests like a job containing multiple tests. |
299
+
|*app | TYPE: STRING <br/> `app=lt://APP100201061631704657918380`| Accepts App URL returned after uploading an app on the LambdaTest servers. |
300
+
| visual | TYPE: BOOLEAN <br/> DEFAULT: FALSE <br/> `visual=TRUE` <br/> OR <br/> `visual=FALSE`| Command by command screenshots will be recorded at each test step. By default off. |
301
+
| video | TYPE: BOOLEAN <br/> DEFAULT: TRUE <br/> `video=TRUE` <br/> OR <br/> `video=FALSE`| Video recording of the complete screen. |
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).
0 commit comments