34 lines
No EOL
1.5 KiB
TypeScript
34 lines
No EOL
1.5 KiB
TypeScript
import { expect, type Locator, type Page } from "@playwright/test";
|
|
import { PartQuestionsPage } from "./PartQuestionsPage";
|
|
import { IPartQuestion } from '@business-logic/types/CustomerDetails';
|
|
|
|
export default class VehiclePartQuestionsPage extends PartQuestionsPage{
|
|
issPageValue = 'vehicle-parts';
|
|
|
|
constructor(page: Page) {
|
|
super(page);
|
|
}
|
|
/* this fails for some reason/some cases so may need to rework maybe only validate for part questions page and not on vehicle parts
|
|
async validatePartQuestions(partQuestions: IPartQuestion[]) {
|
|
for (const pq of partQuestions) {
|
|
const partQuestionOptions = this.page.locator(`fieldset[aria-labelledby="${pq.partQuestionType}"]`);
|
|
if (pq.isOnPage) {
|
|
await expect(partQuestionOptions).toBeAttached();
|
|
} else {
|
|
await expect(partQuestionOptions).not.toBeAttached();
|
|
}
|
|
}
|
|
}
|
|
*/
|
|
async selectPartQuestionResponses(partQuestions: IPartQuestion[]) {
|
|
for (const pq of partQuestions) {
|
|
const parentobject=this.page.locator(`fieldset[aria-labelledby="${pq.partQuestionType}"]`);
|
|
const partQuestionOptionButton = parentobject.locator(`[buttonlabel="${pq.optionToSelect}"]`);
|
|
await partQuestionOptionButton.nth(0).click();
|
|
if (pq.secondaryQuestionOptionToSelect != null) {
|
|
const secondaryQuestionButton = parentobject.getByText(`${pq.secondaryQuestionOptionToSelect}`);
|
|
await secondaryQuestionButton.nth(1).click();
|
|
}
|
|
}
|
|
}
|
|
} |