-
Notifications
You must be signed in to change notification settings - Fork 264
/
test_orientation_commands.py
66 lines (52 loc) · 1.9 KB
/
test_orientation_commands.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
'''
WDA Orientation Command Testing
source code here: https://github.com/appium/WebDriverAgent/blob/master/WebDriverAgentLib/Commands/FBOrientationCommands.m
WDA API document and example(not offical): https://documenter.getpostman.com/view/1837823/TVmMhJNB#1ca27827-9931-4315-a6aa-141b6015ac04
'''
import os
import time
import pytest
import unittest
from typing import List
from collections.abc import Iterable
import wda
from .constant import *
curPath = os.path.abspath(os.path.dirname(__file__))
class TestOrientation(unittest.TestCase):
def setUp(self):
self.under_test_bundle_id = UNDER_TEST_BUNDLE_ID
self.wda_client: wda.Client = wda.Client()
self.app = self.wda_client.session(bundle_id=self.under_test_bundle_id)
self.temp_file_pic = os.path.join(curPath, 'temp_file_pic.png')
def tearDown(self):
self.app.orientation = wda.PORTRAIT
self.wda_client.close()
[os.remove(temp_file) for temp_file in [self.temp_file_pic] if os.path.exists(temp_file)]
'''
Method: GET
Endpoint: {{baseURL}}/session/{{sessionId}}/orientation
'''
def test_orientation(self):
assert self.app.orientation in ['PORTRAIT', 'LANDSCAPE']
'''
Method: POST
Endpoint: {{baseURL}}/session/{{sessionId}}/orientation
'''
def test_set_orientation(self):
self.app.orientation = wda.LANDSCAPE
time.sleep(1)
assert self.app.orientation == 'LANDSCAPE'
'''
Method: GET
Endpoint: {{baseURL}}/session/{{sessionId}}/rotation
'''
@pytest.mark.skip('NOT IMPLEMENTED: [GET] {{baseURL}}/session/{{sessionId}}/rotation')
def test_get_rotation(self):
pass
'''
Method: POST
Endpoint: {{baseURL}}/session/{{sessionId}}/rotation
'''
@pytest.mark.skip('NOT IMPLEMENTED: [POST] {{baseURL}}/session/{{sessionId}}/rotation')
def test_set_rotation(self):
pass