Browse Source

fix(playwright): add waitForResponse after goto

pull/5903/head
Wing-Kam Wong 1 year ago
parent
commit
a22ab9b350
  1. 9
      tests/playwright/pages/Account/License.ts
  2. 4
      tests/playwright/setup/index.ts

9
tests/playwright/pages/Account/License.ts

@ -10,14 +10,11 @@ export class AccountLicensePage extends BasePage {
} }
async goto() { async goto() {
return this.waitForResponse({ await this.rootPage.goto(`/#/account/license`);
uiAction: async () => await this.rootPage.goto('/#/account/license'), await this.waitUntilContentLoads();
httpMethodsToMatch: ['GET'],
requestUrlPathToMatch: 'api/v1/license',
});
} }
waitUntilContentLoads() { async waitUntilContentLoads() {
return this.rootPage.waitForResponse(resp => resp.url().includes('api/v1/license') && resp.status() === 200); return this.rootPage.waitForResponse(resp => resp.url().includes('api/v1/license') && resp.status() === 200);
} }

4
tests/playwright/setup/index.ts

@ -81,6 +81,10 @@ const setup = async ({ page, isEmptyProject }: { page: Page; isEmptyProject?: bo
await page.goto(`/#/nc/${project.id}/auth`); await page.goto(`/#/nc/${project.id}/auth`);
await page.waitForResponse(
resp => resp.url().includes(`api/v1/db/meta/projects/${project.id}/users`) && resp.status() === 200
);
return { project, token, dbType, workerId } as NcContext; return { project, token, dbType, workerId } as NcContext;
}; };

Loading…
Cancel
Save