44import reactpy
55from reactpy import html
66from reactpy .reactjs import component_from_npm , import_reactjs
7- from reactpy .testing import BackendFixture , DisplayFixture
7+ from reactpy .testing import GITHUB_ACTIONS , BackendFixture , DisplayFixture
88
99
1010@pytest .fixture (scope = "module" )
@@ -15,7 +15,7 @@ async def display(browser):
1515 yield new_display
1616
1717
18- @pytest .mark .flaky (reruns = 3 )
18+ @pytest .mark .flaky (reruns = 10 if GITHUB_ACTIONS else 1 )
1919async def test_component_from_npm_react_bootstrap (display : DisplayFixture ):
2020 Button = component_from_npm ("react-bootstrap" , "Button" , version = "2" )
2121
@@ -34,7 +34,7 @@ def App():
3434 await expect (button ).to_contain_class ("btn-primary" )
3535
3636
37- @pytest .mark .flaky (reruns = 3 )
37+ @pytest .mark .flaky (reruns = 10 if GITHUB_ACTIONS else 1 )
3838async def test_component_from_npm_react_bootstrap_with_local_framework (browser ):
3939 Button = component_from_npm ("react-bootstrap" , "Button" , version = "2" )
4040
@@ -57,7 +57,7 @@ def App():
5757 await expect (button ).to_contain_class ("btn-primary" )
5858
5959
60- @pytest .mark .flaky (reruns = 3 )
60+ @pytest .mark .flaky (reruns = 10 if GITHUB_ACTIONS else 1 )
6161async def test_component_from_npm_material_ui (display : DisplayFixture ):
6262 Button = component_from_npm ("@mui/material" , "Button" , version = "7" )
6363
@@ -73,7 +73,7 @@ def App():
7373 await expect (button ).to_contain_class ("MuiButton-root" )
7474
7575
76- @pytest .mark .flaky (reruns = 3 )
76+ @pytest .mark .flaky (reruns = 10 if GITHUB_ACTIONS else 1 )
7777async def test_component_from_npm_antd (display : DisplayFixture ):
7878 Button = component_from_npm ("antd" , "Button" , version = "6" )
7979
@@ -87,7 +87,7 @@ def App():
8787 await expect (button ).to_contain_class ("ant-btn" )
8888
8989
90- @pytest .mark .flaky (reruns = 3 )
90+ @pytest .mark .flaky (reruns = 10 if GITHUB_ACTIONS else 1 )
9191async def test_component_from_npm_chakra_ui (display : DisplayFixture ):
9292 ChakraProvider , _ , Button = _get_chakra_components ()
9393
@@ -103,7 +103,7 @@ def App():
103103 await expect (button ).to_contain_class ("chakra-button" )
104104
105105
106- @pytest .mark .flaky (reruns = 3 )
106+ @pytest .mark .flaky (reruns = 10 if GITHUB_ACTIONS else 1 )
107107async def test_component_from_npm_semantic_ui_react (browser ):
108108 # Semantic UI is deprecated and doesn't get updates. Thus, it is incompatible with the
109109 # latest React versions. We use this as an opportunity to test Preact here.
@@ -124,7 +124,7 @@ def App():
124124 await expect (button ).to_contain_class ("button" )
125125
126126
127- @pytest .mark .flaky (reruns = 3 )
127+ @pytest .mark .flaky (reruns = 10 if GITHUB_ACTIONS else 1 )
128128async def test_component_from_npm_mantine (display : DisplayFixture ):
129129 MantineProvider , Button = component_from_npm (
130130 "@mantine/core" , ["MantineProvider" , "Button" ], version = "8"
@@ -140,7 +140,7 @@ def App():
140140 await expect (button ).to_contain_class ("mantine-Button-root" )
141141
142142
143- @pytest .mark .flaky (reruns = 3 )
143+ @pytest .mark .flaky (reruns = 10 if GITHUB_ACTIONS else 1 )
144144async def test_component_from_npm_fluent_ui (display : DisplayFixture ):
145145 PrimaryButton = component_from_npm ("@fluentui/react" , "PrimaryButton" , version = "8" )
146146
@@ -154,7 +154,7 @@ def App():
154154 await expect (button ).to_contain_class ("ms-Button" )
155155
156156
157- @pytest .mark .flaky (reruns = 3 )
157+ @pytest .mark .flaky (reruns = 10 if GITHUB_ACTIONS else 1 )
158158async def test_component_from_npm_blueprint (display : DisplayFixture ):
159159 Button = component_from_npm ("@blueprintjs/core" , "Button" , version = "6" )
160160
@@ -168,7 +168,7 @@ def App():
168168 await expect (button ).to_contain_class ("bp6-button" )
169169
170170
171- @pytest .mark .flaky (reruns = 3 )
171+ @pytest .mark .flaky (reruns = 10 if GITHUB_ACTIONS else 1 )
172172async def test_component_from_npm_grommet (display : DisplayFixture ):
173173 Grommet , Button = component_from_npm ("grommet" , ["Grommet" , "Button" ], version = "2" )
174174
@@ -183,7 +183,7 @@ def App():
183183 await expect (button ).to_have_text ("Click me" )
184184
185185
186- @pytest .mark .flaky (reruns = 3 )
186+ @pytest .mark .flaky (reruns = 10 if GITHUB_ACTIONS else 1 )
187187async def test_component_from_npm_evergreen (display : DisplayFixture ):
188188 Button = component_from_npm ("evergreen-ui" , "Button" , version = "7" )
189189
@@ -196,7 +196,7 @@ def App():
196196 await expect (button ).to_have_text ("Click me" )
197197
198198
199- @pytest .mark .flaky (reruns = 3 )
199+ @pytest .mark .flaky (reruns = 10 if GITHUB_ACTIONS else 1 )
200200async def test_component_from_npm_react_spinners (display : DisplayFixture ):
201201 ClipLoader = component_from_npm ("react-spinners" , "ClipLoader" , version = "0.17.0" )
202202
@@ -219,7 +219,7 @@ def App():
219219 await expect (loader ).to_be_visible ()
220220
221221
222- @pytest .mark .flaky (reruns = 3 )
222+ @pytest .mark .flaky (reruns = 10 if GITHUB_ACTIONS else 1 )
223223async def test_nested_npm_components (display : DisplayFixture ):
224224 ChakraProvider , Box , _ = _get_chakra_components ()
225225 BootstrapButton = component_from_npm ("react-bootstrap" , "Button" , version = "2" )
@@ -251,7 +251,7 @@ def App():
251251 await expect (button ).to_contain_class ("btn" )
252252
253253
254- @pytest .mark .flaky (reruns = 3 )
254+ @pytest .mark .flaky (reruns = 10 if GITHUB_ACTIONS else 1 )
255255async def test_interleaved_npm_and_server_components (display : DisplayFixture ):
256256 Card = component_from_npm ("antd" , "Card" , version = "6" )
257257 Button = component_from_npm ("@mui/material" , "Button" , version = "7" )
@@ -284,7 +284,7 @@ def App():
284284 await expect (button ).to_have_css ("text-transform" , "uppercase" )
285285
286286
287- @pytest .mark .flaky (reruns = 3 )
287+ @pytest .mark .flaky (reruns = 10 if GITHUB_ACTIONS else 1 )
288288async def test_complex_nested_material_ui (display : DisplayFixture ):
289289 mui_components = component_from_npm (
290290 "@mui/material" ,
0 commit comments