test(e2e): fix auth specs for character routes
This commit is contained in:
@@ -5,8 +5,11 @@ import {
|
||||
clearBrowserState,
|
||||
defaultCharacterSidebarPath,
|
||||
defaultCharacterSplashPath,
|
||||
defaultCharacterChatUrl,
|
||||
enterChatFromSplash,
|
||||
getSplashStartChatButton,
|
||||
signInWithEmailAndOpenChat,
|
||||
submitEmailLogin,
|
||||
switchToEmailSignIn,
|
||||
} from "@e2e/fixtures/test-helpers";
|
||||
|
||||
test.beforeEach(async ({ baseURL, context, page }) => {
|
||||
@@ -17,11 +20,19 @@ test.beforeEach(async ({ baseURL, context, page }) => {
|
||||
test("user can log out from the sidebar after email login", async ({
|
||||
page,
|
||||
}) => {
|
||||
await signInWithEmailAndOpenChat(page);
|
||||
await enterChatFromSplash(page);
|
||||
await page
|
||||
.getByRole("button", { name: "Sign up to unlock more features" })
|
||||
.click();
|
||||
await expect(page).toHaveURL(/\/auth(?:\?.*)?$/);
|
||||
await switchToEmailSignIn(page);
|
||||
await submitEmailLogin(page, { expectedUrl: defaultCharacterChatUrl });
|
||||
await expect(page.getByRole("button", { name: "Menu" })).toBeVisible();
|
||||
|
||||
await page.getByRole("button", { name: "Menu" }).click();
|
||||
await expect(page).toHaveURL(new RegExp(`${defaultCharacterSidebarPath}$`));
|
||||
await expect(page).toHaveURL(
|
||||
new RegExp(defaultCharacterSidebarPath.replace("?", "\\?") + "$"),
|
||||
);
|
||||
|
||||
const logoutRequestPromise = page.waitForRequest("**/api/auth/logout");
|
||||
await page.getByRole("button", { name: /Log out/i }).click();
|
||||
|
||||
Reference in New Issue
Block a user