-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
54 lines (41 loc) · 1.39 KB
/
conftest.py
File metadata and controls
54 lines (41 loc) · 1.39 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
import logging
import allure
import pytest
import requests
from selene import browser
from selenium.webdriver.chrome.options import Options
from helpers.data.links import Links
from helpers.data.user import User
from utils import allure_attachments
@pytest.fixture(
scope="function",
autouse=True
)
def browser_configurate():
chrome_options = Options()
chrome_options.page_load_strategy = 'eager'
chrome_options.add_argument("--window-size=1920,1080")
browser.config.driver_options = chrome_options
yield
allure_attachments.add_screenshot(browser=browser)
allure_attachments.add_logs(browser=browser)
allure_attachments.add_html(browser=browser)
allure_attachments.add_video(browser=browser)
browser.quit()
@pytest.fixture(scope="session")
def api_auth_session():
session = requests.Session()
with allure.step("Send request POST for login with credentials"):
response = session.post(
url=Links.LOGIN_PAGE,
data={
"Email": User.USER_LOGIN,
"Password": User.USER_PASSWORD
},
allow_redirects=False
)
logging.info(f"Status code: {response.status_code}")
logging.info(f"Session cookies: {session.cookies.get_dict()}")
assert response.status_code == 302
assert "NOPCOMMERCE.AUTH" in session.cookies.get_dict()
yield session