-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
executable file
·74 lines (61 loc) · 2.37 KB
/
conftest.py
File metadata and controls
executable file
·74 lines (61 loc) · 2.37 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
import json
import pytest
import time
import zulu
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
from pages.BasePage import LOGGER
@pytest.fixture(scope="function", autouse=True)
def browser():
# BEFORE ALL
pytest.captcha_response_array.clear()
attempted_at = zulu.now()
start_time = time.time()
chrome_options = Options()
# chrome_options.add_argument('--headless')
chrome_options.add_argument('--window-size=1920,1080')
chrome_options.add_argument('disable-notifications')
chrome_options.add_argument('disable-infobars')
driver = webdriver.Chrome(ChromeDriverManager().install(), options=chrome_options)
yield driver
# AFTER ALL
LOGGER.info("Closing driver")
driver.close()
LOGGER.info("Quitting driver")
driver.quit()
end_time = time.time()
duration = (start_time - end_time)
LOGGER.info("EXECUTION TIME: %.2f seconds", duration)
completed_at = zulu.now()
pytest.response_data_object['attemptAt'] = str(attempted_at)
pytest.response_data_object['completedAt'] = str(completed_at)
def pytest_configure():
pytest.response_data_array = []
pytest.response_data_object = {}
pytest.captcha_response_array = []
pytest.captcha_response_object = {}
pytest.errors_response_array = []
pytest.errors_response_object = {}
pytest.captcha_response_array.clear()
pytest.response_data_object['UUID'] = None
pytest.response_data_object['submitSuccess'] = None
pytest.response_data_object['attemptAt'] = None
pytest.response_data_object['completedAt'] = None
pytest.response_data_object['attempts'] = None
pytest.response_data_object['captcha'] = None
pytest.response_data_object['responseMessage'] = None
pytest.response_data_object['errors'] = None
def pytest_addoption(parser):
parser.addoption('--user_json_path', default='', action='store', help='path to user json')
parser.addoption('--person_data', action='store', default='')
@pytest.fixture()
def user_json_path(request):
user_json_path_value = request.config.getoption("--user_json_path")
if user_json_path_value is None:
pytest.skip()
return user_json_path_value
@pytest.fixture()
def person_data(request):
person_data_value = request.config.getoption("--person_data")
return person_data_value