def poll_for_order(
    event_action: AppHarness, token: str
) -> Callable[[list[str]], Coroutine[None, None, None]]:
    """Poll for the order list to match the expected order.

    Args:
        event_action: harness for TestEventAction app.
        token: The token visible in the driver browser.

    Returns:
        An async function that polls for the order list to match the expected order.
    """
    state_name = event_action.get_state_name("_event_action_state")
    state_full_name = event_action.get_full_state_name(["_event_action_state"])

    async def _poll_for_order(exp_order: list[str]):
        async def _backend_state():
            return await event_action.get_state(f"{token}_{state_full_name}")

        async def _check():
            return (await _backend_state()).substates[state_name].order == exp_order

        await AppHarness._poll_for_async(_check)
        assert (await _backend_state()).substates[state_name].order == exp_order

    return _poll_for_order
Poll for the order list to match the expected order.

    Args:
        event_action: harness for TestEventAction app.
        token: The token visible in the driver browser.

    Returns:
        An async function that polls for the order list to match the expected order.
    
tests/integration/test_event_actions.py