DigitalConsumer.ISS/playwright-tests/pages/PartQuestionsPage.ts
Siraj Shaik 6d5a0524e3 latest updates from QA repo
21 and 22 scenarios were added
Mock responses refactored.
2025-02-18 14:41:05 -05:00

36 lines
1.4 KiB
TypeScript

import { expect, type Locator, type Page } from '@playwright/test';
import { BasePage } from './BasePage';
import { IPartQuestion } from '@business-logic/types/CustomerDetails';
export class PartQuestionsPage extends BasePage {
readonly page: Page;
url = process.env['BASE_URL']! + '/?issPage=part-questions';
constructor(page: Page) {
super(page);
this.page = page;
}
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.click();
if (pq.secondaryQuestionOptionToSelect != null) {
const secondaryQuestionButton = parentobject.getByText(`${pq.secondaryQuestionOptionToSelect}`);
await secondaryQuestionButton.click();
}
}
}
}