import { Page } from '@playwright/test';

export class LoginPage {
  constructor(private page: Page) {}

  //////////  LOCATORS //////////

  getPageTitle = () => this.page.locator('h2', { hasText: "Test TEXT" });
  getForm = () => this.page.locator('form');

  //////////  ACTIONS //////////

  public async loginUser(email: string, password: string) {
    await this.page.locator('#email').fill(email);
    await this.page.locator('#password').fill(password);
    await this.page.locator('#login').click();
    await this.page.waitForLoadState('networkidle');
  }

  public async gotToForgotPasswordPage() {
    await this.page.locator('text=Forgot Password').click();
    await this.page.waitForLoadState('networkidle');
  }
}