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); } async selectPartQuestionResponses(partQuestions: IPartQuestion[]) { for (const pq of partQuestions) { const escaped = pq.optionToSelect.replace(/"/g, '\\"'); const parentobject=this.page.locator(`fieldset[aria-labelledby="${pq.partQuestionType}"]`); const partQuestionOptionButton = parentobject.locator(`[buttonlabel="${escaped}"]`); await partQuestionOptionButton.nth(0).click(); if (pq.secondaryQuestionOptionToSelect != null) { const secondaryQuestionButton = parentobject.getByText(`${pq.secondaryQuestionOptionToSelect}`); await secondaryQuestionButton.nth(1).click(); } } } }