Skip to content

Commit 8899999

Browse files
committed
test: replace unit tests with integration test for pop_views_until
Remove standalone unit test file and add integration test to test_routing_navigation.py following the existing test pattern, as suggested by @ndonkoHenri in PR review.
1 parent 5fb749e commit 8899999

File tree

2 files changed

+57
-175
lines changed

2 files changed

+57
-175
lines changed

sdk/python/packages/flet/integration_tests/examples/apps/test_routing_navigation.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
home_store,
88
initial_route,
99
pop_view_confirm,
10+
pop_views_until,
1011
route_change_event,
1112
)
1213

@@ -185,3 +186,59 @@ async def test_drawer_navigation(flet_app_function: ftt.FletTestApp):
185186
# Verify home view
186187
home_text = await flet_app_function.tester.find_by_text("Welcome to Home Page")
187188
assert home_text.count == 1
189+
190+
191+
@pytest.mark.parametrize(
192+
"flet_app_function",
193+
[{"flet_app_main": pop_views_until.main}],
194+
indirect=True,
195+
)
196+
@pytest.mark.asyncio(loop_scope="function")
197+
async def test_pop_views_until(flet_app_function: ftt.FletTestApp):
198+
# Verify initial view
199+
button = await flet_app_function.tester.find_by_text_containing("Start flow")
200+
assert button.count == 1
201+
result_text = await flet_app_function.tester.find_by_text("No result yet")
202+
assert result_text.count == 1
203+
204+
# Navigate to Step 1
205+
await flet_app_function.tester.tap(button)
206+
await flet_app_function.tester.pump_and_settle()
207+
step1_text = await flet_app_function.tester.find_by_text("Step 1 of the flow")
208+
assert step1_text.count == 1
209+
210+
# Navigate to Step 2
211+
step2_button = await flet_app_function.tester.find_by_text_containing(
212+
"Go to Step 2"
213+
)
214+
assert step2_button.count == 1
215+
await flet_app_function.tester.tap(step2_button)
216+
await flet_app_function.tester.pump_and_settle()
217+
step2_text = await flet_app_function.tester.find_by_text("Step 2 of the flow")
218+
assert step2_text.count == 1
219+
220+
# Navigate to Step 3
221+
step3_button = await flet_app_function.tester.find_by_text_containing(
222+
"Go to Step 3"
223+
)
224+
assert step3_button.count == 1
225+
await flet_app_function.tester.tap(step3_button)
226+
await flet_app_function.tester.pump_and_settle()
227+
final_text = await flet_app_function.tester.find_by_text("Flow complete!")
228+
assert final_text.count == 1
229+
230+
# Click "Finish and go Home" — triggers pop_views_until
231+
finish_button = await flet_app_function.tester.find_by_text_containing(
232+
"Finish and go Home"
233+
)
234+
assert finish_button.count == 1
235+
await flet_app_function.tester.tap(finish_button)
236+
await flet_app_function.tester.pump_and_settle()
237+
238+
# Verify back at Home with result
239+
result_text = await flet_app_function.tester.find_by_text("Result: Flow completed!")
240+
assert result_text.count == 1
241+
242+
# Verify we can start the flow again
243+
button = await flet_app_function.tester.find_by_text_containing("Start flow")
244+
assert button.count == 1

sdk/python/packages/flet/tests/test_pop_views_until.py

Lines changed: 0 additions & 175 deletions
This file was deleted.

0 commit comments

Comments
 (0)