0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-18 10:41:29 -05:00

♻️ Refactor login POM logged out user intercept

This commit is contained in:
Belén Albeza 2024-06-19 11:13:16 +02:00
parent 3e6b34c563
commit 6d82f41e43
2 changed files with 7 additions and 5 deletions

View file

@ -1,10 +1,6 @@
import { BasePage } from "./BasePage";
export class LoginPage extends BasePage {
static async initWithLoggedOutUser(page) {
await BasePage.mockRPC(page, "get-profile", "get-profile-anonymous.json");
}
constructor(page) {
super(page);
this.loginButton = page.getByRole("button", { name: "Login" });
@ -24,6 +20,10 @@ export class LoginPage extends BasePage {
await this.loginButton.click();
}
async initWithLoggedOutUser() {
await this.mockRPC("get-profile", "get-profile-anonymous.json");
}
async setupLoggedInUser() {
await this.mockRPC("get-profile", "logged-in-user/get-profile-logged-in.json");
await this.mockRPC("get-teams", "logged-in-user/get-teams-default.json");

View file

@ -2,7 +2,9 @@ import { test, expect } from "@playwright/test";
import { LoginPage } from "../pages/LoginPage";
test.beforeEach(async ({ page }) => {
await LoginPage.initWithLoggedOutUser(page);
const login = new LoginPage(page);
await login.initWithLoggedOutUser();
await page.goto("/#/auth/login");
});