test(e2e): extract shared playwright helpers
This commit is contained in:
@@ -1,30 +1,20 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
import { mockCoreApis } from "../../fixtures/api-mocks";
|
||||
import {
|
||||
clearBrowserState,
|
||||
signInWithEmailAndOpenChat,
|
||||
} from "../../fixtures/test-helpers";
|
||||
|
||||
test.beforeEach(async ({ context, page }) => {
|
||||
await context.clearCookies();
|
||||
test.beforeEach(async ({ baseURL, context, page }) => {
|
||||
await clearBrowserState(context, page, baseURL);
|
||||
await mockCoreApis(page);
|
||||
});
|
||||
|
||||
test("user can log out from the sidebar after email login", async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.goto("/auth");
|
||||
|
||||
await page.getByRole("button", { name: /Other Sign In Options/i }).click();
|
||||
await expect(
|
||||
page.getByRole("dialog", { name: /Other sign-in options/i }),
|
||||
).toBeVisible();
|
||||
|
||||
await page.getByRole("button", { name: "Email Sign In" }).click();
|
||||
await expect(page.getByPlaceholder("Email")).toHaveValue(
|
||||
"chanwillian0@gmail.com",
|
||||
);
|
||||
await expect(page.getByPlaceholder("Password")).toHaveValue("12345678");
|
||||
|
||||
await page.getByRole("button", { name: "Login" }).click();
|
||||
await expect(page).toHaveURL(/\/chat$/);
|
||||
await signInWithEmailAndOpenChat(page);
|
||||
await expect(page.getByRole("button", { name: "Menu" })).toBeVisible();
|
||||
|
||||
await page.getByRole("button", { name: "Menu" }).click();
|
||||
|
||||
Reference in New Issue
Block a user