import { Locator, Page } from "@playwright/test";
import { test as base } from "@playwright/test";

type MyFixtures = {
  homePage: HomePage;
};

export const test = base.extend<MyFixtures>({
  homePage: async ({ page }, use) => {
    const homePage = new HomePage(page);
    await use(homePage);
  },
});

class HomePage {
  private page: Page;
  private $start: Locator;

  constructor(page: Page) {
    this.page = page;
    this.$start = this.page.getByRole("link", { name: "Get started" });
  }

  async clickStart() {
    await this.$start.click();
  }
}

export { expect } from "@playwright/test";
