feat(testing): Improved waiting for expanded form save

This commit is contained in:
Muhammed Mustafa
2022-10-28 16:43:29 +05:30
parent 592c94e9d1
commit d99c90773a
2 changed files with 11 additions and 3 deletions

View File

@@ -59,17 +59,24 @@ export class ExpandedFormPage extends BasePage {
waitForRowsData = true,
}: {
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) {
await this.waitForResponse({
uiAction: this.get().press("Escape"),
uiAction: saveRowAction,
requestUrlPathToMatch: 'api/v1/db/data/noco/',
httpMethodsToMatch: ['GET'],
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.toastWait({ message: `updated successfully.` });
await this.rootPage

View File

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