-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtest_ios.py
72 lines (56 loc) · 2.47 KB
/
test_ios.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
66
67
68
69
70
71
import pytest
import unittest
from appium import webdriver
from time import sleep
from appium.webdriver.common.touch_action import TouchAction
from selenium.webdriver.support.wait import WebDriverWait
class TestIOS(unittest.TestCase):
loaded = False
def setUp(self):
pass
def test_uicatalog_sim(self):
print("setup")
caps = {}
caps["platformName"] = "ios"
caps["platformVersion"] = "12.1"
caps["deviceName"] = "iPhone X"
caps["app"] = '/Users/seveniruby/Library/Developer/Xcode/DerivedData/UICatalog-ftyzdbgapjmxxobezrnrxsshpdqh/' \
'Build/Products/Debug-iphonesimulator/UICatalog.app'
if TestIOS.loaded == True:
caps["noReset"] = "true"
self.driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)
self.driver.implicitly_wait(10)
loaded = True
print(self.driver.page_source)
self.driver.find_element_by_id("Buttons").click()
self.driver.back()
self.driver.find_element_by_accessibility_id("Buttons").click()
def test_uicatalog_real_by_url(self):
caps = {}
caps["platformName"] = "ios"
caps["automationName"] = "xcuitest"
caps["deviceName"] = "Uzumaki的iPhone"
caps["udid"]="auto"
caps["app"] = '/Users/seveniruby/Library/Developer/Xcode/DerivedData/UICatalog-dfavfehsvaabuqdpmxouzqphclvl/' \
'Build/Products/Debug-iphoneos/UICatalog.app'
caps["xcodeOrgId"]="96NJEQL7Y2"
caps["xcodeSigningId"]="iPhone Developer"
caps["webDriverAgentUrl"]="http://192.168.0.102:8100"
self.driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)
self.driver.implicitly_wait(10)
print(self.driver.page_source)
def test_uicatalog_real(self):
caps = {}
caps["platformName"] = "ios"
caps["automationName"] = "xcuitest"
caps["deviceName"] = "Uzumaki的iPhone"
caps["udid"]="auto"
caps["app"] = '/Users/seveniruby/Library/Developer/Xcode/DerivedData/UICatalog-dfavfehsvaabuqdpmxouzqphclvl/' \
'Build/Products/Debug-iphoneos/UICatalog.app'
caps["xcodeOrgId"]="96NJEQL7Y2"
caps["xcodeSigningId"]="iPhone Developer"
#加速,绕过构建
caps["usePrebuiltWDA"]="true"
self.driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)
self.driver.implicitly_wait(10)
print(self.driver.page_source)