-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.py
83 lines (83 loc) · 2.53 KB
/
main.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
72
73
74
75
76
77
78
79
80
81
82
83
# # Create a custom test suite
# import pytest
# from selenium import webdriver
# import os
#
# from config import DIR_PATH
# # from script import test_registration
# # from script import test_login
#
#
# from selenium.webdriver.chrome.options import Options
# from selenium.webdriver.chrome.service import Service
# from webdriver_manager.chrome import ChromeDriverManager
#
# from utils.save_register import clear_all_files
#
#
# def setup_environment():
# """清理测试环境准备新的测试周期。"""
# clear_all_files(os.path.join(DIR_PATH, 'accounts'))
#
# # def get_headless_chrome_driver():
# # # chrome_options = Options()
# # # chrome_options.add_argument("--headless") # Enable headless mode
# # # chrome_options.add_argument("--no-sandbox") # Bypassing the operating system security model
# # # chrome_options.add_argument("--enable-logging")
# # # chrome_options.add_argument("--v=1")
# # # chrome_options.add_argument("--disable-dev-shm-usage") # Avoid sharing memory
# # # driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=chrome_options)
# # driver = webdriver.Chrome() # Locally
# # driver.implicitly_wait(10)
# # return driver
#
# # class TestRegistration:
# # @pytest.fixture
# # def driver(self):
# # driver = get_headless_chrome_driver()
# # driver.implicitly_wait(10)
# # yield driver
# # # Code to execute after the test is completed.
# # driver.quit()
# #
# # @pytest.mark.parametrize("case", test_registration.test_data)
# # def test_registration(self, driver, case):
# # print('数据',case)
# # test_registration.test_register(driver, case)
# #
#
# # class TestLogin:
# # @pytest.fixture
# # def driver(self):
# # driver = get_headless_chrome_driver()
# # driver.implicitly_wait(10)
# # yield driver
# # driver.quit()
# #
# # def test_login(self,driver):
# # # Call the test_logins method
# # test_login.test_loginss(driver)
# #
#
#
#
# # def custom_test_suite():
# # # Create an empty test suite
# # suite = pytest.TestSuite()
# # suite.addTest(TestRegistration())
# # suite.addTest(TestLogin())
# # return suite
#
# # Run the test suite
# # if __name__ == '__main__':
# # setup_environment()
# # runner = pytest.TextTestRunner()
# # runner.run(custom_test_suite())
#
# def run_tests():
# pytest.main(['-v', '-s', 'script'])
#
#
# if __name__ == '__main__':
# setup_environment()
# run_tests()