Skip to content

Commit b3e3484

Browse files
committedSep 23, 2024·
add chrome tests
1 parent 33df34e commit b3e3484

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
 

‎py/test/selenium/webdriver/chrome/chrome_service_tests.py

+24
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,27 @@ def test_log_output_null_default(driver, capfd) -> None:
9595
out, err = capfd.readouterr()
9696
assert "Starting ChromeDriver" not in out
9797
driver.quit()
98+
99+
@pytest.fixture
100+
def service():
101+
return Service()
102+
103+
@pytest.mark.usefixtures("service")
104+
class TestChromeDriverService:
105+
service_path = "/path/to/chromedriver"
106+
107+
@pytest.fixture(autouse=True)
108+
def setup_and_teardown(self):
109+
os.environ['SE_CHROMEDRIVER'] = self.service_path
110+
yield
111+
os.environ.pop('SE_CHROMEDRIVER', None)
112+
113+
def test_uses_path_from_env_variable(self, service):
114+
assert 'chromedriver' in service.path
115+
116+
def test_updates_path_after_setting_env_variable(self, service):
117+
new_path = "/foo/bar"
118+
os.environ['SE_CHROMEDRIVER'] = new_path
119+
service.executable_path = self.service_path # Simulating the update
120+
121+
assert 'chromedriver' in service.executable_path

0 commit comments

Comments
 (0)