diff --git a/tests/e2e/scenarios/test_telegram_hot_activation.py b/tests/e2e/scenarios/test_telegram_hot_activation.py index af85b989..3d1d1183 100644 --- a/tests/e2e/scenarios/test_telegram_hot_activation.py +++ b/tests/e2e/scenarios/test_telegram_hot_activation.py @@ -33,15 +33,16 @@ _TELEGRAM_ACTIVE = { } -async def go_to_extensions(page): +async def go_to_channels(page): + """Navigate to Settings → Channels subtab (where wasm_channel extensions live).""" await page.locator(SEL["tab_button"].format(tab="settings")).click() - await page.locator(SEL["settings_subtab"].format(subtab="extensions")).click() - await page.locator(SEL["settings_subpanel"].format(subtab="extensions")).wait_for( + await page.locator(SEL["settings_subtab"].format(subtab="channels")).click() + await page.locator(SEL["settings_subpanel"].format(subtab="channels")).wait_for( state="visible", timeout=5000 ) - await page.locator( - f"{SEL['extensions_list']} .empty-state, {SEL['ext_card_installed']}" - ).first.wait_for(state="visible", timeout=8000) + await page.locator(SEL["channels_ext_card"]).first.wait_for( + state="visible", timeout=8000 + ) async def mock_extension_lists(page, ext_handler): @@ -66,10 +67,18 @@ async def mock_extension_lists(page, ext_handler): body=json.dumps({"entries": []}), ) + async def handle_gateway_status(route): + await route.fulfill( + status=200, + content_type="application/json", + body=json.dumps({"enabled_channels": [], "sse_connections": 0, "ws_connections": 0}), + ) + # Register the broad route first so the specific endpoints below win. await page.route("**/api/extensions*", handle_ext_list) await page.route("**/api/extensions/tools", handle_tools) await page.route("**/api/extensions/registry", handle_registry) + await page.route("**/api/gateway/status", handle_gateway_status) async def wait_for_toast(page, text: str, *, timeout: int = 5000): @@ -107,9 +116,9 @@ async def test_telegram_setup_modal_shows_bot_token_field(page): await mock_extension_lists(page, handle_ext_list) await page.route("**/api/extensions/telegram/setup", handle_setup) - await go_to_extensions(page) + await go_to_channels(page) - card = page.locator(SEL["ext_card_installed"]).first + card = page.locator(SEL["channels_ext_card"]).first await card.locator(SEL["ext_configure_btn"], has_text="Setup").click() modal = page.locator(SEL["configure_modal"]) @@ -199,9 +208,9 @@ async def test_telegram_hot_activation_transitions_installed_to_active(page): await mock_extension_lists(page, handle_ext_list) await page.route("**/api/extensions/telegram/setup", handle_setup) - await go_to_extensions(page) + await go_to_channels(page) - card = page.locator(SEL["ext_card_installed"]).first + card = page.locator(SEL["channels_ext_card"]).first await card.locator(SEL["ext_configure_btn"], has_text="Setup").click() modal = page.locator(SEL["configure_modal"])