test(e2e): update mock specs for splash changes
This commit is contained in:
@@ -5,6 +5,12 @@ export const e2eEmailCredentials = {
|
|||||||
password: "12345678",
|
password: "12345678",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const splashStartChatButtonName = "Start Chatting";
|
||||||
|
|
||||||
|
export function getSplashStartChatButton(page: Page) {
|
||||||
|
return page.getByRole("button", { name: splashStartChatButtonName });
|
||||||
|
}
|
||||||
|
|
||||||
export async function clearBrowserState(
|
export async function clearBrowserState(
|
||||||
context: BrowserContext,
|
context: BrowserContext,
|
||||||
page: Page,
|
page: Page,
|
||||||
@@ -45,12 +51,12 @@ export async function enterChatFromSplash(
|
|||||||
|
|
||||||
await page.goto("/splash", { waitUntil });
|
await page.goto("/splash", { waitUntil });
|
||||||
|
|
||||||
const skipButton = page.getByRole("button", { name: "Skip" });
|
const startChatButton = getSplashStartChatButton(page);
|
||||||
await expect(skipButton).toBeVisible({ timeout });
|
await expect(startChatButton).toBeVisible({ timeout });
|
||||||
await expect(skipButton).toBeEnabled();
|
await expect(startChatButton).toBeEnabled();
|
||||||
|
|
||||||
for (let attempt = 0; attempt < 3; attempt += 1) {
|
for (let attempt = 0; attempt < 3; attempt += 1) {
|
||||||
await skipButton.click();
|
await startChatButton.click();
|
||||||
try {
|
try {
|
||||||
await expect(page).toHaveURL(expectedUrl, { timeout: 3_000 });
|
await expect(page).toHaveURL(expectedUrl, { timeout: 3_000 });
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ test("user can email login from other sign-in options and return to chat", async
|
|||||||
await page
|
await page
|
||||||
.getByRole("button", { name: "Sign up to unlock more features" })
|
.getByRole("button", { name: "Sign up to unlock more features" })
|
||||||
.click();
|
.click();
|
||||||
await expect(page).toHaveURL(/\/auth$/);
|
await expect(page).toHaveURL(/\/auth(?:\?.*)?$/);
|
||||||
|
|
||||||
await switchToEmailSignIn(page);
|
await switchToEmailSignIn(page);
|
||||||
const loginRequest = await submitEmailLogin(page, { expectedUrl: /\/chat$/ });
|
const loginRequest = await submitEmailLogin(page, { expectedUrl: /\/chat$/ });
|
||||||
|
|||||||
@@ -26,9 +26,8 @@ test("user can log out from the sidebar after email login", async ({
|
|||||||
const logoutRequest = await logoutRequestPromise;
|
const logoutRequest = await logoutRequestPromise;
|
||||||
expect(logoutRequest.method()).toBe("POST");
|
expect(logoutRequest.method()).toBe("POST");
|
||||||
|
|
||||||
await expect(page).toHaveURL(/\/splash$/);
|
await expect(page).toHaveURL(/\/chat$/);
|
||||||
await expect(page.getByRole("button", { name: "Skip" })).toBeVisible();
|
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole("button", { name: "Login with Facebook" }),
|
page.getByRole("button", { name: "Sign up to unlock more features" }),
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user