import { Locator, Page, expect } from '@playwright/test'; /** * The Settings tab: cart expiry, the two link lifetimes, and the greeting. * * The lifetimes are not cosmetic — the verification and password reset emails * state their own duration through a placeholder rendered from these values, so * changing one here changes what a customer is told (#136). The greeting is a * format plus a separate fallback, because a format with the name edited out * would ship "Hi ," to everyone who registered while first names were optional. */ export class AdminSettings { readonly heading: Locator; readonly cartExpiryHours: Locator; readonly verifyTokenHours: Locator; readonly passwordResetHours: Locator; readonly greetingFormat: Locator; readonly greetingFallback: Locator; readonly saveButton: Locator; constructor(private readonly page: Page) { this.heading = page.getByRole('heading', { name: 'Link lifetimes' }); this.cartExpiryHours = page.getByLabel('Cart expiry (hours)'); this.verifyTokenHours = page.getByLabel('Email verification link (hours)'); this.passwordResetHours = page.getByLabel('Password reset link (hours)'); this.greetingFormat = page.getByLabel('Greeting format'); this.greetingFallback = page.getByLabel('Fallback, when there is no first name'); this.saveButton = page.getByRole('button', { name: 'Save' }); } async open(): Promise { await this.page.goto('/admin'); await this.page.getByRole('tab', { name: 'Settings', exact: true }).click(); await expect(this.heading).toBeVisible(); } }