From 81555c8d5136cb4a0df2a1ade67b8d595b71825e Mon Sep 17 00:00:00 2001 From: Valere Date: Thu, 31 Jul 2025 17:46:09 +0200 Subject: [PATCH] add a playwright test --- playwright/errors.spec.ts | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/playwright/errors.spec.ts b/playwright/errors.spec.ts index 7671c103..0be92140 100644 --- a/playwright/errors.spec.ts +++ b/playwright/errors.spec.ts @@ -72,3 +72,39 @@ test("Should automatically retry non fatal JWT errors", async ({ await hasRetriedPromise; await expect(page.getByTestId("video").first()).toBeVisible(); }); + +test("Should show error screen if call creation is restricted", async ({ + page, +}) => { + await page.goto("/"); + + await page.getByTestId("home_callName").click(); + await page.getByTestId("home_callName").fill("HelloCall"); + await page.getByTestId("home_displayName").click(); + await page.getByTestId("home_displayName").fill("John Doe"); + await page.getByTestId("home_go").click(); + + // Simulate when the room was not created prior to the call. + // Livekit will not auto_create anymore and will return a 404 error. + await page.route( + "**/livekit/sfu/rtc/validate?*", + async (route) => + await route.fulfill({ + // 418 is a non retryable error, so test will fail immediately + status: 404, + contentType: "text/plain", + body: "requested room does not exist", + }), + ); + + // Join the call + await page.getByTestId("lobby_joinCall").click(); + + // Should fail + await expect(page.getByText("Failed to create call")).toBeVisible(); + await expect( + page.getByText( + /Call creation might be restricted to authorized users only/, + ), + ).toBeVisible(); +});