Some checks failed
Admin | Playwright Tests / Admin | Playwright Tests | Shard 1 Of 6 (push) Failing after 37s
Admin | Playwright Tests / Admin | Playwright Tests | Shard 2 Of 6 (push) Failing after 7s
Admin | Playwright Tests / Admin | Playwright Tests | Shard 4 Of 6 (push) Failing after 7s
Admin | Playwright Tests / Admin | Playwright Tests | Shard 6 Of 6 (push) Failing after 6s
Linting Tests / PHP 8.3 test on ubuntu-latest (push) Failing after 5s
CI / PHP 8.3 test on ubuntu-latest (push) Failing after 6s
Skills Consistency / validate-skills (push) Successful in 10s
Admin | Playwright Tests / Admin | Playwright Tests | Shard 3 Of 6 (push) Failing after 7s
Admin | Playwright Tests / Admin | Playwright Tests | Shard 5 Of 6 (push) Failing after 6s
48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
import { Page, Locator, expect } from "@playwright/test";
|
|
import CoreLocators from "../locator/CoreLocators";
|
|
|
|
export class AdminPage extends CoreLocators {
|
|
readonly page: Page;
|
|
readonly emailInput: Locator;
|
|
readonly passwordInput: Locator;
|
|
readonly signInButton: Locator;
|
|
readonly megaSearchInput: Locator;
|
|
readonly profileButton: Locator;
|
|
readonly signOutLink: Locator;
|
|
|
|
constructor(page: Page) {
|
|
super(page)
|
|
this.page = page;
|
|
this.emailInput = page.getByPlaceholder("Email Address");
|
|
this.passwordInput = page.getByPlaceholder("Password");
|
|
this.signInButton = page.getByRole("button", { name: "Sign In" });
|
|
this.megaSearchInput = page.getByPlaceholder("Mega Search").first();
|
|
this.profileButton = page.getByRole("button", { name: "E" });
|
|
this.signOutLink = page.getByRole("link", { name: "Sign Out" });
|
|
}
|
|
|
|
|
|
|
|
async adminLogin(email: string, password: string) {
|
|
await this.page.goto('admin/login');
|
|
await this.emailInput.fill(email);
|
|
await this.passwordInput.fill(password);
|
|
await this.signInButton.click();
|
|
}
|
|
|
|
async verifyLogin() {
|
|
await expect(this.megaSearchInput).toBeVisible();
|
|
}
|
|
|
|
async adminLogout() {
|
|
await this.page.waitForTimeout(1000);
|
|
await this.profileButton.click();
|
|
await this.signOutLink.click();
|
|
|
|
}
|
|
|
|
async verifyLogout() {
|
|
await expect(this.passwordInput.first()).toBeVisible();
|
|
}
|
|
}
|