|
4 | 4 | import pytest
|
5 | 5 | from podman import PodmanClient
|
6 | 6 | from selenium import webdriver
|
7 |
| -from selenium.webdriver.common.desired_capabilities import DesiredCapabilities |
8 | 7 | from wait_for import wait_for
|
9 | 8 |
|
10 | 9 | from widgetastic.browser import Browser
|
11 | 10 |
|
12 | 11 |
|
13 |
| -# Begging, borrowing, and stealing from @quarkster |
14 |
| -# https://github.com/RedHatQE/widgetastic.patternfly4/blob/master/testing/conftest.py#L21 |
| 12 | +OPTIONS = {"firefox": webdriver.FirefoxOptions(), "chrome": webdriver.ChromeOptions()} |
15 | 13 |
|
16 | 14 |
|
17 | 15 | def pytest_addoption(parser):
|
@@ -53,13 +51,13 @@ def browser_name(pytestconfig):
|
53 | 51 |
|
54 | 52 |
|
55 | 53 | @pytest.fixture(scope="session")
|
56 |
| -def selenium_url(pytestconfig, worker_id, podman, pod): |
| 54 | +def selenium_url(worker_id, podman, pod): |
57 | 55 | """Yields a command executor URL for selenium, and a port mapped for the test page to run on"""
|
58 | 56 | # use the worker id number from gw# to create hosts on loopback
|
59 | 57 | last_oktet = 1 if worker_id == "master" else int(worker_id.lstrip("gw")) + 1
|
60 | 58 | localhost_for_worker = f"127.0.0.{last_oktet}"
|
61 | 59 | container = podman.containers.create(
|
62 |
| - image="quay.io/redhatqe/selenium-standalone:latest", |
| 60 | + image="quay.io/redhatqe/selenium-standalone:ff_91.8.0esr_chrome_101.0.4951.41", |
63 | 61 | pod=pod.id,
|
64 | 62 | remove=True,
|
65 | 63 | name=f"selenium_{worker_id}",
|
@@ -92,14 +90,7 @@ def testing_page_url(worker_id, podman, pod):
|
92 | 90 | @pytest.fixture(scope="session")
|
93 | 91 | def selenium_webdriver(browser_name, selenium_url, testing_page_url):
|
94 | 92 | wait_for(urlopen, func_args=[selenium_url], timeout=180, handle_exception=True)
|
95 |
| - if browser_name == "firefox": |
96 |
| - desired_capabilities = DesiredCapabilities.FIREFOX.copy() |
97 |
| - else: |
98 |
| - desired_capabilities = DesiredCapabilities.CHROME.copy() |
99 |
| - desired_capabilities["chromeOptions"] = {"args": ["--no-sandbox"]} |
100 |
| - driver = webdriver.Remote( |
101 |
| - command_executor=selenium_url, desired_capabilities=desired_capabilities |
102 |
| - ) |
| 93 | + driver = webdriver.Remote(command_executor=selenium_url, options=OPTIONS[browser_name.lower()]) |
103 | 94 | driver.maximize_window()
|
104 | 95 | driver.get(testing_page_url)
|
105 | 96 | yield driver
|
|
0 commit comments