cal.pub0.org/apps/web/playwright/login.test.ts

29 lines
908 B
TypeScript
Raw Normal View History

import { expect } from "@playwright/test";
import { test } from "./lib/fixtures";
2021-11-02 14:19:40 +00:00
test.describe("Login tests", () => {
// Using logged in state from globalSteup
test.use({ storageState: "playwright/artifacts/proStorageState.json" });
2021-11-02 14:19:40 +00:00
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();
});
2021-11-02 14:19:40 +00:00
});