From c019e8256159a8d372445a73516981c1b8672149 Mon Sep 17 00:00:00 2001 From: Guy Korland Date: Tue, 21 Jan 2025 16:21:19 +0200 Subject: [PATCH 01/17] upgrade to node22 --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index db11d29c..dfd37408 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:18-alpine AS base +FROM node:22-alpine AS base # Install dependencies only when needed FROM base AS deps @@ -68,4 +68,4 @@ ENV HOSTNAME "0.0.0.0" # server.js is created by next build from the standalone output # https://nextjs.org/docs/pages/api-reference/next-config-js/output -CMD ["node", "server.js"] \ No newline at end of file +CMD ["node", "server.js"] From 97206a44022a38b576f5a5edf3f45da0f0b70250 Mon Sep 17 00:00:00 2001 From: Guy Korland Date: Tue, 21 Jan 2025 16:23:28 +0200 Subject: [PATCH 02/17] upgrade to node22 --- .github/workflows/nextjs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nextjs.yml b/.github/workflows/nextjs.yml index e86401d4..0bffc7d2 100644 --- a/.github/workflows/nextjs.yml +++ b/.github/workflows/nextjs.yml @@ -36,7 +36,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v3 with: - node-version: "18" + node-version: "22" cache: ${{ steps.detect-package-manager.outputs.manager }} - name: Restore cache From a63aef2988cb2ef24457eab75be559451e7a9117 Mon Sep 17 00:00:00 2001 From: Naseem Ali <34807727+Naseem77@users.noreply.github.com> Date: Wed, 22 Jan 2025 18:25:19 +0200 Subject: [PATCH 03/17] Update auth.setup.ts --- e2e/tests/auth.setup.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/e2e/tests/auth.setup.ts b/e2e/tests/auth.setup.ts index 97c85499..f516bc55 100644 --- a/e2e/tests/auth.setup.ts +++ b/e2e/tests/auth.setup.ts @@ -13,6 +13,7 @@ setup("admin authentication", async () => { try { const browserWrapper = new BrowserWrapper(); const loginPage = await browserWrapper.createNewPage(LoginPage, urls.loginUrl); + await browserWrapper.setPageToFullScreen(); await loginPage.clickOnConnect(); await loginPage.dismissDialogAtStart(); const context = browserWrapper.getContext(); @@ -37,6 +38,7 @@ userRoles.forEach(({ name, file, userName }) => { try { const browserWrapper = new BrowserWrapper(); const loginPage = await browserWrapper.createNewPage(LoginPage, urls.loginUrl); + await browserWrapper.setPageToFullScreen(); await loginPage.connectWithCredentials(userName, user.password); await loginPage.dismissDialogAtStart(); const context = browserWrapper.getContext(); From ac6baf6918bf7307a4e846bc452c21dbae2ae71d Mon Sep 17 00:00:00 2001 From: Naseem Ali <34807727+Naseem77@users.noreply.github.com> Date: Wed, 22 Jan 2025 19:51:13 +0200 Subject: [PATCH 04/17] update config settings tests --- e2e/config/settingsConfigData.json | 2 +- e2e/tests/settingsConfig.spec.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/e2e/config/settingsConfigData.json b/e2e/config/settingsConfigData.json index ae70e255..3616177e 100644 --- a/e2e/config/settingsConfigData.json +++ b/e2e/config/settingsConfigData.json @@ -35,7 +35,7 @@ {"role": "QUERY_MEM_CAPACITY", "description": "modify queryMemCapacity", "input": "20", "expected": true}, {"role": "VKEY_MAX_ENTITY_COUNT", "description": "modify vKeyMaxEntityCount", "input": "20", "expected": true}, {"role": "CMD_INFO", "description": "modify cmdInfo", "input": "yes", "expected": true}, - {"role": "MAX_INFO_QUERIES", "description": "modify maxInfoQueries", "input": "20", "expected": true} + {"role": "MAX_INFO_QUERIES", "description": "modify maxInfoQueries", "input": "999", "expected": true} ] } \ No newline at end of file diff --git a/e2e/tests/settingsConfig.spec.ts b/e2e/tests/settingsConfig.spec.ts index 9b36bb4a..30417fd5 100644 --- a/e2e/tests/settingsConfig.spec.ts +++ b/e2e/tests/settingsConfig.spec.ts @@ -25,6 +25,7 @@ test.describe('Settings Tests', () => { await apiCall.modifySettingsRole(roles.maxQueuedQueries, input) await settingsConfigPage.refreshPage() const value = await settingsConfigPage.getRoleContentValue(roles.maxQueuedQueries) + await apiCall.modifySettingsRole(roles.maxTimeOut, "25") expect(value === input).toBe(expected) }); }) @@ -36,6 +37,7 @@ test.describe('Settings Tests', () => { await apiCall.modifySettingsRole(roles.maxTimeOut, input) await settingsConfigPage.refreshPage() const value = await settingsConfigPage.getRoleContentValue(roles.maxTimeOut) + await apiCall.modifySettingsRole(roles.maxTimeOut, "0") expect(value === input).toBe(expected) }); }) @@ -47,6 +49,7 @@ test.describe('Settings Tests', () => { await apiCall.modifySettingsRole(roles.defaultTimeOut, input) await settingsConfigPage.refreshPage() const value = await settingsConfigPage.getRoleContentValue(roles.defaultTimeOut) + await apiCall.modifySettingsRole(roles.maxTimeOut, "0") expect(value === input).toBe(expected) }); }) @@ -58,6 +61,7 @@ test.describe('Settings Tests', () => { await apiCall.modifySettingsRole(roles.resultSetSize, input) await settingsConfigPage.refreshPage() const value = await settingsConfigPage.getRoleContentValue(roles.resultSetSize) + await apiCall.modifySettingsRole(roles.maxTimeOut, "1000") expect(value === input).toBe(expected) }); }) @@ -81,6 +85,7 @@ test.describe('Settings Tests', () => { await apiCall.modifySettingsRole(roles.vKeyMaxEntityCount, input) await settingsConfigPage.refreshPage() const value = await settingsConfigPage.getRoleContentValue(roles.vKeyMaxEntityCount) + await apiCall.modifySettingsRole(roles.queryMemCapacity, "100000") expect(value === input).toBe(expected) }); }) @@ -92,6 +97,7 @@ test.describe('Settings Tests', () => { await apiCall.modifySettingsRole(roles.cmdInfo, input) await settingsConfigPage.refreshPage() const value = await settingsConfigPage.getRoleContentValue(roles.cmdInfo) + await apiCall.modifySettingsRole(roles.queryMemCapacity, "yes") expect(value === input).toBe(expected) }); }) @@ -103,6 +109,7 @@ test.describe('Settings Tests', () => { await apiCall.modifySettingsRole(roles.maxInfoQueries, input) await settingsConfigPage.refreshPage() const value = await settingsConfigPage.getRoleContentValue(roles.maxInfoQueries) + await apiCall.modifySettingsRole(roles.queryMemCapacity, "1000") expect(value === input).toBe(expected) }); }) From 5a75ad85b39e0b3b1be5f11c1efad9ad3f5d05c8 Mon Sep 17 00:00:00 2001 From: Naseem Ali <34807727+Naseem77@users.noreply.github.com> Date: Mon, 27 Jan 2025 12:27:27 +0200 Subject: [PATCH 05/17] update config tests --- e2e/config/settingsConfigData.json | 14 ++--- e2e/tests/settingsConfig.spec.ts | 87 +++++++++++++++++++----------- 2 files changed, 63 insertions(+), 38 deletions(-) diff --git a/e2e/config/settingsConfigData.json b/e2e/config/settingsConfigData.json index 3616177e..69d7c96c 100644 --- a/e2e/config/settingsConfigData.json +++ b/e2e/config/settingsConfigData.json @@ -28,13 +28,13 @@ { "input": "yes", "description": "valid input - yes value", "expected": true } ], "roleModificationData": [ - {"role": "MAX_QUEUED_QUERIES", "description": "modify maxQueuedQueries", "input": "20", "expected": true}, - {"role": "TIMEOUT_MAX", "description": "modify maxTimeOut", "input": "25", "expected": true}, - {"role": "TIMEOUT_DEFAULT", "description": "modify defaultTimeOut", "input": "10", "expected": true}, - {"role": "RESULTSET_SIZE", "description": "modify resultSetSize", "input": "20", "expected": true}, - {"role": "QUERY_MEM_CAPACITY", "description": "modify queryMemCapacity", "input": "20", "expected": true}, - {"role": "VKEY_MAX_ENTITY_COUNT", "description": "modify vKeyMaxEntityCount", "input": "20", "expected": true}, - {"role": "CMD_INFO", "description": "modify cmdInfo", "input": "yes", "expected": true}, + {"role": "MAX_QUEUED_QUERIES", "description": "modify maxQueuedQueries", "input": "24", "expected": true}, + {"role": "TIMEOUT_MAX", "description": "modify maxTimeOut", "input": "1", "expected": true}, + {"role": "TIMEOUT_DEFAULT", "description": "modify defaultTimeOut", "input": "1", "expected": true}, + {"role": "RESULTSET_SIZE", "description": "modify resultSetSize", "input": "10001", "expected": true}, + {"role": "QUERY_MEM_CAPACITY", "description": "modify queryMemCapacity", "input": "1", "expected": true}, + {"role": "VKEY_MAX_ENTITY_COUNT", "description": "modify vKeyMaxEntityCount", "input": "100001", "expected": true}, + {"role": "CMD_INFO", "description": "modify cmdInfo", "input": "no", "expected": true}, {"role": "MAX_INFO_QUERIES", "description": "modify maxInfoQueries", "input": "999", "expected": true} ] } diff --git a/e2e/tests/settingsConfig.spec.ts b/e2e/tests/settingsConfig.spec.ts index 30417fd5..a8d15510 100644 --- a/e2e/tests/settingsConfig.spec.ts +++ b/e2e/tests/settingsConfig.spec.ts @@ -17,7 +17,7 @@ test.describe('Settings Tests', () => { await browser.closeBrowser(); }) - Data.inputDataRejectsZero.forEach(({ input, description, expected }) => { + Data.inputDataRejectsZero.forEach(({ input, description, expected }, index) => { test(`@admin Modify ${roles.maxQueuedQueries} via API validation via UI: Input value: ${input} description: ${description}`, async () => { const settingsConfigPage = await browser.createNewPage(SettingsConfigPage, urls.settingsUrl) const apiCall = new ApiCalls() @@ -25,109 +25,134 @@ test.describe('Settings Tests', () => { await apiCall.modifySettingsRole(roles.maxQueuedQueries, input) await settingsConfigPage.refreshPage() const value = await settingsConfigPage.getRoleContentValue(roles.maxQueuedQueries) - await apiCall.modifySettingsRole(roles.maxTimeOut, "25") - expect(value === input).toBe(expected) + expect(value === input).toBe(expected); + if (index === Data.inputDataRejectsZero.length - 1) { + await apiCall.modifySettingsRole(roles.maxQueuedQueries, "25") + } }); }) - Data.maxTimeOut.forEach(({ input, description, expected }) => { + Data.maxTimeOut.forEach(({ input, description, expected }, index) => { test(`@admin Modify ${roles.maxTimeOut} via API validation via UI: Input value: ${input} description: ${description}`, async () => { const settingsConfigPage = await browser.createNewPage(SettingsConfigPage, urls.settingsUrl) const apiCall = new ApiCalls() await apiCall.modifySettingsRole(roles.maxTimeOut, input) await settingsConfigPage.refreshPage() const value = await settingsConfigPage.getRoleContentValue(roles.maxTimeOut) - await apiCall.modifySettingsRole(roles.maxTimeOut, "0") - expect(value === input).toBe(expected) + expect(value === input).toBe(expected); + if (index === Data.maxTimeOut.length - 1) { + await apiCall.modifySettingsRole(roles.maxTimeOut, "0") + } }); }) - Data.inputDataAcceptsZero.forEach(({ input, description, expected }) => { + Data.inputDataAcceptsZero.forEach(({ input, description, expected }, index) => { test(`@admin Modify ${roles.defaultTimeOut} via API validation via UI: Input value: ${input} description: ${description}`, async () => { const settingsConfigPage = await browser.createNewPage(SettingsConfigPage, urls.settingsUrl) const apiCall = new ApiCalls() await apiCall.modifySettingsRole(roles.defaultTimeOut, input) await settingsConfigPage.refreshPage() const value = await settingsConfigPage.getRoleContentValue(roles.defaultTimeOut) - await apiCall.modifySettingsRole(roles.maxTimeOut, "0") - expect(value === input).toBe(expected) + expect(value === input).toBe(expected); + if (index === Data.inputDataAcceptsZero.length - 1) { + await apiCall.modifySettingsRole(roles.defaultTimeOut, "0") + } }); }) - Data.inputDataAcceptsZero.forEach(({ input, description, expected }) => { + Data.inputDataAcceptsZero.forEach(({ input, description, expected }, index) => { test(`@admin Modify ${roles.resultSetSize} via API validation via UI: Input value: ${input} description: ${description}`, async () => { const settingsConfigPage = await browser.createNewPage(SettingsConfigPage, urls.settingsUrl) const apiCall = new ApiCalls() await apiCall.modifySettingsRole(roles.resultSetSize, input) await settingsConfigPage.refreshPage() const value = await settingsConfigPage.getRoleContentValue(roles.resultSetSize) - await apiCall.modifySettingsRole(roles.maxTimeOut, "1000") - expect(value === input).toBe(expected) + expect(value === input).toBe(expected); + if (index === Data.inputDataAcceptsZero.length - 1) { + await apiCall.modifySettingsRole(roles.resultSetSize, "10000") + } }); }) - Data.inputDataAcceptsZero.forEach(({ input, description, expected }) => { + Data.inputDataAcceptsZero.forEach(({ input, description, expected }, index) => { test(`@admin Modify ${roles.queryMemCapacity} via API validation via UI: Input value: ${input} description: ${description}`, async () => { const settingsConfigPage = await browser.createNewPage(SettingsConfigPage, urls.settingsUrl) const apiCall = new ApiCalls() await apiCall.modifySettingsRole(roles.queryMemCapacity, input) await settingsConfigPage.refreshPage() - const value = await settingsConfigPage.getRoleContentValue(roles.queryMemCapacity) - await apiCall.modifySettingsRole(roles.queryMemCapacity, "0") // update to default values - expect(value === input).toBe(expected) + const value = await settingsConfigPage.getRoleContentValue(roles.queryMemCapacity) + expect(value === input).toBe(expected); + if (index === Data.inputDataAcceptsZero.length - 1) { + await apiCall.modifySettingsRole(roles.queryMemCapacity, "0") + } }); }) - Data.inputDataAcceptsZero.forEach(({ input, description, expected }) => { + Data.inputDataAcceptsZero.forEach(({ input, description, expected }, index) => { test(`@admin Modify ${roles.vKeyMaxEntityCount} via API validation via UI: Input value: ${input} description: ${description}`, async () => { const settingsConfigPage = await browser.createNewPage(SettingsConfigPage, urls.settingsUrl) const apiCall = new ApiCalls() await apiCall.modifySettingsRole(roles.vKeyMaxEntityCount, input) await settingsConfigPage.refreshPage() const value = await settingsConfigPage.getRoleContentValue(roles.vKeyMaxEntityCount) - await apiCall.modifySettingsRole(roles.queryMemCapacity, "100000") expect(value === input).toBe(expected) + if (index === Data.inputDataAcceptsZero.length - 1) { + await apiCall.modifySettingsRole(roles.vKeyMaxEntityCount, "100000") + } }); }) - Data.CMDData.forEach(({ input, description, expected }) => { + Data.CMDData.forEach(({ input, description, expected }, index) => { test(`@admin Modify ${roles.cmdInfo} via API validation via UI: Input value: ${input} description: ${description}`, async () => { const settingsConfigPage = await browser.createNewPage(SettingsConfigPage, urls.settingsUrl) const apiCall = new ApiCalls() await apiCall.modifySettingsRole(roles.cmdInfo, input) await settingsConfigPage.refreshPage() const value = await settingsConfigPage.getRoleContentValue(roles.cmdInfo) - await apiCall.modifySettingsRole(roles.queryMemCapacity, "yes") expect(value === input).toBe(expected) + if (index === Data.CMDData.length - 1) { + await apiCall.modifySettingsRole(roles.cmdInfo, "yes") + } }); }) - Data.inputDataAcceptsZero.forEach(({ input, description, expected }) => { + Data.inputDataAcceptsZero.forEach(({ input, description, expected }, index) => { test(`@admin Modify ${roles.maxInfoQueries} via API validation via UI: Input value: ${input} description: ${description}`, async () => { const settingsConfigPage = await browser.createNewPage(SettingsConfigPage, urls.settingsUrl) const apiCall = new ApiCalls() await apiCall.modifySettingsRole(roles.maxInfoQueries, input) await settingsConfigPage.refreshPage() const value = await settingsConfigPage.getRoleContentValue(roles.maxInfoQueries) - await apiCall.modifySettingsRole(roles.queryMemCapacity, "1000") - expect(value === input).toBe(expected) + expect(value === input).toBe(expected); + if (index === Data.inputDataAcceptsZero.length - 1) { + await apiCall.modifySettingsRole(roles.queryMemCapacity, "1000"); + } }); }) - Data.roleModificationData.forEach(({ role, input, description, expected }) => { + Data.roleModificationData.forEach(({ role, input, description, expected }, index) => { test(`@admin Modify ${role} via UI validation via API: Input value: ${input} description: ${description}`, async () => { + const apiCall = new ApiCalls() + console.log("before: ",String((await apiCall.getSettingsRoleValue(role)).config[1])); const settingsConfigPage = await browser.createNewPage(SettingsConfigPage, urls.settingsUrl) await settingsConfigPage.modifyRoleValue(role, input) - const apiCall = new ApiCalls() let value = String((await apiCall.getSettingsRoleValue(role)).config[1]); + console.log("after: ",value); // Convert numeric values to yes/no for boolean settings - if (value === '1') { - value = 'yes'; - } else if (value === '0') { - value = 'no'; + value = value === '1' ? 'yes' : value === '0' ? 'no' : value; + expect(value === input).toBe(expected); + if (index === Data.roleModificationData.length - 1) { + await apiCall.modifySettingsRole(roles.maxQueuedQueries, "25") + await apiCall.modifySettingsRole(roles.maxTimeOut, "0") + await apiCall.modifySettingsRole(roles.defaultTimeOut, "0") + await apiCall.modifySettingsRole(roles.resultSetSize, "10000") + await apiCall.modifySettingsRole(roles.queryMemCapacity, "0") + await apiCall.modifySettingsRole(roles.vKeyMaxEntityCount, "100000") + await apiCall.modifySettingsRole(roles.queryMemCapacity, "0") + await apiCall.modifySettingsRole(roles.vKeyMaxEntityCount, "100000") + await apiCall.modifySettingsRole(roles.cmdInfo, "yes") + await apiCall.modifySettingsRole(roles.queryMemCapacity, "1000") } - await apiCall.modifySettingsRole(roles.queryMemCapacity, "0") // update to default values - expect(value === input).toBe(expected) }); }) From e734415fec018d94683b4cd6735dfec13b6b6f84 Mon Sep 17 00:00:00 2001 From: Naseem Ali <34807727+Naseem77@users.noreply.github.com> Date: Mon, 27 Jan 2025 12:50:46 +0200 Subject: [PATCH 06/17] update tests --- e2e/config/settingsConfigData.json | 1 + e2e/tests/settingsConfig.spec.ts | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/e2e/config/settingsConfigData.json b/e2e/config/settingsConfigData.json index 69d7c96c..069a86a2 100644 --- a/e2e/config/settingsConfigData.json +++ b/e2e/config/settingsConfigData.json @@ -29,6 +29,7 @@ ], "roleModificationData": [ {"role": "MAX_QUEUED_QUERIES", "description": "modify maxQueuedQueries", "input": "24", "expected": true}, + {"role": "TIMEOUT", "description": "modify timeOut", "input": "1001", "expected": true}, {"role": "TIMEOUT_MAX", "description": "modify maxTimeOut", "input": "1", "expected": true}, {"role": "TIMEOUT_DEFAULT", "description": "modify defaultTimeOut", "input": "1", "expected": true}, {"role": "RESULTSET_SIZE", "description": "modify resultSetSize", "input": "10001", "expected": true}, diff --git a/e2e/tests/settingsConfig.spec.ts b/e2e/tests/settingsConfig.spec.ts index a8d15510..c8bf952c 100644 --- a/e2e/tests/settingsConfig.spec.ts +++ b/e2e/tests/settingsConfig.spec.ts @@ -32,6 +32,21 @@ test.describe('Settings Tests', () => { }); }) + Data.inputDataAcceptsZero.forEach(({ input, description, expected }, index) => { + test(`@admin Modify ${roles.maxQueuedQueries} via API validation via UI: Input value: ${input} description: ${description}`, async () => { + const settingsConfigPage = await browser.createNewPage(SettingsConfigPage, urls.settingsUrl) + const apiCall = new ApiCalls() + await new Promise(resolve => { setTimeout(resolve, 1000) }); + await apiCall.modifySettingsRole(roles.TimeOut, input) + await settingsConfigPage.refreshPage() + const value = await settingsConfigPage.getRoleContentValue(roles.TimeOut) + expect(value === input).toBe(expected); + if (index === Data.inputDataAcceptsZero.length - 1) { + await apiCall.modifySettingsRole(roles.TimeOut, "1000") + } + }); + }) + Data.maxTimeOut.forEach(({ input, description, expected }, index) => { test(`@admin Modify ${roles.maxTimeOut} via API validation via UI: Input value: ${input} description: ${description}`, async () => { const settingsConfigPage = await browser.createNewPage(SettingsConfigPage, urls.settingsUrl) @@ -143,13 +158,12 @@ test.describe('Settings Tests', () => { expect(value === input).toBe(expected); if (index === Data.roleModificationData.length - 1) { await apiCall.modifySettingsRole(roles.maxQueuedQueries, "25") + await apiCall.modifySettingsRole(roles.TimeOut, "1000") await apiCall.modifySettingsRole(roles.maxTimeOut, "0") await apiCall.modifySettingsRole(roles.defaultTimeOut, "0") await apiCall.modifySettingsRole(roles.resultSetSize, "10000") await apiCall.modifySettingsRole(roles.queryMemCapacity, "0") await apiCall.modifySettingsRole(roles.vKeyMaxEntityCount, "100000") - await apiCall.modifySettingsRole(roles.queryMemCapacity, "0") - await apiCall.modifySettingsRole(roles.vKeyMaxEntityCount, "100000") await apiCall.modifySettingsRole(roles.cmdInfo, "yes") await apiCall.modifySettingsRole(roles.queryMemCapacity, "1000") } From 1e7b07501ef35258caa3c9d1a98759f19dc2afc4 Mon Sep 17 00:00:00 2001 From: Naseem Ali <34807727+Naseem77@users.noreply.github.com> Date: Mon, 27 Jan 2025 13:51:50 +0200 Subject: [PATCH 07/17] Update settingsConfig.spec.ts --- e2e/tests/settingsConfig.spec.ts | 107 +++++++++++++++++++++++-------- 1 file changed, 82 insertions(+), 25 deletions(-) diff --git a/e2e/tests/settingsConfig.spec.ts b/e2e/tests/settingsConfig.spec.ts index c8bf952c..4fdc959f 100644 --- a/e2e/tests/settingsConfig.spec.ts +++ b/e2e/tests/settingsConfig.spec.ts @@ -33,7 +33,7 @@ test.describe('Settings Tests', () => { }) Data.inputDataAcceptsZero.forEach(({ input, description, expected }, index) => { - test(`@admin Modify ${roles.maxQueuedQueries} via API validation via UI: Input value: ${input} description: ${description}`, async () => { + test(`@admin Modify ${roles.TimeOut} via API validation via UI: Input value: ${input} description: ${description}`, async () => { const settingsConfigPage = await browser.createNewPage(SettingsConfigPage, urls.settingsUrl) const apiCall = new ApiCalls() await new Promise(resolve => { setTimeout(resolve, 1000) }); @@ -145,30 +145,87 @@ test.describe('Settings Tests', () => { }); }) - Data.roleModificationData.forEach(({ role, input, description, expected }, index) => { - test(`@admin Modify ${role} via UI validation via API: Input value: ${input} description: ${description}`, async () => { - const apiCall = new ApiCalls() - console.log("before: ",String((await apiCall.getSettingsRoleValue(role)).config[1])); - const settingsConfigPage = await browser.createNewPage(SettingsConfigPage, urls.settingsUrl) - await settingsConfigPage.modifyRoleValue(role, input) - let value = String((await apiCall.getSettingsRoleValue(role)).config[1]); - console.log("after: ",value); - // Convert numeric values to yes/no for boolean settings - value = value === '1' ? 'yes' : value === '0' ? 'no' : value; - expect(value === input).toBe(expected); - if (index === Data.roleModificationData.length - 1) { - await apiCall.modifySettingsRole(roles.maxQueuedQueries, "25") - await apiCall.modifySettingsRole(roles.TimeOut, "1000") - await apiCall.modifySettingsRole(roles.maxTimeOut, "0") - await apiCall.modifySettingsRole(roles.defaultTimeOut, "0") - await apiCall.modifySettingsRole(roles.resultSetSize, "10000") - await apiCall.modifySettingsRole(roles.queryMemCapacity, "0") - await apiCall.modifySettingsRole(roles.vKeyMaxEntityCount, "100000") - await apiCall.modifySettingsRole(roles.cmdInfo, "yes") - await apiCall.modifySettingsRole(roles.queryMemCapacity, "1000") - } - }); - }) + test(`@admin Modify maxQueuedQueries via UI validation via API: Input value: 24`, async () => { + const settingsConfigPage = await browser.createNewPage(SettingsConfigPage, urls.settingsUrl) + await settingsConfigPage.modifyRoleValue(roles.maxQueuedQueries, "24") + const apiCall = new ApiCalls() + let value = String((await apiCall.getSettingsRoleValue(roles.maxQueuedQueries)).config[1]); + expect(value === "24").toBe(true); + await apiCall.modifySettingsRole(roles.maxQueuedQueries, "25") + }); + + test(`@admin Modify TimeOut via UI validation via API: Input value: 1001`, async () => { + const settingsConfigPage = await browser.createNewPage(SettingsConfigPage, urls.settingsUrl) + await settingsConfigPage.modifyRoleValue(roles.TimeOut, "1001") + const apiCall = new ApiCalls() + let value = String((await apiCall.getSettingsRoleValue(roles.TimeOut)).config[1]); + expect(value === "1001").toBe(true); + await apiCall.modifySettingsRole(roles.TimeOut, "1000") + }); + + test(`@admin Modify maxTimeOut via UI validation via API: Input value: 1`, async () => { + const settingsConfigPage = await browser.createNewPage(SettingsConfigPage, urls.settingsUrl) + await settingsConfigPage.modifyRoleValue(roles.maxTimeOut, "1") + const apiCall = new ApiCalls() + let value = String((await apiCall.getSettingsRoleValue(roles.maxTimeOut)).config[1]); + expect(value === "1").toBe(true); + await apiCall.modifySettingsRole(roles.maxTimeOut, "0") + }); + + test(`@admin Modify defaultTimeOut via UI validation via API: Input value: 1`, async () => { + const settingsConfigPage = await browser.createNewPage(SettingsConfigPage, urls.settingsUrl) + await settingsConfigPage.modifyRoleValue(roles.defaultTimeOut, "1") + const apiCall = new ApiCalls() + let value = String((await apiCall.getSettingsRoleValue(roles.defaultTimeOut)).config[1]); + expect(value === "1").toBe(true); + await apiCall.modifySettingsRole(roles.defaultTimeOut, "0") + }); + + test(`@admin Modify resultSetSize via UI validation via API: Input value: 10001`, async () => { + const settingsConfigPage = await browser.createNewPage(SettingsConfigPage, urls.settingsUrl) + await settingsConfigPage.modifyRoleValue(roles.resultSetSize, "10001") + const apiCall = new ApiCalls() + let value = String((await apiCall.getSettingsRoleValue(roles.resultSetSize)).config[1]); + expect(value === "10001").toBe(true); + await apiCall.modifySettingsRole(roles.resultSetSize, "10000") + }); + + test(`@admin Modify queryMemCapacity via UI validation via API: Input value: 1`, async () => { + const settingsConfigPage = await browser.createNewPage(SettingsConfigPage, urls.settingsUrl) + await settingsConfigPage.modifyRoleValue(roles.queryMemCapacity, "1") + const apiCall = new ApiCalls() + let value = String((await apiCall.getSettingsRoleValue(roles.queryMemCapacity)).config[1]); + expect(value === "1").toBe(true); + await apiCall.modifySettingsRole(roles.queryMemCapacity, "0") + }); + + test(`@admin Modify vKeyMaxEntityCount via UI validation via API: Input value: 100001`, async () => { + const settingsConfigPage = await browser.createNewPage(SettingsConfigPage, urls.settingsUrl) + await settingsConfigPage.modifyRoleValue(roles.vKeyMaxEntityCount, "100001") + const apiCall = new ApiCalls() + let value = String((await apiCall.getSettingsRoleValue(roles.vKeyMaxEntityCount)).config[1]); + expect(value === "100001").toBe(true); + await apiCall.modifySettingsRole(roles.vKeyMaxEntityCount, "100000") + }); + + test(`@admin Modify cmdInfo via UI validation via API: Input value: no`, async () => { + const settingsConfigPage = await browser.createNewPage(SettingsConfigPage, urls.settingsUrl) + await settingsConfigPage.modifyRoleValue(roles.cmdInfo, "no") + const apiCall = new ApiCalls() + let value = String((await apiCall.getSettingsRoleValue(roles.cmdInfo)).config[1]); + value = value === '1' ? 'yes' : value === '0' ? 'no' : value; + expect(value === "no").toBe(true); + await apiCall.modifySettingsRole(roles.cmdInfo, "yes") + }); + test(`@admin Modify maxInfoQueries via UI validation via API: Input value: 999`, async () => { + const settingsConfigPage = await browser.createNewPage(SettingsConfigPage, urls.settingsUrl) + await settingsConfigPage.modifyRoleValue(roles.maxInfoQueries, "999") + await new Promise(resolve => { setTimeout(resolve, 1000) }); + const apiCall = new ApiCalls() + let value = String((await apiCall.getSettingsRoleValue(roles.maxInfoQueries)).config[1]); + expect(value === "999").toBe(true); + await apiCall.modifySettingsRole(roles.maxInfoQueries, "1000") + }); }) \ No newline at end of file From 47d76a58475711fc48e0477437d07a87610c254f Mon Sep 17 00:00:00 2001 From: Naseem Ali <34807727+Naseem77@users.noreply.github.com> Date: Mon, 27 Jan 2025 14:18:08 +0200 Subject: [PATCH 08/17] Update settingsConfig.spec.ts --- e2e/tests/settingsConfig.spec.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/e2e/tests/settingsConfig.spec.ts b/e2e/tests/settingsConfig.spec.ts index 4fdc959f..54226f85 100644 --- a/e2e/tests/settingsConfig.spec.ts +++ b/e2e/tests/settingsConfig.spec.ts @@ -138,9 +138,10 @@ test.describe('Settings Tests', () => { await apiCall.modifySettingsRole(roles.maxInfoQueries, input) await settingsConfigPage.refreshPage() const value = await settingsConfigPage.getRoleContentValue(roles.maxInfoQueries) + console.log(value); expect(value === input).toBe(expected); if (index === Data.inputDataAcceptsZero.length - 1) { - await apiCall.modifySettingsRole(roles.queryMemCapacity, "1000"); + await apiCall.modifySettingsRole(roles.maxInfoQueries, "1000"); } }); }) @@ -224,6 +225,8 @@ test.describe('Settings Tests', () => { await new Promise(resolve => { setTimeout(resolve, 1000) }); const apiCall = new ApiCalls() let value = String((await apiCall.getSettingsRoleValue(roles.maxInfoQueries)).config[1]); + console.log(value); + expect(value === "999").toBe(true); await apiCall.modifySettingsRole(roles.maxInfoQueries, "1000") }); From ad603534371a051864a379db241cee0b3bb2ed3e Mon Sep 17 00:00:00 2001 From: Naseem Ali <34807727+Naseem77@users.noreply.github.com> Date: Mon, 27 Jan 2025 18:07:41 +0200 Subject: [PATCH 09/17] update playwright config for artifacts --- .github/workflows/playwright.yml | 7 +++++++ playwright.config.ts | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 83757c75..d90f9982 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -40,3 +40,10 @@ jobs: name: playwright-report path: playwright-report/ retention-days: 30 + - name: Upload failed test screenshots + if: always() + uses: actions/upload-artifact@v4 + with: + name: failed-test-screenshots + path: playwright-report/screenshots/ + retention-days: 30 diff --git a/playwright.config.ts b/playwright.config.ts index b705a6f5..4bc5ebd2 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -21,7 +21,8 @@ export default defineConfig({ /* Opt out of parallel tests on CI. */ workers: process.env.CI ? 1 : undefined, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'html', + reporter: [['html', { outputFolder: 'playwright-report' }]], + outputDir: 'playwright-report/artifacts', /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Base URL to use in actions like `await page.goto('/')`. */ @@ -29,6 +30,7 @@ export default defineConfig({ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: 'on-first-retry', + screenshot: 'only-on-failure', }, /* Configure projects for major browsers */ From cd294475017a1d1ee8bf9086ebdc5bf4834ea013 Mon Sep 17 00:00:00 2001 From: Naseem Ali <34807727+Naseem77@users.noreply.github.com> Date: Mon, 27 Jan 2025 18:58:04 +0200 Subject: [PATCH 10/17] Update playwright.yml --- .github/workflows/playwright.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index d90f9982..e88f6b09 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -34,6 +34,10 @@ jobs: npm install npm run build NEXTAUTH_SECRET=SECRET npm start & npx playwright test --reporter=dot,list + - name: Ensure required directories exist + run: | + mkdir -p playwright-report + mkdir -p playwright-report/artifacts - uses: actions/upload-artifact@v4 if: always() with: @@ -45,5 +49,5 @@ jobs: uses: actions/upload-artifact@v4 with: name: failed-test-screenshots - path: playwright-report/screenshots/ + path: playwright-report/artifacts/ retention-days: 30 From a7e3b990601f0a388ae6607e75f8b22f94e4da90 Mon Sep 17 00:00:00 2001 From: Naseem Ali <34807727+Naseem77@users.noreply.github.com> Date: Mon, 27 Jan 2025 19:27:00 +0200 Subject: [PATCH 11/17] updating tests --- e2e/logic/POM/settingsConfigPage.ts | 7 +++++++ e2e/tests/settingsConfig.spec.ts | 1 + 2 files changed, 8 insertions(+) diff --git a/e2e/logic/POM/settingsConfigPage.ts b/e2e/logic/POM/settingsConfigPage.ts index 3b6eea73..2403ca2a 100644 --- a/e2e/logic/POM/settingsConfigPage.ts +++ b/e2e/logic/POM/settingsConfigPage.ts @@ -24,6 +24,10 @@ export default class SettingsConfigPage extends BasePage { return (role: string) => this.page.locator(`//tbody//tr[@data-id='${role}']/td[3]/div/div/button[1]`) } + private get toastCloseBtn(): Locator { + return this.page.locator("//li[@role='status']/button"); + } + async modifyRoleValue(role: string, input: string): Promise { await this.roleContentValue(role).hover(); await this.EditRoleButton(role).click(); @@ -33,4 +37,7 @@ export default class SettingsConfigPage extends BasePage { return value } + async clickOnToastCloseBtn(): Promise{ + await this.toastCloseBtn.click(); + } } \ No newline at end of file diff --git a/e2e/tests/settingsConfig.spec.ts b/e2e/tests/settingsConfig.spec.ts index 54226f85..31978769 100644 --- a/e2e/tests/settingsConfig.spec.ts +++ b/e2e/tests/settingsConfig.spec.ts @@ -225,6 +225,7 @@ test.describe('Settings Tests', () => { await new Promise(resolve => { setTimeout(resolve, 1000) }); const apiCall = new ApiCalls() let value = String((await apiCall.getSettingsRoleValue(roles.maxInfoQueries)).config[1]); + await settingsConfigPage.clickOnToastCloseBtn(); console.log(value); expect(value === "999").toBe(true); From c719d037725f77802e43131e5ce9be5079d20643 Mon Sep 17 00:00:00 2001 From: Naseem Ali <34807727+Naseem77@users.noreply.github.com> Date: Mon, 27 Jan 2025 19:45:07 +0200 Subject: [PATCH 12/17] increase timeout --- e2e/tests/settingsConfig.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/tests/settingsConfig.spec.ts b/e2e/tests/settingsConfig.spec.ts index 31978769..c9972b1c 100644 --- a/e2e/tests/settingsConfig.spec.ts +++ b/e2e/tests/settingsConfig.spec.ts @@ -222,7 +222,7 @@ test.describe('Settings Tests', () => { test(`@admin Modify maxInfoQueries via UI validation via API: Input value: 999`, async () => { const settingsConfigPage = await browser.createNewPage(SettingsConfigPage, urls.settingsUrl) await settingsConfigPage.modifyRoleValue(roles.maxInfoQueries, "999") - await new Promise(resolve => { setTimeout(resolve, 1000) }); + await new Promise(resolve => { setTimeout(resolve, 3000) }); const apiCall = new ApiCalls() let value = String((await apiCall.getSettingsRoleValue(roles.maxInfoQueries)).config[1]); await settingsConfigPage.clickOnToastCloseBtn(); From 91deab99578040d41dd1e4d63687dd32b70364d2 Mon Sep 17 00:00:00 2001 From: Naseem Ali <34807727+Naseem77@users.noreply.github.com> Date: Mon, 27 Jan 2025 20:00:50 +0200 Subject: [PATCH 13/17] Update settingsConfig.spec.ts --- e2e/tests/settingsConfig.spec.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/e2e/tests/settingsConfig.spec.ts b/e2e/tests/settingsConfig.spec.ts index c9972b1c..fc9efabd 100644 --- a/e2e/tests/settingsConfig.spec.ts +++ b/e2e/tests/settingsConfig.spec.ts @@ -224,12 +224,16 @@ test.describe('Settings Tests', () => { await settingsConfigPage.modifyRoleValue(roles.maxInfoQueries, "999") await new Promise(resolve => { setTimeout(resolve, 3000) }); const apiCall = new ApiCalls() - let value = String((await apiCall.getSettingsRoleValue(roles.maxInfoQueries)).config[1]); - await settingsConfigPage.clickOnToastCloseBtn(); + let value; + for (let i = 0; i < 5; i++) { + value = String((await apiCall.getSettingsRoleValue(roles.maxInfoQueries)).config[1]); + if (value === "999") break; + await new Promise(resolve => setTimeout(resolve, 1500)); + } + console.log(value); - - expect(value === "999").toBe(true); - await apiCall.modifySettingsRole(roles.maxInfoQueries, "1000") + expect(value).toBe("999"); + await apiCall.modifySettingsRole(roles.maxInfoQueries, "1000"); }); }) \ No newline at end of file From eb0aad0a71e602c682ad7571eecf9f5097c5fd22 Mon Sep 17 00:00:00 2001 From: Naseem Ali <34807727+Naseem77@users.noreply.github.com> Date: Tue, 28 Jan 2025 10:51:45 +0200 Subject: [PATCH 14/17] refresh ui before api call --- e2e/tests/settingsConfig.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/e2e/tests/settingsConfig.spec.ts b/e2e/tests/settingsConfig.spec.ts index fc9efabd..48c51c86 100644 --- a/e2e/tests/settingsConfig.spec.ts +++ b/e2e/tests/settingsConfig.spec.ts @@ -222,6 +222,7 @@ test.describe('Settings Tests', () => { test(`@admin Modify maxInfoQueries via UI validation via API: Input value: 999`, async () => { const settingsConfigPage = await browser.createNewPage(SettingsConfigPage, urls.settingsUrl) await settingsConfigPage.modifyRoleValue(roles.maxInfoQueries, "999") + await settingsConfigPage.refreshPage(); await new Promise(resolve => { setTimeout(resolve, 3000) }); const apiCall = new ApiCalls() let value; From 0244c82f16cbe1a846c68ae638c6189084fd6c50 Mon Sep 17 00:00:00 2001 From: Naseem Ali <34807727+Naseem77@users.noreply.github.com> Date: Tue, 28 Jan 2025 11:59:09 +0200 Subject: [PATCH 15/17] add scroll after reload --- components/ui/table.tsx | 2 +- e2e/logic/POM/settingsConfigPage.ts | 8 ++++++++ e2e/tests/settingsConfig.spec.ts | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/components/ui/table.tsx b/components/ui/table.tsx index dbe1675d..6e98a5b1 100644 --- a/components/ui/table.tsx +++ b/components/ui/table.tsx @@ -11,7 +11,7 @@ const Table = React.forwardRef< HTMLTableElement, TableProps >(({ className, parentClassName, ...props }, ref) => ( -
+
{ await this.roleContentValue(role).hover(); await this.EditRoleButton(role).click(); @@ -40,4 +44,8 @@ export default class SettingsConfigPage extends BasePage { async clickOnToastCloseBtn(): Promise{ await this.toastCloseBtn.click(); } + + async scrollToBottomInTable(): Promise { + await this.tableContent.evaluate((el) => el.scrollTo(0, el.scrollHeight)); + } } \ No newline at end of file diff --git a/e2e/tests/settingsConfig.spec.ts b/e2e/tests/settingsConfig.spec.ts index 48c51c86..03786811 100644 --- a/e2e/tests/settingsConfig.spec.ts +++ b/e2e/tests/settingsConfig.spec.ts @@ -223,6 +223,7 @@ test.describe('Settings Tests', () => { const settingsConfigPage = await browser.createNewPage(SettingsConfigPage, urls.settingsUrl) await settingsConfigPage.modifyRoleValue(roles.maxInfoQueries, "999") await settingsConfigPage.refreshPage(); + await settingsConfigPage.scrollToBottomInTable(); await new Promise(resolve => { setTimeout(resolve, 3000) }); const apiCall = new ApiCalls() let value; From 338a4affbf67fcb0e4ffd91efd29b5b5ec6ddacb Mon Sep 17 00:00:00 2001 From: Naseem Ali <34807727+Naseem77@users.noreply.github.com> Date: Tue, 28 Jan 2025 13:21:14 +0200 Subject: [PATCH 16/17] adding logging --- e2e/logic/api/apiCalls.ts | 1 + e2e/tests/settingsConfig.spec.ts | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/e2e/logic/api/apiCalls.ts b/e2e/logic/api/apiCalls.ts index 26881060..1697766c 100644 --- a/e2e/logic/api/apiCalls.ts +++ b/e2e/logic/api/apiCalls.ts @@ -35,6 +35,7 @@ export default class ApiCalls { async getSettingsRoleValue(roleName: string, data?: any): Promise { const result = await getRequest(urls.api.settingsConfig + roleName, data) const jsonData = await result.json(); + console.log("api calls res:", jsonData, " role: ", roleName); return jsonData } diff --git a/e2e/tests/settingsConfig.spec.ts b/e2e/tests/settingsConfig.spec.ts index 03786811..8f753fdc 100644 --- a/e2e/tests/settingsConfig.spec.ts +++ b/e2e/tests/settingsConfig.spec.ts @@ -224,6 +224,9 @@ test.describe('Settings Tests', () => { await settingsConfigPage.modifyRoleValue(roles.maxInfoQueries, "999") await settingsConfigPage.refreshPage(); await settingsConfigPage.scrollToBottomInTable(); + const res = await settingsConfigPage.getRoleContentValue(roles.maxInfoQueries); + console.log("ui value: ", res); + await new Promise(resolve => { setTimeout(resolve, 3000) }); const apiCall = new ApiCalls() let value; @@ -233,7 +236,7 @@ test.describe('Settings Tests', () => { await new Promise(resolve => setTimeout(resolve, 1500)); } - console.log(value); + console.log("api value:", value); expect(value).toBe("999"); await apiCall.modifySettingsRole(roles.maxInfoQueries, "1000"); }); From d24a326ed09641d11fde945fa9a3b114f30eafff Mon Sep 17 00:00:00 2001 From: Guy Korland Date: Tue, 28 Jan 2025 21:06:26 +0200 Subject: [PATCH 17/17] Update playwright.yml --- .github/workflows/playwright.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index e88f6b09..adfffbb3 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -16,7 +16,7 @@ jobs: services: falkordb: - image: falkordb/falkordb:latest + image: falkordb/falkordb:v4.4.1 ports: - 6379:6379