Get the token associated with backend state. Args: event_chain: harness for EventChain app. driver: WebDriver instance. Returns: The token visible in the driver browser.
(event_chain: AppHarness, driver: WebDriver)
| 381 | |
| 382 | |
| 383 | def assert_token(event_chain: AppHarness, driver: WebDriver) -> str: |
| 384 | """Get the token associated with backend state. |
| 385 | |
| 386 | Args: |
| 387 | event_chain: harness for EventChain app. |
| 388 | driver: WebDriver instance. |
| 389 | |
| 390 | Returns: |
| 391 | The token visible in the driver browser. |
| 392 | """ |
| 393 | assert event_chain.app_instance is not None |
| 394 | token_input = AppHarness.poll_for_or_raise_timeout( |
| 395 | lambda: driver.find_element(By.ID, "token") |
| 396 | ) |
| 397 | |
| 398 | # wait for the backend connection to send the token |
| 399 | token = event_chain.poll_for_value(token_input) |
| 400 | assert token is not None |
| 401 | |
| 402 | state_name = event_chain.get_full_state_name(["_state"]) |
| 403 | return f"{token}_{state_name}" |
| 404 | |
| 405 | |
| 406 | @pytest.mark.parametrize( |
no test coverage detected