Test that nested async with self in the same coroutine raises Exception. Args: background_task: harness for BackgroundTask app. driver: WebDriver instance. token: The token for the connected client.
(
background_task: AppHarness,
driver: WebDriver,
token: str,
)
| 340 | |
| 341 | |
| 342 | def test_nested_async_with_self( |
| 343 | background_task: AppHarness, |
| 344 | driver: WebDriver, |
| 345 | token: str, |
| 346 | ): |
| 347 | """Test that nested async with self in the same coroutine raises Exception. |
| 348 | |
| 349 | Args: |
| 350 | background_task: harness for BackgroundTask app. |
| 351 | driver: WebDriver instance. |
| 352 | token: The token for the connected client. |
| 353 | """ |
| 354 | assert background_task.app_instance is not None |
| 355 | |
| 356 | # get a reference to all buttons |
| 357 | nested_async_with_self_button = driver.find_element(By.ID, "nested-async-with-self") |
| 358 | increment_button = driver.find_element(By.ID, "increment") |
| 359 | |
| 360 | # get a reference to the counter |
| 361 | counter = driver.find_element(By.ID, "counter") |
| 362 | AppHarness.expect(lambda: counter.text == "0", timeout=5) |
| 363 | |
| 364 | nested_async_with_self_button.click() |
| 365 | AppHarness.expect(lambda: counter.text == "1", timeout=5) |
| 366 | |
| 367 | increment_button.click() |
| 368 | AppHarness.expect(lambda: counter.text == "2", timeout=5) |
| 369 | |
| 370 | |
| 371 | def test_get_state( |