- Raise use-swipe-gesture mutation score to 66.13% (target 65%+) - Maintain use-reduced-motion mutation score at 76.32% (target 50%+) - Fix use-reduced-motion.ts ESLint set-state-in-effect warning - Add UJ-10 deep searcher journey (category browse → article read → content discovery) - Add 40 new test files (analytics, detail, sections, ui, lib components) - Update test-strategy-plan.md to v2.0 (sync test count to 1591) - Sync README.md with final release metrics Quality gates: TS 0 errors, ESLint 0 errors, 121 suites / 1591 tests passed
73 lines
2.5 KiB
TypeScript
73 lines
2.5 KiB
TypeScript
// @ts-nocheck
|
|
import { Page } from '@playwright/test';
|
|
import { BasePage } from './BasePage';
|
|
import { getPageConfig } from '../config/test-pages';
|
|
import { TestConfig } from '../types';
|
|
|
|
export class ContactPage extends BasePage {
|
|
constructor(page: Page, config?: TestConfig) {
|
|
const pageConfig = getPageConfig('contact');
|
|
super(page, pageConfig.url, config);
|
|
}
|
|
|
|
async fillContactForm(data: { name: string; email: string; phone: string; message: string; subject?: string }): Promise<void> {
|
|
await this.fill('[data-testid="name-input"]', data.name);
|
|
await this.fill('[data-testid="phone-input"]', data.phone);
|
|
await this.fill('[data-testid="email-input"]', data.email);
|
|
if (data.subject) {
|
|
await this.fill('[data-testid="subject-input"]', data.subject);
|
|
}
|
|
await this.fill('[data-testid="message-input"]', data.message);
|
|
}
|
|
|
|
async submitForm(): Promise<void> {
|
|
await this.click('[data-testid="submit-button"]');
|
|
}
|
|
|
|
async getFormErrorMessage(): Promise<string> {
|
|
const errorElement = await this.page.locator('[data-testid="error-message"]');
|
|
if (await errorElement.count() > 0) {
|
|
return await errorElement.first().textContent() || '';
|
|
}
|
|
return '';
|
|
}
|
|
|
|
async getFormSuccessMessage(): Promise<string> {
|
|
await this.page.waitForTimeout(1000);
|
|
const successElement = await this.page.locator('[data-testid="success-message"]');
|
|
if (await successElement.count() > 0) {
|
|
return await successElement.textContent() || '';
|
|
}
|
|
return '';
|
|
}
|
|
|
|
async getToastMessage(): Promise<{ message: string; type: 'success' | 'error' }> {
|
|
const toastElement = await this.page.locator('[data-testid="toast-notification"]');
|
|
if (await toastElement.count() > 0) {
|
|
const messageElement = toastElement.locator('p');
|
|
const message = await messageElement.textContent() || '';
|
|
const type = await toastElement.getAttribute('data-type') as 'success' | 'error';
|
|
return { message, type };
|
|
}
|
|
return { message: '', type: 'success' };
|
|
}
|
|
|
|
async waitForToast(timeout: number = 5000): Promise<boolean> {
|
|
try {
|
|
await this.page.waitForSelector('[data-testid="toast-notification"]', { timeout });
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
async waitForToastHidden(timeout: number = 5000): Promise<boolean> {
|
|
try {
|
|
await this.page.waitForSelector('[data-testid="toast-notification"]', { state: 'hidden', timeout });
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|
|
}
|