fix the test to properly fail
This commit is contained in:
@@ -78,16 +78,25 @@ test("Should show error screen if call creation is restricted", async ({
|
|||||||
}) => {
|
}) => {
|
||||||
await page.goto("/");
|
await page.goto("/");
|
||||||
|
|
||||||
await page.getByTestId("home_callName").click();
|
// We need the socket connection to fail, but this cannot be done by using the websocket route.
|
||||||
await page.getByTestId("home_callName").fill("HelloCall");
|
// Instead, we will trick the app by returning a bad URL for the SFU that will not be reachable an error out.
|
||||||
await page.getByTestId("home_displayName").click();
|
await page.route(
|
||||||
await page.getByTestId("home_displayName").fill("John Doe");
|
"**/matrix-rtc.m.localhost/livekit/jwt/sfu/get",
|
||||||
await page.getByTestId("home_go").click();
|
async (route) =>
|
||||||
|
await route.fulfill({
|
||||||
|
status: 200,
|
||||||
|
contentType: "application/json",
|
||||||
|
body: JSON.stringify({
|
||||||
|
url: "wss://badurltotricktest/livekit/sfu",
|
||||||
|
jwt: "FAKE",
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
// Simulate when the room was not created prior to the call.
|
// Then if the socket connection fails, livekit will try to validate the token!
|
||||||
// Livekit will not auto_create anymore and will return a 404 error.
|
// Livekit will not auto_create anymore and will return a 404 error.
|
||||||
await page.route(
|
await page.route(
|
||||||
"**/livekit/sfu/rtc/validate?*",
|
"**/badurltotricktest/livekit/sfu/rtc/validate?**",
|
||||||
async (route) =>
|
async (route) =>
|
||||||
await route.fulfill({
|
await route.fulfill({
|
||||||
status: 404,
|
status: 404,
|
||||||
@@ -96,9 +105,18 @@ test("Should show error screen if call creation is restricted", async ({
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
await page.pause();
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
// Join the call
|
// Join the call
|
||||||
await page.getByTestId("lobby_joinCall").click();
|
await page.getByTestId("lobby_joinCall").click();
|
||||||
|
|
||||||
|
await page.pause();
|
||||||
// Should fail
|
// Should fail
|
||||||
await expect(page.getByText("Failed to create call")).toBeVisible();
|
await expect(page.getByText("Failed to create call")).toBeVisible();
|
||||||
await expect(
|
await expect(
|
||||||
|
|||||||
Reference in New Issue
Block a user