Skip to content

Commit

Permalink
add multi-user navigation test
Browse files Browse the repository at this point in the history
  • Loading branch information
falkoschindler committed Aug 2, 2024
1 parent b54adf7 commit 7f20ecb
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/test_user_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,41 @@ def other():
await user.should_see('Other page')


async def test_multi_user_navigation(create_user: Callable[[], User]) -> None:
@ui.page('/')
def page():
ui.label('Main page')
ui.button('go to other', on_click=lambda: ui.navigate.to('/other'))
ui.button('forward', on_click=ui.navigate.forward)

@ui.page('/other')
def other():
ui.label('Other page')
ui.button('back', on_click=ui.navigate.back)

userA = create_user()
userB = create_user()

await userA.open('/')
await userA.should_see('Main page')

await userB.open('/')
await userB.should_see('Main page')

userA.activate()
userA.find('go to other').click()
await userA.should_see('Other page')
await userB.should_see('Main page')

userA.find('back').click()
await userA.should_see('Main page')
await userB.should_see('Main page')

userA.find('forward').click()
await userA.should_see('Other page')
await userB.should_see('Main page')


async def test_reload(user: User) -> None:
@ui.page('/')
def page():
Expand Down

0 comments on commit 7f20ecb

Please sign in to comment.