Skip to content

Commit 2ff406d

Browse files
committed
Add delay between each test to make CI tests more consistent
1 parent 464f589 commit 2ff406d

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

tests/test.py

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import time
2+
13
import pytest
24
from playwright.sync_api import Page, expect
35

@@ -12,11 +14,17 @@
1214
("events"),
1315
]
1416

17+
# Add a delay to each test to help with playwright race conditions
18+
@pytest.fixture(autouse=True)
19+
def slow_down_tests():
20+
yield
21+
time.sleep(2)
22+
1523

1624
@pytest.mark.parametrize("url", routes)
1725
def test_destination(
18-
page: Page,
19-
url: str,
26+
page: Page,
27+
url: str,
2028
) -> None:
2129
"""Test that the destinations page loads with seeded data"""
2230
# Create a destination
@@ -28,11 +36,11 @@ def test_destination(
2836
@pytest.mark.parametrize(
2937
"title, url",
3038
(
31-
("Acerca de", "/es/about/"),
32-
("Inicio", "/es/"),
33-
("Eventos", "/es/events/"),
34-
("Comunidad", "/es/community/"),
35-
("Conferencias", "/es/conferences/"),
39+
("Acerca de", "/es/about/"),
40+
("Inicio", "/es/"),
41+
("Eventos", "/es/events/"),
42+
("Comunidad", "/es/community/"),
43+
("Conferencias", "/es/conferences/"),
3644
),
3745
)
3846
def test_headers_in_language(page: Page, title: str, url: str) -> None:
@@ -57,11 +65,11 @@ def test_switching_lang_es_about(page: Page) -> None:
5765
@pytest.mark.parametrize(
5866
"title, url",
5967
(
60-
("Kutuhusu", "/sw/about/"),
61-
("Nyumbani", "/sw/"),
62-
("Matukio", "/sw/events/"),
63-
("Jumuiya", "/sw/community/"),
64-
("Mikutano", "/sw/conferences/"),
68+
("Kutuhusu", "/sw/about/"),
69+
("Nyumbani", "/sw/"),
70+
("Matukio", "/sw/events/"),
71+
("Jumuiya", "/sw/community/"),
72+
("Mikutano", "/sw/conferences/"),
6573
),
6674
)
6775
def test_headers_in_sw(page: Page, title: str, url: str) -> None:
@@ -86,12 +94,12 @@ def test_switching_lang_sw_about(page: Page) -> None:
8694
@pytest.mark.parametrize(
8795
"title, url",
8896
(
89-
("Black Python Devs | Home", "/"),
90-
("Black Python Devs | Blog", "/blog"),
91-
("Black Python Devs | About Us", "/about/"),
92-
("Black Python Devs | Events", "/events/"),
93-
("Black Python Devs | Conferences", "/conferences/"),
94-
("Black Python Devs | Community", "/community/"),
97+
("Black Python Devs | Home", "/"),
98+
("Black Python Devs | Blog", "/blog"),
99+
("Black Python Devs | About Us", "/about/"),
100+
("Black Python Devs | Events", "/events/"),
101+
("Black Python Devs | Conferences", "/conferences/"),
102+
("Black Python Devs | Community", "/community/"),
95103
),
96104
)
97105
def test_bpdevs_title_en(page: Page, title: str, url: str) -> None:

0 commit comments

Comments
 (0)