-
Notifications
You must be signed in to change notification settings - Fork 8
/
Android.js
60 lines (49 loc) · 1.3 KB
/
Android.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
var wd = require("wd")
var assert = require("assert");
var asserter = wd.asserters;
username = (process.env.LT_USERNAME == undefined) ? "username" //Enter the username here
: process.env.LT_USERNAME
accesskey = (process.env.LT_ACCESS_KEY == undefined) ? "access_key" //Enter the access_key here
: process.env.LT_ACCESS_KEY
desired_capabilities = {
'deviceName':'Galaxy S20',
'platformVersion':'11',
'platformName':'android',
'isRealMobile':true,
'app':'lt://', //Enter the app_url here
'visual':true,
'video': true,
//GRANT PERMISSIONS FOR ANDROID
'autoGrantPermissions': true,
}
driver = wd.promiseRemote(`https://${username}:${accesskey}@mobile-hub.lambdatest.com/wd/hub`)
async function Androidtest(){
try {
driver.init(desired_capabilities)
.then(function(){
return driver.waitForElementById('color',10000)
})
.then(function(colorButton){
return colorButton.click();
})
.then(function(){
return driver.waitForElementById('Text',10000)
})
.then(function(text){
text.click()
return driver.waitForElementById('toast',10000)
})
.then(function(toast){
toast.click()
return driver.waitForElementById('notification',10000)
})
.then(function(find){
find.click()
driver.quit()
})
}
catch (e) {
driver.quit()
}
}
Androidtest();