-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
54 lines (43 loc) · 1.54 KB
/
Copy pathconftest.py
File metadata and controls
54 lines (43 loc) · 1.54 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 pytest
from selenium.webdriver.chrome.options import Options
from core.base_test import CustomRemoteWebDriver
def pytest_addoption(parser):
parser.addoption(
"--visual",
action="store_true",
default=False,
help="Run tests in visual mode (disable headless)"
)
@pytest.fixture
def visual_mode(request):
return request.config.getoption("--visual")
@pytest.fixture(autouse=True, scope="class")
def setup_driver(request):
# Address of Selenium Grid or local standalone container
selenium_grid_url = "http://localhost:4444/wd/hub"
# Chrome options for CI
options = Options()
# Check for --visual flag
visual_mode = request.config.getoption("--visual", default=False)
if visual_mode:
print("🖥️ Running in VISUAL mode - check VNC at http://localhost:7900 (password: secret)")
else:
options.add_argument("--headless") # run without GUI
options.add_argument("--window-size=1920,1080")
options.add_argument("--no-sandbox")
options.add_argument("--disable-dev-shm-usage")
# Enable logging
options.set_capability('goog:loggingPrefs', {
'browser': 'ALL',
'performance': 'ALL'
})
# Create custom remote WebDriver connection with logging support
driver = CustomRemoteWebDriver(
command_executor=selenium_grid_url,
options=options
)
# Attach driver to the test class (so we can use self.driver)
request.cls.driver = driver
yield
# Close the browser when tests are done
driver.quit()