Test that the connection banner is displayed when the websocket drops. Args: connection_banner: AppHarness instance. simulate_compile_context: Which context to set for the app.
(
connection_banner: AppHarness, simulate_compile_context: constants.CompileContext
)
| 283 | |
| 284 | |
| 285 | def test_cloud_banner( |
| 286 | connection_banner: AppHarness, simulate_compile_context: constants.CompileContext |
| 287 | ): |
| 288 | """Test that the connection banner is displayed when the websocket drops. |
| 289 | |
| 290 | Args: |
| 291 | connection_banner: AppHarness instance. |
| 292 | simulate_compile_context: Which context to set for the app. |
| 293 | """ |
| 294 | assert connection_banner.app_instance is not None |
| 295 | assert connection_banner.backend is not None |
| 296 | driver = connection_banner.frontend() |
| 297 | |
| 298 | driver.add_cookie({"name": "backend-enabled", "value": "truly"}) |
| 299 | driver.refresh() |
| 300 | _assert_token(connection_banner, driver) |
| 301 | AppHarness.expect(lambda: not has_cloud_banner(driver)) |
| 302 | |
| 303 | driver.add_cookie({"name": "backend-enabled", "value": "false"}) |
| 304 | driver.refresh() |
| 305 | if simulate_compile_context == constants.CompileContext.DEPLOY: |
| 306 | AppHarness.expect(lambda: has_cloud_banner(driver)) |
| 307 | else: |
| 308 | _assert_token(connection_banner, driver) |
| 309 | AppHarness.expect(lambda: not has_cloud_banner(driver)) |
| 310 | |
| 311 | driver.delete_cookie("backend-enabled") |
| 312 | driver.refresh() |
| 313 | _assert_token(connection_banner, driver) |
| 314 | AppHarness.expect(lambda: not has_cloud_banner(driver)) |
nothing calls this directly
no test coverage detected