import { Locator, Page } from '@playwright/test'; /** The signed-in chrome: sidebar navigation and the account bar. */ export class ShellPage { readonly agencyName: Locator; readonly agencySlug: Locator; readonly accountName: Locator; readonly accountMeta: Locator; readonly signOut: Locator; constructor(private readonly page: Page) { this.agencyName = page.locator('.tenant-name'); this.agencySlug = page.locator('.tenant-slug'); this.accountName = page.locator('.account-name'); this.accountMeta = page.locator('.account-meta'); this.signOut = page.getByRole('button', { name: 'Sign out' }); } /** * Navigates by sidebar link. The href selector is deliberate: several screens * also carry a "Search flights" call-to-action button, and matching by role * and name alone would be ambiguous. */ async goToDashboard(): Promise { await this.page.locator('.nav-link[href="/dashboard"]').click(); await this.page.waitForURL('**/dashboard'); } async goToSearch(): Promise { await this.page.locator('.nav-link[href="/search"]').click(); await this.page.waitForURL('**/search'); } async goToBookings(): Promise { await this.page.locator('.nav-link[href="/bookings"]').click(); await this.page.waitForURL('**/bookings'); } async signOutAndWait(): Promise { await this.signOut.click(); await this.page.waitForURL('**/login'); } }