Skip to content

Commit

Permalink
tests: Try to stabilize Edge tests (#1305)
Browse files Browse the repository at this point in the history
- Ensure disable-dev-shm-usage is set for chromium
- Retry failing tests
  • Loading branch information
jsfehler authored Jun 24, 2024
1 parent e2889a0 commit 57a39bd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ jobs:

- name: Run tests for windows-only drivers
run: |
tox -e tests_selenium_edge -- -n 4;
tox -e tests_selenium_edge -- --cache-clear -n 4 || tox -e tests_selenium_edge -- -n 1 --last-failed --last-failed-no-failures none
tox -e tests_selenium_edge -- --cache-clear --webdriver-fullscreen True -n 4 || tox -e tests_selenium_edge -- --webdriver-fullscreen True -n 1 --last-failed --last-failed-no-failures none
24 changes: 16 additions & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,23 +130,35 @@ def browser_config(request):
def browser_kwargs(request):
option = request.config.option

kwargs = {}

if option.webdriver_remote_name:
return {"browser": request.config.option.webdriver_remote_name}
kwargs = {"browser": request.config.option.webdriver_remote_name}

if option.browser_name == "flask":
from tests.fake_webapp import app

return {"app": app, "wait_time": 0.1}
kwargs = {"app": app, "wait_time": 0.1}

if option.browser_name == "django":
components = parse.urlparse("http://127.0.0.1:5000/")
return {
kwargs = {
"wait_time": 0.1,
"client_SERVER_NAME": components.hostname,
"client_SERVER_PORT": components.port,
}

return {}
wd_options = None
if (browser_name == "chrome") or (option.webdriver_remote_name == "chrome"):
wd_options = webdriver.chrome.options.Options()
wd_options.add_argument("--disable-dev-shm-usage")
kwargs["options"] = wd_options
elif browser_name == "edge" or (option.webdriver_remote_name == "edge"):
wd_options = webdriver.edge.options.Options()
wd_options.add_argument("--disable-dev-shm-usage")
kwargs["options"] = wd_options

return kwargs


@pytest.fixture(scope="function")
Expand All @@ -158,10 +170,6 @@ def browser(browser_name, browser_config, browser_kwargs, request):
if browser_name in ["chrome", "firefox", "edge"]:
b.driver.set_window_size(1024, 768)

if browser_name == "chrome":
options = webdriver.chrome.options.Options()
options.add_argument("--disable-dev-shm-usage")

return b


Expand Down
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ passenv =
EDGEWEBDRIVER
commands =
pytest --ignore-flaky {posargs} --browser=edge tests/test_all_drivers tests/tests_webdriver tests/tests_webdriver_local
pytest --ignore-flaky {posargs} --browser=edge --webdriver-fullscreen True tests/test_all_drivers tests/tests_webdriver tests/tests_webdriver_local

[testenv:tests_selenium_remote_chrome]
extras = selenium
Expand Down

0 comments on commit 57a39bd

Please sign in to comment.