0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 23:18:48 -05:00

📎 Add temporary visual regression test for login form

This commit is contained in:
Belén Albeza 2024-06-19 11:21:20 +02:00
parent 6d82f41e43
commit d4eea973b6
2 changed files with 37 additions and 10 deletions

View file

@ -1,10 +0,0 @@
import { test, expect } from "@playwright/test";
import { LoginPage } from "../pages/LoginPage";
test("Shows login form correctly", async ({ page }) => {
await LoginPage.initWithLoggedOutUser(page);
const loginPage = new LoginPage(page);
await page.goto("/#/auth/login");
await expect(page).toHaveScreenshot();
});

View file

@ -0,0 +1,37 @@
import { test, expect } from "@playwright/test";
import { LoginPage } from "../pages/LoginPage";
test.beforeEach(async ({ page }) => {
const login = new LoginPage(page);
await login.initWithLoggedOutUser();
await login.page.goto("/#/auth/login");
});
test.describe("Login form", () => {
test("Shows the login form correctly", async ({ page }) => {
const login = new LoginPage(page);
await expect(login.page).toHaveScreenshot();
});
test("Shows form error messages correctly ", async ({ page }) => {
const login = new LoginPage(page);
await login.setupLoginSuccess();
await login.fillEmailAndPasswordInputs("foo", "lorenIpsum");
await expect(login.invalidEmailError).toBeVisible();
await expect(login.page).toHaveScreenshot();
});
test("Shows error toasts correctly", async ({ page }) => {
const login = new LoginPage(page);
await login.setupLoginError();
await login.fillEmailAndPasswordInputs("test@example.com", "loremipsum");
await login.clickLoginButton();
await expect(login.invalidCredentialsError).toBeVisible();
await expect(login.page).toHaveURL(/auth\/login$/);
await expect(login.page).toHaveScreenshot();
});
});