-
Notifications
You must be signed in to change notification settings - Fork 0
/
desired_capabilities.py
45 lines (35 loc) · 1.04 KB
/
desired_capabilities.py
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
import os
import logging
import subprocess
from random import randint
def get_desired_capabilities(app):
desired_caps = {
'platformName': 'Android',
'platformVersion': '5.1.1',
'deviceName': 'Galaxy J2',
'browserName': '',
'autoWebview': True,
'autoGrantPermissions': True,
'resetKeyboard': True,
'noReset': True,
'newCommandTimeout': 240,
'app': os.path.abspath('/Users/ashishtiwari/Workspace/zaya/apks/' + app),
}
return desired_caps
##################
# CONSTANTS
##################
CONTEXT_NAME = "WEBVIEW"
SLEEP_LONG = 20
SLEEP_SHORT = 10
SLEEP_QUICK = 3
RANDOM_START = 1
CRED = '\033[91m'
CEND = '\033[0m'
def check_device_availability():
command = subprocess.getoutput("adb devices")
if len(command.split()) == 4 or "offline" in command:
print (CRED + "Oops! There is no android device available for testing.\nWe can not proceed ahead." + CEND)
exit()
def random_numbers(RANDOM_END):
return randint(RANDOM_START, RANDOM_END)