Skip to content

Commit

Permalink
tests: use flaky to manage the flaky tests
Browse files Browse the repository at this point in the history
Also mark all tests for mouse operations as flaky.
  • Loading branch information
fsouza committed Nov 11, 2023
1 parent c815ec6 commit e8343a1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Flask==3.0.0
flaky==3.7.0
coverage==7.3.2
argparse
Django>=2.0.6
Expand Down
1 change: 1 addition & 0 deletions requirements/test_windows.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Flask==3.0.0
flaky==3.7.0
coverage==7.3.2
argparse
pytest==7.4.3
Expand Down
6 changes: 6 additions & 0 deletions tests/test_mouse_interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from .fake_webapp import EXAMPLE_APP


@pytest.mark.flaky
@pytest.mark.parametrize("browser_name", supported_browsers)
def test_mouse_over(browser_name, get_new_browser):
"Should be able to perform a mouse over on an element"
Expand All @@ -27,6 +28,7 @@ def test_mouse_over(browser_name, get_new_browser):
assert browser.is_element_not_present_by_id("what-is-your-name", wait_time=10)


@pytest.mark.flaky
@pytest.mark.parametrize("browser_name", supported_browsers)
def test_mouse_out(browser_name, get_new_browser):
"Should be able to perform a mouse out on an element"
Expand All @@ -40,6 +42,7 @@ def test_mouse_out(browser_name, get_new_browser):
assert browser.is_element_not_present_by_id("what-is-your-name", wait_time=10)


@pytest.mark.flaky
@pytest.mark.parametrize("browser_name", supported_browsers)
def test_mouse_out_top_left(browser_name, get_new_browser):
"""Should be able to perform a mouse out on an element,
Expand All @@ -55,6 +58,7 @@ def test_mouse_out_top_left(browser_name, get_new_browser):
assert browser.is_element_not_present_by_id("what-is-your-name", wait_time=10)


@pytest.mark.flaky
@pytest.mark.parametrize("browser_name", supported_browsers)
def test_double_click(browser_name, get_new_browser):
"""Test: WebDriverElement.double_click()
Expand All @@ -77,6 +81,7 @@ def test_double_click(browser_name, get_new_browser):
assert browser.is_element_not_present_by_id("what-is-your-name", wait_time=20)


@pytest.mark.flaky
@pytest.mark.parametrize("browser_name", supported_browsers)
def test_right_click(browser_name, get_new_browser):
"should be able to perform a right click on an element"
Expand All @@ -93,6 +98,7 @@ def test_right_click(browser_name, get_new_browser):
assert result_1 == result_2 == "right clicked"


@pytest.mark.flaky
@pytest.mark.parametrize("browser_name", supported_browsers)
def test_drag_and_drop(browser_name, get_new_browser):
"""
Expand Down
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
extras = zope.testbrowser, django, flask
deps = -rrequirements/test.txt
commands=
pytest -v {posargs}
pytest --max-runs 8 -v {posargs}


[testenv:tests_selenium]
extras = selenium
deps =
-rrequirements/test.txt
commands=
pytest -v {posargs}
pytest --max-runs 8 -v {posargs}


[testenv:tests_windows_selenium]
Expand All @@ -20,4 +20,4 @@ deps =
passenv =
EDGEWEBDRIVER
commands=
pytest -v {posargs}
pytest --max-runs 8 -v {posargs}

0 comments on commit e8343a1

Please sign in to comment.