mirror of
https://github.com/tcsenpai/Zundler.git
synced 2025-06-06 11:35:40 +00:00
Use selenium fixture for all browsers
This commit is contained in:
parent
763c120413
commit
0fa98c1a51
@ -38,22 +38,26 @@ def is_responsive(port):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
@pytest.fixture(scope="session")
|
||||||
def selenium_service(docker_ip, docker_services):
|
def selenium_drivers(docker_ip, docker_services):
|
||||||
# `port_for` takes a container port and returns the corresponding host port
|
# `port_for` takes a container port and returns the corresponding host port
|
||||||
port = docker_services.port_for("firefox", 5900)
|
drivers = {}
|
||||||
docker_services.wait_until_responsive(
|
|
||||||
timeout=30.0, pause=0.1, check=lambda: is_responsive(port)
|
|
||||||
)
|
|
||||||
|
|
||||||
options = webdriver.FirefoxOptions()
|
for browser in ["firefox"]:
|
||||||
driver = webdriver.Remote(
|
port = docker_services.port_for(browser, 5900)
|
||||||
command_executor='http://localhost:4444/wd/hub',
|
docker_services.wait_until_responsive(
|
||||||
options=options,
|
timeout=30.0, pause=0.1, check=lambda: is_responsive(port)
|
||||||
)
|
)
|
||||||
|
|
||||||
yield driver
|
options = webdriver.FirefoxOptions()
|
||||||
|
drivers[browser] = webdriver.Remote(
|
||||||
|
command_executor=f'http://localhost:4444/wd/hub',
|
||||||
|
options=options,
|
||||||
|
)
|
||||||
|
|
||||||
driver.quit()
|
yield drivers
|
||||||
|
|
||||||
|
for browser, driver in drivers.items():
|
||||||
|
driver.quit()
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user