Browse Source

fix(playwright): form test logic

pull/5328/head
Wing-Kam Wong 2 years ago
parent
commit
bf5d0f19c7
  1. 7
      tests/playwright/pages/Dashboard/Form/index.ts

7
tests/playwright/pages/Dashboard/Form/index.ts

@ -153,6 +153,9 @@ export class FormPage extends BasePage {
async fillForm(param: { field: string; value: string }[]) { async fillForm(param: { field: string; value: string }[]) {
for (let i = 0; i < param.length; i++) { for (let i = 0; i < param.length; i++) {
await this.get()
.locator(`[data-testid="nc-form-input-${param[i].field.replace(' ', '')}"]`)
.click();
await this.get() await this.get()
.locator(`[data-testid="nc-form-input-${param[i].field.replace(' ', '')}"] >> input`) .locator(`[data-testid="nc-form-input-${param[i].field.replace(' ', '')}"] >> input`)
.fill(param[i].value); .fill(param[i].value);
@ -177,9 +180,7 @@ export class FormPage extends BasePage {
await this.getFormFieldsInputLabel().fill(label); await this.getFormFieldsInputLabel().fill(label);
await this.getFormFieldsInputHelpText().fill(helpText); await this.getFormFieldsInputHelpText().fill(helpText);
if (required) { if (required) {
await this.get() await this.getFormFieldsRequired().click();
.locator(`.nc-form-drag-${field.replace(' ', '')}`)
.click();
} }
await this.formHeading.click(); await this.formHeading.click();
} }

Loading…
Cancel
Save