Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 26 additions & 11 deletions tests/e2e/scenarios/test_telegram_hot_activation.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,28 @@
}


async def go_to_extensions(page):
await page.locator(SEL["tab_button"].format(tab="extensions")).click()
await page.locator(SEL["tab_panel"].format(tab="extensions")).wait_for(
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="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)
# Wait for the Telegram card specifically (built-in cards render first)
await page.locator(SEL["channels_ext_card"], has_text="Telegram").wait_for(
state="visible", timeout=8000
)


async def _default_gateway_status_handler(route):
await route.fulfill(
status=200,
content_type="application/json",
body=json.dumps({"enabled_channels": [], "sse_connections": 0, "ws_connections": 0}),
)

async def mock_extension_lists(page, ext_handler):

async def mock_extension_lists(page, ext_handler, *, gateway_status_handler=None):
async def handle_ext_list(route):
path = route.request.url.split("?")[0]
if path.endswith("/api/extensions"):
Expand All @@ -69,6 +80,10 @@ async def handle_registry(route):
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",
gateway_status_handler or _default_gateway_status_handler,
)


async def wait_for_toast(page, text: str, *, timeout: int = 5000):
Expand Down Expand Up @@ -106,9 +121,9 @@ async def handle_setup(route):

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"], has_text="Telegram")
await card.locator(SEL["ext_configure_btn"], has_text="Setup").click()

modal = page.locator(SEL["configure_modal"])
Expand Down Expand Up @@ -198,9 +213,9 @@ async def handle_setup(route):

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"], has_text="Telegram")
await card.locator(SEL["ext_configure_btn"], has_text="Setup").click()

modal = page.locator(SEL["configure_modal"])
Expand Down
1 change: 1 addition & 0 deletions tests/e2e_telegram_message_routing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ mod tests {
http_interceptor: None,
transcription: None,
document_extraction: None,
builder: None,
};

let gateway = Arc::new(TestChannel::new());
Expand Down
Loading