-
Notifications
You must be signed in to change notification settings - Fork 0
/
conftest.py
25 lines (18 loc) · 876 Bytes
/
conftest.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
import pytest
from application import Application
@pytest.fixture(scope="session") # Run all tests in one session
def app(request): # Fixture for Selenium Web driver
global fixture
browser = request.config.getoption("--browser")
project = request.config.getoption("--project")
fixture = Application(browser, project)
def fin():
fixture.destroy() # function for destroy Selenium fixture
request.addfinalizer(fin)
return fixture
def pytest_addoption(parser): # hooks for browsers, by default = Chrome
parser.addoption("--browser", action="store", default="chrome")
parser.addoption("--project", action="store", default="99papers")
def pytest_report_header(config): # invitation in console before test run is "On"
if config.getoption("verbose") > 0:
return ["Automation tests is start"]