Add and fix validation for TPA flow
This commit is contained in:
parent
e25466cd07
commit
e537e41c98
3 changed files with 43 additions and 16 deletions
|
|
@ -4,16 +4,30 @@ import { BasePage } from './BasePage';
|
||||||
export class TpaConfirmationPage extends BasePage {
|
export class TpaConfirmationPage extends BasePage {
|
||||||
readonly page: Page;
|
readonly page: Page;
|
||||||
readonly successMessage: Locator;
|
readonly successMessage: Locator;
|
||||||
|
readonly shopConfirmationMessage: Locator;
|
||||||
readonly issPageValue = 'tpa-confirmation';
|
readonly issPageValue = 'tpa-confirmation';
|
||||||
|
|
||||||
constructor(page: Page) {
|
constructor(page: Page) {
|
||||||
super(page);
|
super(page);
|
||||||
this.page = page;
|
this.page = page;
|
||||||
this.successMessage = page.getByText('Success');
|
this.successMessage = page.getByText('Thank you for submitting your claim; there is one final step.');
|
||||||
|
this.shopConfirmationMessage = page.locator('div.subheader').first()
|
||||||
|
}
|
||||||
|
|
||||||
|
async getTpaShopSelectedName() {
|
||||||
|
const sessionStorage = JSON.parse(await this.page.evaluate('sessionStorage.getItem(\'submittedOrder\')'));
|
||||||
|
const tpaShopSelectedName = sessionStorage.serviceLocation.provider.companyName;
|
||||||
|
return tpaShopSelectedName;
|
||||||
}
|
}
|
||||||
|
|
||||||
async validateSuccessMessage() {
|
async validateSuccessMessage() {
|
||||||
await expect(this.successMessage).toBeVisible();
|
const shopConfirmationMessageText = await this.shopConfirmationMessage.textContent();
|
||||||
}
|
const tpaShopSelectedNameText = await this.getTpaShopSelectedName();
|
||||||
|
|
||||||
|
await this.successMessage.waitFor({ state: 'visible' });
|
||||||
|
await expect(this.successMessage).toBeVisible();
|
||||||
|
expect.soft(shopConfirmationMessageText?.toLowerCase()).toContain(
|
||||||
|
('Your information has been sent to' + ' ' + tpaShopSelectedNameText).toLowerCase()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4,20 +4,13 @@ import { BasePage } from './BasePage';
|
||||||
export class TpaSearchPage extends BasePage {
|
export class TpaSearchPage extends BasePage {
|
||||||
readonly page: Page;
|
readonly page: Page;
|
||||||
readonly firstLocationButton: Locator;
|
readonly firstLocationButton: Locator;
|
||||||
readonly doNotSeeMyShopButton: Locator;
|
//readonly doNotSeeMyShopButton: Locator;
|
||||||
issPageValue = 'tpa-search';
|
issPageValue = 'tpa-search';
|
||||||
|
|
||||||
constructor(page: Page) {
|
constructor(page: Page) {
|
||||||
super(page);
|
super(page);
|
||||||
this.page = page;
|
this.page = page;
|
||||||
// this.firstLocationButton = page.locator("fieldset[aria-labelledby='chooseShop']/span").first();
|
this.firstLocationButton = page.locator('div.button-content').first();
|
||||||
this.firstLocationButton = page.locator("#buttonLabelSpan").first();
|
|
||||||
|
|
||||||
this.doNotSeeMyShopButton = page.getByRole('link', { name: 'I don\'t see my shop' });
|
|
||||||
}
|
|
||||||
|
|
||||||
async selectDoNotSeeMyShop() {
|
|
||||||
await this.doNotSeeMyShopButton.click()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async selectFirstLocation() {
|
async selectFirstLocation() {
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,38 @@
|
||||||
import { expect, type Locator, type Page } from '@playwright/test';
|
import { expect, type Locator, type Page } from '@playwright/test';
|
||||||
import { BasePage } from './BasePage';
|
import { BasePage } from './BasePage';
|
||||||
|
import { IClaimDetails } from '@business-logic/types/CustomerDetails';
|
||||||
|
|
||||||
export class TpaSubmitPage extends BasePage {
|
export class TpaSubmitPage extends BasePage {
|
||||||
readonly page: Page;
|
readonly page: Page;
|
||||||
readonly deductible: Locator;
|
readonly deductible: Locator;
|
||||||
|
readonly recalAlert: Locator;
|
||||||
|
readonly learnMoreLink: Locator;
|
||||||
|
readonly recalModal: Locator;
|
||||||
|
readonly closeRecalModalButton: Locator;
|
||||||
issPageValue = 'tpa-submit';
|
issPageValue = 'tpa-submit';
|
||||||
|
|
||||||
constructor(page: Page) {
|
constructor(page: Page) {
|
||||||
super(page);
|
super(page);
|
||||||
this.page = page;
|
this.page = page;
|
||||||
this.deductible = page.getByText('Deductible $');
|
this.recalAlert = page.getByRole('alert').filter({ hasText: 'Some vehicle safety features may not work properly.'});
|
||||||
|
this.learnMoreLink = page.getByRole('link', { name: 'Learn more' });
|
||||||
|
this.recalModal = page.getByRole('dialog').filter({ hasText: 'IMPORTANT SERVICE REQUIRED' }).first();
|
||||||
|
this.closeRecalModalButton = page.locator('.modalbtn', { hasText: 'Close' });
|
||||||
|
this.deductible = page.locator('span#deductible-value, span.deductible-value');
|
||||||
}
|
}
|
||||||
|
|
||||||
async validateDeductible(expDeductible) {
|
/* TODO: Fix flakiness of recal alert
|
||||||
await expect(this.deductible).toContainText(expDeductible);
|
/*async validateRecalAlert() {
|
||||||
|
await this.recalAlert.waitFor({ state: 'visible', timeout: 5000 });
|
||||||
|
await this.learnMoreLink.click();
|
||||||
|
await this.recalModal.waitFor({ state: 'visible', timeout: 5000 });
|
||||||
|
await this.recalModal.getByRole('button', { name: 'Close' }).click();
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
async validateDeductible(claimDetails: IClaimDetails) {
|
||||||
|
await expect(this.deductible).toContainText(claimDetails.policyDeductible.toLocaleString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Validate change preferred shop and contact details flows
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue