Browse Source

test: survey form

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/5363/head
Raju Udava 2 years ago
parent
commit
fe7183864e
  1. 14
      tests/playwright/pages/Dashboard/SurveyForm/index.ts

14
tests/playwright/pages/Dashboard/SurveyForm/index.ts

@ -1,5 +1,6 @@
import { expect, Locator, Page } from '@playwright/test';
import BasePage from '../../Base';
import { getTextExcludeIconText } from '../../../tests/utils/general';
export class SurveyFormPage extends BasePage {
readonly formHeading: Locator;
@ -42,7 +43,15 @@ export class SurveyFormPage extends BasePage {
await expect(this.formHeading).toHaveText(heading);
await expect(this.formSubHeading).toHaveText(subHeading);
await expect(this.formFooter).toHaveText(footer);
await expect(this.get().locator(`[data-testid="nc-form-column-label"]`)).toHaveText(fieldLabel);
const locator = this.get().locator(`[data-testid="nc-form-column-label"]`);
let fieldText = await getTextExcludeIconText(locator);
// replace whitespace with ' ' for fieldLabel & fieldText
fieldLabel = fieldLabel.replace(/\u00A0/g, ' ');
fieldText = fieldText.replace(/\u00A0/g, ' ');
await expect(fieldText).toBe(fieldLabel);
// parse footer text ("1 / 3") to identify if last slide
let isLastSlide = false;
@ -73,6 +82,9 @@ export class SurveyFormPage extends BasePage {
await modal.locator('.ant-picker-ok').click();
await this.nextButton.click();
}
// post next button click, allow transitions to complete
await this.rootPage.waitForTimeout(100);
}
async validateSuccessMessage(param: { message: string; showAnotherForm?: boolean }) {

Loading…
Cancel
Save