Removes the explicit URL declaration from the page classes. The URL validation and navigation are now handled directly within the tests, providing greater flexibility and control over test execution and removing the need to manage URLs within each page object.
26 lines
No EOL
1,018 B
TypeScript
26 lines
No EOL
1,018 B
TypeScript
import { expect, type Locator, type Page } from '@playwright/test';
|
|
import { InsuranceBasePage } from './InsuranceBasePage';
|
|
import { step } from 'framework/localTypes/Step';
|
|
|
|
export class PolicyInfoSubmittedPage extends InsuranceBasePage {
|
|
readonly page: Page;
|
|
readonly policyInfoMessage: Locator;
|
|
|
|
constructor(page: Page) {
|
|
super(page);
|
|
this.page = page;
|
|
this.policyInfoMessage = this.page.getByRole('heading', { name: 'Your policy and vehicle' });
|
|
}
|
|
|
|
async verifyPolicyInfoSubmitted(): Promise<void> {
|
|
await expect(this.policyInfoMessage).toBeVisible();
|
|
const policyInfoMessage = await this.policyInfoMessage.textContent();
|
|
expect(policyInfoMessage).toBe("Your policy and vehicle information has been submitted for coverage verification")
|
|
}
|
|
|
|
@step("PolicyInfoSubmittedPage >> Verify policy info submitted: ")
|
|
async handlePolicyInfoSubmittedPage() {
|
|
await this.verifyPolicyInfoSubmitted();
|
|
await this.nextPage();
|
|
}
|
|
} |