Browse Source

feat(testing): Improved waiting for expanded form save

pull/3848/head
Muhammed Mustafa 2 years ago
parent
commit
d99c90773a
  1. 13
      scripts/playwright/pages/Dashboard/ExpandedForm/index.ts
  2. 1
      scripts/playwright/pages/Dashboard/Settings/index.ts

13
scripts/playwright/pages/Dashboard/ExpandedForm/index.ts

@ -59,17 +59,24 @@ export class ExpandedFormPage extends BasePage {
waitForRowsData = true, waitForRowsData = true,
}: { }: {
waitForRowsData?: boolean; waitForRowsData?: boolean;
}) { } = {}) {
await this.get().locator('button:has-text("Save Row")').click(); const saveRowAction = this.get().locator('button:has-text("Save Row")').click();
if(waitForRowsData) { if(waitForRowsData) {
await this.waitForResponse({ await this.waitForResponse({
uiAction: this.get().press("Escape"), uiAction: saveRowAction,
requestUrlPathToMatch: 'api/v1/db/data/noco/', requestUrlPathToMatch: 'api/v1/db/data/noco/',
httpMethodsToMatch: ['GET'], httpMethodsToMatch: ['GET'],
responseJsonMatcher: (json) => json['pageInfo'], responseJsonMatcher: (json) => json['pageInfo'],
}); });
} else {
await this.waitForResponse({
uiAction: saveRowAction,
requestUrlPathToMatch: 'api/v1/db/data/noco/',
httpMethodsToMatch: ['POST'],
});
} }
await this.get().press("Escape");
await this.get().waitFor({ state: "hidden" }); await this.get().waitFor({ state: "hidden" });
await this.toastWait({ message: `updated successfully.` }); await this.toastWait({ message: `updated successfully.` });
await this.rootPage await this.rootPage

1
scripts/playwright/pages/Dashboard/Settings/index.ts

@ -65,5 +65,6 @@ export class SettingsPage extends BasePage {
async close() { async close() {
await this.get().locator('[pw-data="settings-modal-close-button"]').click(); await this.get().locator('[pw-data="settings-modal-close-button"]').click();
await this.get().waitFor({ state: "hidden" });
} }
} }

Loading…
Cancel
Save