forked from dtmilano/AndroidViewClient
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsoptify.py
More file actions
executable file
·76 lines (61 loc) · 4.76 KB
/
soptify.py
File metadata and controls
executable file
·76 lines (61 loc) · 4.76 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#! /usr/bin/env python
# -*- coding: utf-8 -*-
'''
Copyright (C) 2013-2018 Diego Torres Milano
Created on 2018-01-30 by CulebraTester
__ __ __ __
/ \ / \ / \ / \
____________________/ __\/ __\/ __\/ __\_____________________________
___________________/ /__/ /__/ /__/ /________________________________
| / \ / \ / \ / \ \___
|/ \_/ \_/ \_/ \ o \
\_____/--<
@author: Diego Torres Milano
@author: Jennifer E. Swofford (ascii art snake)
'''
#
# This example was created as a response to https://github.com/dtmilano/AndroidViewClient/issues/238
# It was automatically created by CulebraTester (http://culebra.dtmilano.com/) just interacting
# with the device under test and playing on Spotify and selecting "Connect to a device".
#
import os
import sys
try:
sys.path.insert(0, os.path.join(os.environ['ANDROID_VIEW_CLIENT_HOME'], 'src'))
except:
pass
import pkg_resources
pkg_resources.require('androidviewclient>=12.4.0')
from com.dtmilano.android.viewclient import CulebraTestCase
from com.dtmilano.android.uiautomator.uiautomatorhelper import UiScrollable
TAG = 'CULEBRA'
class CulebraTests(CulebraTestCase):
@classmethod
def setUpClass(cls):
cls.kwargs1 = {'ignoreversioncheck': False, 'verbose': False, 'ignoresecuredevice': False}
cls.kwargs2 = {'forceviewserveruse': False, 'useuiautomatorhelper': True, 'ignoreuiautomatorkilled': True, 'autodump': False, 'startviewserver': True, 'compresseddump': True}
cls.options = {'start-activity': None, 'concertina': False, 'device-art': None, 'use-jar': False, 'multi-device': False, 'unit-test-class': True, 'save-screenshot': None, 'use-dictionary': False, 'glare': False, 'dictionary-keys-from': 'id', 'scale': 1, 'find-views-with-content-description': True, 'window': -1, 'orientation-locked': None, 'save-view-screenshots': None, 'find-views-by-id': True, 'log-actions': False, 'use-regexps': False, 'null-back-end': False, 'auto-regexps': None, 'do-not-verify-screen-dump': True, 'verbose-comments': False, 'gui': False, 'find-views-with-text': True, 'prepend-to-sys-path': False, 'install-apk': None, 'drop-shadow': False, 'output': None, 'unit-test-method': None, 'interactive': False}
cls.sleep = 5
def setUp(self):
super(CulebraTests, self).setUp()
def tearDown(self):
super(CulebraTests, self).tearDown()
def preconditions(self):
if not super(CulebraTests, self).preconditions():
return False
return True
def testSomething(self):
if not self.preconditions():
self.fail('Preconditions failed')
_s = CulebraTests.sleep
_v = CulebraTests.verbose
UiScrollable(self.vc.uiAutomatorHelper, uiSelector='[email protected],[email protected]:id/workspace,index@0,parentIndex@0,[email protected]').getChildByDescription(uiSelector='desc@Spotify', description="Spotify", allowScrollSearch=True).click()
self.vc.uiAutomatorHelper.findObject(bySelector='[email protected]:id/home_tab,desc@Home,[email protected],text@Home,[email protected]').clickAndWait(eventCondition='until:newWindow', timeout=_s*1000)
self.vc.uiAutomatorHelper.findObject(bySelector='[email protected]:id/playPause,desc@Play,[email protected],text@$,[email protected]').clickAndWait(eventCondition='until:newWindow', timeout=_s*1000)
self.vc.uiAutomatorHelper.findObject(bySelector='[email protected]:id/player_navigation_unit_container,desc@Show Now Playing,[email protected],text@$,[email protected]').clickAndWait(eventCondition='until:newWindow', timeout=_s*1000)
self.vc.uiAutomatorHelper.findObject(bySelector='[email protected]:id/btn_play,desc@Pause,[email protected],text@$,[email protected]').clickAndWait(eventCondition='until:newWindow', timeout=_s*1000)
self.vc.uiAutomatorHelper.findObject(bySelector='[email protected]:id/btn_play,desc@Play,[email protected],text@$,[email protected]').clickAndWait(eventCondition='until:newWindow', timeout=_s*1000)
self.vc.uiAutomatorHelper.findObject(bySelector='[email protected]:id/btn_play,desc@Pause,[email protected],text@$,[email protected]').clickAndWait(eventCondition='until:newWindow', timeout=_s*1000)
self.vc.uiAutomatorHelper.findObject(bySelector='[email protected]:id/connect_view_root,[email protected],text@$,[email protected]').clickAndWait(eventCondition='until:newWindow', timeout=_s*1000)
if __name__ == '__main__':
CulebraTests.main()