diff --git a/scripts/playwright/pages/Base.ts b/scripts/playwright/pages/Base.ts index e403a0979e..5ce15adaa9 100644 --- a/scripts/playwright/pages/Base.ts +++ b/scripts/playwright/pages/Base.ts @@ -16,8 +16,7 @@ export default abstract class BasePage { await this.rootPage .locator(".ant-message .ant-message-notice-content", { hasText: message }) .last() - .textContent() - .then((text) => expect(text).toContain(message)); + .isVisible(); // await this.rootPage // .locator(".ant-message .ant-message-notice-content", { hasText: message }) diff --git a/scripts/playwright/pages/Dashboard/Settings/Acl.ts b/scripts/playwright/pages/Dashboard/Settings/Acl.ts index 4060759921..e8d9346324 100644 --- a/scripts/playwright/pages/Dashboard/Settings/Acl.ts +++ b/scripts/playwright/pages/Dashboard/Settings/Acl.ts @@ -21,7 +21,11 @@ export class AclPage extends BasePage { } async save() { - this.get().locator(`button:has-text("Save")`).click(); + await this.waitForResponse({ + uiAction: this.get().locator(`button:has-text("Save")`).click(), + httpMethodsToMatch: ["POST"], + requestUrlPathToMatch: '/visibility-rules' + }) await this.toastWait({ message: "Updated UI ACL for tables successfully" }); } } diff --git a/scripts/playwright/pages/Dashboard/TreeView.ts b/scripts/playwright/pages/Dashboard/TreeView.ts index 6926ae40c9..5b69bf11a9 100644 --- a/scripts/playwright/pages/Dashboard/TreeView.ts +++ b/scripts/playwright/pages/Dashboard/TreeView.ts @@ -47,8 +47,8 @@ export class TreeViewPage extends BasePage { await this.waitForResponse({ uiAction: this.get().locator(`.nc-project-tree-tbl-${title}`).click(), httpMethodsToMatch: ["GET"], - requestUrlPathToMatch: `/api/v1/db/meta/tables/`, - responseJsonMatcher: (json) => json.title === title, + requestUrlPathToMatch: `/api/v1/db/data/noco/`, + responseJsonMatcher: (json) => json.pageInfo, }); await this.dashboard.waitForTabRender({ title, mode }); } diff --git a/scripts/playwright/pages/Dashboard/common/Toolbar/ViewMenu.ts b/scripts/playwright/pages/Dashboard/common/Toolbar/ViewMenu.ts index fa95f3a5d4..a333b44609 100644 --- a/scripts/playwright/pages/Dashboard/common/Toolbar/ViewMenu.ts +++ b/scripts/playwright/pages/Dashboard/common/Toolbar/ViewMenu.ts @@ -38,11 +38,11 @@ export class ToolbarViewMenuPage extends BasePage { ]); // Save downloaded file somewhere - await download.saveAs("./at.txt"); + await download.saveAs("./output/at.txt"); // verify downloaded content against expected content const expectedData = fs.readFileSync(expectedDataFile, "utf8"); - const file = fs.readFileSync("./at.txt", "utf8"); + const file = fs.readFileSync("./output/at.txt", "utf8"); await expect(file).toEqual(expectedData); } diff --git a/scripts/playwright/pages/Dashboard/common/Toolbar/index.ts b/scripts/playwright/pages/Dashboard/common/Toolbar/index.ts index 7a881e078a..7b6f2e0e3a 100644 --- a/scripts/playwright/pages/Dashboard/common/Toolbar/index.ts +++ b/scripts/playwright/pages/Dashboard/common/Toolbar/index.ts @@ -110,11 +110,11 @@ export class ToolbarPage extends BasePage { ]); // Save downloaded file somewhere - await download.saveAs("./at.txt"); + await download.saveAs("./output/at.txt"); // verify downloaded content against expected content const expectedData = fs.readFileSync("./fixtures/expectedData.txt", "utf8"); - const file = fs.readFileSync("./at.txt", "utf8"); + const file = fs.readFileSync("./output/at.txt", "utf8"); await expect(file).toEqual(expectedData); } diff --git a/scripts/playwright/pages/ProjectsPage/index.ts b/scripts/playwright/pages/ProjectsPage/index.ts index 295bbe7457..9c61da8d7f 100644 --- a/scripts/playwright/pages/ProjectsPage/index.ts +++ b/scripts/playwright/pages/ProjectsPage/index.ts @@ -163,5 +163,8 @@ export class ProjectsPage extends BasePage { requestUrlPathToMatch: 'api/v1/db/meta/projects/', httpMethodsToMatch: ['PATCH'], }); + + // todo: vue navigation breaks if page changes very quickly + await this.rootPage.waitForTimeout(1000); } } diff --git a/scripts/playwright/tests/01-webhook.spec.ts b/scripts/playwright/tests/01-webhook.spec.ts index 0a7061aac6..685f2006b3 100644 --- a/scripts/playwright/tests/01-webhook.spec.ts +++ b/scripts/playwright/tests/01-webhook.spec.ts @@ -20,17 +20,24 @@ async function clearServerData({ request }) { async function verifyHookTrigger(count: number, value: string, request) { // Retry since there can be lag between the time the hook is triggered and the time the server receives the request let response; - for (let i = 0; i < 6; i++) { + for (let i = 0; i < 20; i++) { response = await request.get(hookPath + "/count"); if ((await response.json()) === count) { break; } - await new Promise((resolve) => setTimeout(resolve, 100)); + await new Promise((resolve) => setTimeout(resolve, 150)); } await expect(await response.json()).toBe(count); if (count) { - response = await request.get(hookPath + "/last"); + let response; + for (let i = 0; i < 20; i++) { + response = await request.get(hookPath + "/last"); + if (((await response.json()).Title) === value) { + break; + } + await new Promise((resolve) => setTimeout(resolve, 150)); + } await expect((await response.json()).Title).toBe(value); } }