calcom/apps/web/playwright/login.test.ts
Demian Caldelas 0390ae9ee1
Introducing Playwright Fixtures - Users Factory (#2293)
* Fix not able to logout using the logout path

* Add users fixture for e2e tests

* typo

Co-authored-by: Omar López <zomars@me.com>
2022-03-28 20:06:41 +00:00

28 lines
908 B
TypeScript

import { expect } from "@playwright/test";
import { test } from "./lib/fixtures";
test.describe("Login tests", () => {
// Using logged in state from globalSteup
test.use({ storageState: "playwright/artifacts/proStorageState.json" });
test("Login with pro@example.com", async ({ page }) => {
// Try to go homepage
await page.goto("/");
// It should redirect you to the event-types page
await page.waitForSelector("[data-testid=event-types]");
});
test("Should logout using the logout path", async ({ page, users }) => {
// creates a user and login
const pro = await users.create();
await pro.login();
// users.logout() action uses the logout route "/auth/logout" to clear the session
await users.logout();
// check if we are at the login page
await page.goto("/");
await expect(page.locator(`[data-testid=login-form]`)).toBeVisible();
});
});