mirror of
https://github.com/penpot/penpot.git
synced 2025-12-11 22:14:05 +01:00
♻️ Refactor LoginPage POM
This commit is contained in:
@@ -6,6 +6,7 @@ export class BasePage {
|
||||
if (typeof path !== "string" && !(path instanceof RegExp)) {
|
||||
throw new TypeError("Invalid path argument. Must be a string or a RegExp.");
|
||||
}
|
||||
|
||||
const url = typeof path === "string" ? `**/api/rpc/command/${path}` : path;
|
||||
const interceptConfig = {
|
||||
status: 200,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { BasePage } from "./BasePage";
|
||||
|
||||
export class LoginPage extends BasePage {
|
||||
static setupLoggedOutUser(page) {
|
||||
return this.mockRPC(page, "get-profile", "get-profile-anonymous.json");
|
||||
static async initWithLoggedOutUser(page) {
|
||||
await BasePage.mockRPC(page, "get-profile", "get-profile-anonymous.json");
|
||||
}
|
||||
|
||||
constructor(page) {
|
||||
@@ -10,8 +10,8 @@ export class LoginPage extends BasePage {
|
||||
this.loginButton = page.getByRole("button", { name: "Login" });
|
||||
this.password = page.getByLabel("Password");
|
||||
this.userName = page.getByLabel("Email");
|
||||
this.message = page.getByText("Email or password is incorrect");
|
||||
this.badLoginMsg = page.getByText("Enter a valid email please");
|
||||
this.invalidCredentialsError = page.getByText("Email or password is incorrect");
|
||||
this.invalidEmailError = page.getByText("Enter a valid email please");
|
||||
this.initialHeading = page.getByRole("heading", { name: "Log into my account" });
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ export class LoginPage extends BasePage {
|
||||
await this.loginButton.click();
|
||||
}
|
||||
|
||||
async setupAllowedUser() {
|
||||
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");
|
||||
await this.mockRPC("get-font-variants?team-id=*", "logged-in-user/get-font-variants-empty.json");
|
||||
|
||||
Reference in New Issue
Block a user