feat: add page objects for all pages
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { Page } from '@playwright/test';
|
||||
import { BasePage } from './BasePage';
|
||||
import { getPageConfig } from '../config/test-pages';
|
||||
|
||||
export class ContactPage extends BasePage {
|
||||
constructor(page: Page, config?) {
|
||||
const pageConfig = getPageConfig('contact');
|
||||
super(page, pageConfig.url, config);
|
||||
}
|
||||
|
||||
async fillContactForm(data: { name: string; email: string; phone: string; message: string }): Promise<void> {
|
||||
await this.fill('#name', data.name);
|
||||
await this.fill('#email', data.email);
|
||||
await this.fill('#phone', data.phone);
|
||||
await this.fill('#message', data.message);
|
||||
}
|
||||
|
||||
async submitForm(): Promise<void> {
|
||||
await this.click('button[type="submit"]');
|
||||
}
|
||||
|
||||
async getFormErrorMessage(): Promise<string> {
|
||||
return await this.getText('.error-message');
|
||||
}
|
||||
|
||||
async getFormSuccessMessage(): Promise<string> {
|
||||
return await this.getText('.success-message');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user