Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Try to stabilize Edge tests #1305

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading