|
| 1 | +import { expect, Page } from "@playwright/test" |
| 2 | + |
| 3 | +import { testData } from "../fixtures/testData" |
| 4 | + |
| 5 | +import { BasePage } from "./BasePage" |
| 6 | + |
| 7 | +/** |
| 8 | + * Page Object Model for the Start page |
| 9 | + */ |
| 10 | +export class StartPage extends BasePage { |
| 11 | + private readonly url = "/en/start" |
| 12 | + |
| 13 | + constructor(page: Page) { |
| 14 | + super(page) |
| 15 | + } |
| 16 | + |
| 17 | + /** |
| 18 | + * Navigate to the start page |
| 19 | + */ |
| 20 | + async goto() { |
| 21 | + await this.navigateTo(this.url) |
| 22 | + } |
| 23 | + |
| 24 | + /** |
| 25 | + * Verify the start page has loaded successfully |
| 26 | + */ |
| 27 | + async verifyPageLoaded() { |
| 28 | + await this.assertTitleContains(testData.content.headings.startPage) |
| 29 | + } |
| 30 | + |
| 31 | + async connectWithExistingWallet() { |
| 32 | + await this.page |
| 33 | + .getByRole("paragraph") |
| 34 | + .filter({ hasText: "I have a wallet." }) |
| 35 | + .click() |
| 36 | + await this.page.getByRole("button", { name: "Continue" }).click() |
| 37 | + await this.page |
| 38 | + .getByRole("button", { name: "Sign in with Ethereum" }) |
| 39 | + .click() |
| 40 | + // Choose mock wallet option in RainbowKit modal |
| 41 | + await this.page.getByTestId("rk-wallet-option-mock").click() |
| 42 | + // Verify wallet connected |
| 43 | + await expect( |
| 44 | + this.page |
| 45 | + .getByRole("paragraph") |
| 46 | + .filter({ hasText: "This is your account" }) |
| 47 | + ).toBeVisible() |
| 48 | + } |
| 49 | + |
| 50 | + async continueToUseAppsStep() { |
| 51 | + await this.page.getByRole("button", { name: "Lets continue" }).click() |
| 52 | + await expect( |
| 53 | + this.page.getByRole("heading", { name: "Let Use Some Apps" }) |
| 54 | + ).toBeVisible() |
| 55 | + } |
| 56 | +} |
0 commit comments