-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconftest.py
75 lines (57 loc) · 1.73 KB
/
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
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
from playwright.sync_api import (
Browser,
Page,
PlaywrightContextManager,
sync_playwright
)
import pytest
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
@pytest.fixture
def client_email() -> str:
return "[email protected]"
@pytest.fixture
def client_password() -> str:
return "Certn@123"
@pytest.fixture
def client_portal_login_url() -> str:
return "https://client.development.certn.co/"
#############################
# Selenium fixtures #
#############################
@pytest.fixture(scope="session")
def installed_driver_path() -> str:
return ChromeDriverManager().install()
@pytest.fixture
def selenium_webdriver_with_chrome(
installed_driver_path: str,
client_portal_login_url: str
) -> webdriver.Remote:
local_service = webdriver.chrome.service.Service(installed_driver_path)
driver = webdriver.Chrome(service=local_service)
driver.get(client_portal_login_url)
yield driver
driver.quit()
#############################
# End of Selenium fixtures #
#############################
#################################
# Playwright fixtures #
#################################
@pytest.fixture
def playwright():
playwright = sync_playwright().start()
yield playwright
playwright.stop()
@pytest.fixture
def playwright_chrome_browser(
playwright: PlaywrightContextManager,
client_portal_login_url: str
) -> Page:
browser: Browser = playwright.chromium.launch(headless=False)
playwright_page = browser.new_page()
playwright_page.goto(client_portal_login_url)
return playwright_page
#################################
# End of Playwright fixtures #
#################################