Всякий раз, когда я пытаюсь запустить pytest test_clientLogin.py
, это приводит к сбору 0 элементов, и тесты не запускаются, несмотря на то, что мой модуль и метод соответствуют стандарту именования Pytest, насколько я знаю.Я что-то здесь упускаю?
import unittest
import os
from random import randint
from appium import webdriver
from time import sleep
from selenium.webdriver.common.keys import Keys
class Test_ClientLogin(unittest.TestCase):
def setUp(self):
app = ('/Users/myName/Library/Developer/Xcode/DerivedData/appName-adbzyybfvvcneaboeastjqennmqn/Build/Products/Debug-iphonesimulator/appName.app')
self.driver = webdriver.Remote(
command_executor='http://127.0.0.1:4723/wd/hub',
desired_capabilities={
'app': app,
'platformName': 'iOS',
'platformVersion': '12.1',
'deviceName': 'iPhone 8'
}
)
def test_emailField(self):
el1 = driver.find_element_by_xpath("//XCUIElementTypeApplication[@name=\"appName\"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTextField")
el1.send_keys("myEmail@gmail.com")
sleep(1)
self.assertNotEqual(el1.get_attribute("value"), "myEmail@gmail.com")
def test_passwordField(self):
el2 = driver.find_element_by_xpath("//XCUIElementTypeApplication[@name=\"appName\"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeSecureTextField")
el2.send_keys("myPassword")
sleep(1)
self.assertNotEqual(el2.get_attribute("value"), "myPassword")
def test_login(self):
self.test_emailField()
self.test_passwordField()
el3 = driver.find_element_by_accessibility_id("Log In")
el3.click()
sleep(1)
smiley = driver.find_element_by_xpath("""//XCUIElementTypeNavigationBar[@name="Journal"]""")
self.assertNotEqual(smiley.get_attribute("name"), "Journal")
def tearDown(self):
self.driver.quit()
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(Test_ClientLogin)
unittest.TextTestRunner(verbosity=2).run(suite)`