-
Notifications
You must be signed in to change notification settings - Fork 0
/
conftest.py
43 lines (34 loc) · 894 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import pytest
from utils.webdriver_factory import browser_driver
from utils.configuration import URL
@pytest.fixture()
def driver_fixture(scope="function"):
"""
scope="function" is the default one, which means each
test_* will have a fresh new instance of driver
"""
driver = browser_driver()
driver.get(URL)
yield driver
driver.close()
@pytest.fixture()
def some_global_resource(scope="session"):
"""
whole test session will share this.
"""
res = "something"
return res
@pytest.fixture()
def some_module_resource(scope="module"):
"""
all the tests in one module will share one same instance of this
"""
res = "something"
return res
@pytest.fixture()
def some_class_resource(scope="class"):
"""
all the tests in one class will share one same instance of this
"""
res = "something"
return res