|
|
@ -10,8 +10,7 @@ export class FormPage extends BasePage { |
|
|
|
readonly topbar: TopbarPage; |
|
|
|
readonly topbar: TopbarPage; |
|
|
|
|
|
|
|
|
|
|
|
// todo: All the locator should be private
|
|
|
|
// todo: All the locator should be private
|
|
|
|
readonly addAllButton: Locator; |
|
|
|
readonly addOrRemoveAllButton: Locator; |
|
|
|
readonly removeAllButton: Locator; |
|
|
|
|
|
|
|
readonly submitButton: Locator; |
|
|
|
readonly submitButton: Locator; |
|
|
|
|
|
|
|
|
|
|
|
readonly showAnotherFormRadioButton: Locator; |
|
|
|
readonly showAnotherFormRadioButton: Locator; |
|
|
@ -30,8 +29,10 @@ export class FormPage extends BasePage { |
|
|
|
this.toolbar = new ToolbarPage(this); |
|
|
|
this.toolbar = new ToolbarPage(this); |
|
|
|
this.topbar = new TopbarPage(this); |
|
|
|
this.topbar = new TopbarPage(this); |
|
|
|
|
|
|
|
|
|
|
|
this.addAllButton = dashboard.get().locator('[data-testid="nc-form-show-all-fields"]').locator('.nc-switch'); |
|
|
|
this.addOrRemoveAllButton = dashboard |
|
|
|
this.removeAllButton = dashboard.get().locator('[data-testid="nc-form-show-all-fields"]').locator('.nc-switch'); |
|
|
|
.get() |
|
|
|
|
|
|
|
.locator('[data-testid="nc-form-show-all-fields"]') |
|
|
|
|
|
|
|
.locator('.nc-switch'); |
|
|
|
this.submitButton = dashboard.get().locator('[data-testid="nc-form-submit"]'); |
|
|
|
this.submitButton = dashboard.get().locator('[data-testid="nc-form-submit"]'); |
|
|
|
|
|
|
|
|
|
|
|
this.showAnotherFormRadioButton = dashboard.get().locator('[data-testid="nc-form-checkbox-submit-another-form"]'); |
|
|
|
this.showAnotherFormRadioButton = dashboard.get().locator('[data-testid="nc-form-checkbox-submit-another-form"]'); |
|
|
@ -40,8 +41,8 @@ export class FormPage extends BasePage { |
|
|
|
.locator('[data-testid="nc-form-checkbox-show-blank-form"]'); |
|
|
|
.locator('[data-testid="nc-form-checkbox-show-blank-form"]'); |
|
|
|
this.emailMeRadioButton = dashboard.get().locator('[data-testid="nc-form-checkbox-send-email"]'); |
|
|
|
this.emailMeRadioButton = dashboard.get().locator('[data-testid="nc-form-checkbox-send-email"]'); |
|
|
|
this.formHeading = dashboard.get().locator('[data-testid="nc-form-heading"]'); |
|
|
|
this.formHeading = dashboard.get().locator('[data-testid="nc-form-heading"]'); |
|
|
|
this.formSubHeading = dashboard.get().locator('[data-testid="nc-form-sub-heading"]'); |
|
|
|
this.formSubHeading = dashboard.get().locator('[data-testid="nc-form-sub-heading"] .tiptap.ProseMirror'); |
|
|
|
this.afterSubmitMsg = dashboard.get().locator('[data-testid="nc-form-after-submit-msg"]'); |
|
|
|
this.afterSubmitMsg = dashboard.get().locator('[data-testid="nc-form-after-submit-msg"] .tiptap.ProseMirror'); |
|
|
|
|
|
|
|
|
|
|
|
this.formFields = dashboard.get().locator('.nc-form-fields-list'); |
|
|
|
this.formFields = dashboard.get().locator('.nc-form-fields-list'); |
|
|
|
} |
|
|
|
} |
|
|
@ -67,7 +68,7 @@ export class FormPage extends BasePage { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
getFormFieldsInputHelpText() { |
|
|
|
getFormFieldsInputHelpText() { |
|
|
|
return this.get().locator('textarea[data-testid="nc-form-input-help-text"]:visible'); |
|
|
|
return this.get().locator('[data-testid="nc-form-input-help-text"] .tiptap.ProseMirror:visible'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async verifyFormFieldLabel({ index, label }: { index: number; label: string }) { |
|
|
|
async verifyFormFieldLabel({ index, label }: { index: number; label: string }) { |
|
|
@ -83,7 +84,7 @@ export class FormPage extends BasePage { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async verifyAfterSubmitMsg({ msg }: { msg: string }) { |
|
|
|
async verifyAfterSubmitMsg({ msg }: { msg: string }) { |
|
|
|
expect((await this.afterSubmitMsg.inputValue()).includes(msg)).toBeTruthy(); |
|
|
|
expect((await this.afterSubmitMsg.textContent()).includes(msg)).toBeTruthy(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async verifyFormViewFieldsOrder({ fields }: { fields: string[] }) { |
|
|
|
async verifyFormViewFieldsOrder({ fields }: { fields: string[] }) { |
|
|
@ -136,11 +137,18 @@ export class FormPage extends BasePage { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async removeAllFields() { |
|
|
|
async removeAllFields() { |
|
|
|
await this.removeAllButton.click(); |
|
|
|
if (await this.addOrRemoveAllButton.isChecked()) { |
|
|
|
|
|
|
|
await this.addOrRemoveAllButton.click(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
await this.addOrRemoveAllButton.click(); |
|
|
|
|
|
|
|
await this.addOrRemoveAllButton.click(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async addAllFields() { |
|
|
|
async addAllFields() { |
|
|
|
await this.addAllButton.click(); |
|
|
|
if (!(await this.addOrRemoveAllButton.isChecked())) { |
|
|
|
|
|
|
|
await this.addOrRemoveAllButton.click(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async configureHeader(param: { subtitle: string; title: string }) { |
|
|
|
async configureHeader(param: { subtitle: string; title: string }) { |
|
|
@ -166,7 +174,7 @@ export class FormPage extends BasePage { |
|
|
|
|
|
|
|
|
|
|
|
async verifyHeader(param: { subtitle: string; title: string }) { |
|
|
|
async verifyHeader(param: { subtitle: string; title: string }) { |
|
|
|
await expect.poll(async () => await this.formHeading.inputValue()).toBe(param.title); |
|
|
|
await expect.poll(async () => await this.formHeading.inputValue()).toBe(param.title); |
|
|
|
await expect.poll(async () => await this.formSubHeading.inputValue()).toBe(param.subtitle); |
|
|
|
await expect.poll(async () => await this.formSubHeading.textContent()).toBe(param.subtitle); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async fillForm(param: { field: string; value: string }[]) { |
|
|
|
async fillForm(param: { field: string; value: string }[]) { |
|
|
@ -233,7 +241,7 @@ export class FormPage extends BasePage { |
|
|
|
|
|
|
|
|
|
|
|
const fieldHelpText = this.get() |
|
|
|
const fieldHelpText = this.get() |
|
|
|
.locator(`.nc-form-drag-${field.replace(' ', '')}`) |
|
|
|
.locator(`.nc-form-drag-${field.replace(' ', '')}`) |
|
|
|
.locator('div[data-testid="nc-form-input-help-text-label"]'); |
|
|
|
.locator('div[data-testid="nc-form-input-help-text-label"] .tiptap.ProseMirror'); |
|
|
|
await expect(fieldHelpText).toHaveText(helpText); |
|
|
|
await expect(fieldHelpText).toHaveText(helpText); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|