From bf5d0f19c7b13a6c86266d5671b560d5142d5690 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Tue, 21 Mar 2023 12:21:30 +0800 Subject: [PATCH] fix(playwright): form test logic --- tests/playwright/pages/Dashboard/Form/index.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/playwright/pages/Dashboard/Form/index.ts b/tests/playwright/pages/Dashboard/Form/index.ts index b04ac3326f..cdade835c9 100644 --- a/tests/playwright/pages/Dashboard/Form/index.ts +++ b/tests/playwright/pages/Dashboard/Form/index.ts @@ -153,6 +153,9 @@ export class FormPage extends BasePage { async fillForm(param: { field: string; value: string }[]) { 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() .locator(`[data-testid="nc-form-input-${param[i].field.replace(' ', '')}"] >> input`) .fill(param[i].value); @@ -177,9 +180,7 @@ export class FormPage extends BasePage { await this.getFormFieldsInputLabel().fill(label); await this.getFormFieldsInputHelpText().fill(helpText); if (required) { - await this.get() - .locator(`.nc-form-drag-${field.replace(' ', '')}`) - .click(); + await this.getFormFieldsRequired().click(); } await this.formHeading.click(); }