From 1dcf0ed2efab9bd6afa880ad550c79ade7f4d837 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Wed, 28 Sep 2022 17:35:35 +0800 Subject: [PATCH 01/49] fix(nocodb-sdk): add missing offset & limit --- packages/nocodb-sdk/src/lib/Api.ts | 8 +++++++- scripts/sdk/swagger.json | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/packages/nocodb-sdk/src/lib/Api.ts b/packages/nocodb-sdk/src/lib/Api.ts index 6665a3b9eb..e3c4e531c9 100644 --- a/packages/nocodb-sdk/src/lib/Api.ts +++ b/packages/nocodb-sdk/src/lib/Api.ts @@ -2252,7 +2252,13 @@ export class Api< orgs: string, projectName: string, tableName: string, - query?: { fields?: any[]; sort?: any[]; where?: string }, + query?: { + fields?: any[]; + sort?: any[]; + where?: string; + offset?: string; + limit?: string; + }, params: RequestParams = {} ) => this.request({ diff --git a/scripts/sdk/swagger.json b/scripts/sdk/swagger.json index c0f2df3452..0e639602ef 100644 --- a/scripts/sdk/swagger.json +++ b/scripts/sdk/swagger.json @@ -2608,6 +2608,20 @@ }, "in": "query", "name": "where" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "offset" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "limit" } ], "responses": { From cd6c92d891717710885c9e0d88dfc78b314f7c12 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Wed, 28 Sep 2022 20:45:37 +0530 Subject: [PATCH 02/49] chore(CICD): conditionally trigger CICD for draft PR Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- .github/workflows/ci-cd.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 8e3fcaea11..9b47f9a6a7 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -21,7 +21,7 @@ on: jobs: cypress-restTableOps-run-cache: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -66,7 +66,7 @@ jobs: retention-days: 2 cypress-restViews-run-cache: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -111,7 +111,7 @@ jobs: retention-days: 2 cypress-restRoles-run-cache: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -156,7 +156,7 @@ jobs: retention-days: 2 cypress-restMisc-run-cache: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -201,7 +201,7 @@ jobs: retention-days: 2 cypress-xcdb-restTableOps-run-cache: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -246,7 +246,7 @@ jobs: retention-days: 2 cypress-xcdb-restViews-run-cache: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -291,7 +291,7 @@ jobs: retention-days: 2 cypress-xcdb-restRoles-run-cache: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -336,7 +336,7 @@ jobs: retention-days: 2 cypress-xcdb-restMisc-run-cache: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -381,7 +381,7 @@ jobs: retention-days: 2 cypress-pg-restTableOps-run-cache: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -426,7 +426,7 @@ jobs: retention-days: 2 cypress-pg-restViews-run-cache: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -471,7 +471,7 @@ jobs: retention-days: 2 cypress-pg-restRoles-run-cache: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -516,7 +516,7 @@ jobs: retention-days: 2 cypress-pg-restMisc-run-cache: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -561,7 +561,7 @@ jobs: retention-days: 2 cy-quick-sqlite: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -607,7 +607,7 @@ jobs: retention-days: 2 cy-quick-pg: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -652,7 +652,7 @@ jobs: retention-days: 2 unit-tests: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -692,7 +692,7 @@ jobs: run: npm run test:unit cypress-db-independent: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 From 0741ca5b22d73006cc77af1f102d5b33e0063de2 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Wed, 28 Sep 2022 20:50:13 +0530 Subject: [PATCH 03/49] test: dummy trigger Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- scripts/cypress/integration/common/00_pre_configurations.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/cypress/integration/common/00_pre_configurations.js b/scripts/cypress/integration/common/00_pre_configurations.js index c4edc6c659..734d2b815a 100644 --- a/scripts/cypress/integration/common/00_pre_configurations.js +++ b/scripts/cypress/integration/common/00_pre_configurations.js @@ -163,6 +163,7 @@ export const genTest = (apiType, dbType) => { }); it("Admin SignUp", () => { + cy.task("log", "This will be output to the terminal"); cy.task("log", "This will be output to the terminal"); loginPage.signUp(roles.owner.credentials); }); From 3eae8d41c30a8cb88ed83afa9917096544c6a981 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Wed, 28 Sep 2022 21:00:49 +0530 Subject: [PATCH 04/49] chore(CICD): trigger CI based on label Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- .github/workflows/ci-cd.yml | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 9b47f9a6a7..e83ba9921f 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -12,6 +12,7 @@ on: - "packages/nocodb/**" - ".github/workflows/ci-cd.yml" pull_request: + types: [opened, reopened, synchronize, ready_for_review, labeled] branches: [develop] paths: - "packages/nc-gui/**" @@ -21,7 +22,7 @@ on: jobs: cypress-restTableOps-run-cache: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -66,7 +67,7 @@ jobs: retention-days: 2 cypress-restViews-run-cache: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -111,7 +112,7 @@ jobs: retention-days: 2 cypress-restRoles-run-cache: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -156,7 +157,7 @@ jobs: retention-days: 2 cypress-restMisc-run-cache: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -201,7 +202,7 @@ jobs: retention-days: 2 cypress-xcdb-restTableOps-run-cache: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -246,7 +247,7 @@ jobs: retention-days: 2 cypress-xcdb-restViews-run-cache: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -291,7 +292,7 @@ jobs: retention-days: 2 cypress-xcdb-restRoles-run-cache: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -336,7 +337,7 @@ jobs: retention-days: 2 cypress-xcdb-restMisc-run-cache: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -381,7 +382,7 @@ jobs: retention-days: 2 cypress-pg-restTableOps-run-cache: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -426,7 +427,7 @@ jobs: retention-days: 2 cypress-pg-restViews-run-cache: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -471,7 +472,7 @@ jobs: retention-days: 2 cypress-pg-restRoles-run-cache: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -516,7 +517,7 @@ jobs: retention-days: 2 cypress-pg-restMisc-run-cache: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -561,7 +562,7 @@ jobs: retention-days: 2 cy-quick-sqlite: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -607,7 +608,7 @@ jobs: retention-days: 2 cy-quick-pg: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -652,7 +653,7 @@ jobs: retention-days: 2 unit-tests: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 @@ -692,7 +693,7 @@ jobs: run: npm run test:unit cypress-db-independent: runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' || github.event.label.name == 'trigger-CI' || !github.event.pull_request.draft }} + if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }} steps: - name: Setup Node uses: actions/setup-node@v1 From 9bd7b35f233cddd905938aeef0eae002cace9aee Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Wed, 28 Sep 2022 21:03:09 +0530 Subject: [PATCH 05/49] test: revert temporary changes Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- scripts/cypress/integration/common/00_pre_configurations.js | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/cypress/integration/common/00_pre_configurations.js b/scripts/cypress/integration/common/00_pre_configurations.js index 734d2b815a..1cd04c5cb2 100644 --- a/scripts/cypress/integration/common/00_pre_configurations.js +++ b/scripts/cypress/integration/common/00_pre_configurations.js @@ -165,7 +165,6 @@ export const genTest = (apiType, dbType) => { it("Admin SignUp", () => { cy.task("log", "This will be output to the terminal"); cy.task("log", "This will be output to the terminal"); - loginPage.signUp(roles.owner.credentials); }); function cy_createProjectBlock(proj, apiType, dbType) { From ece7bfd5b5e29bdd62b62c701c9bdfae95415930 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Thu, 29 Sep 2022 11:16:32 +0530 Subject: [PATCH 06/49] test: correction to signup page Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- scripts/cypress/integration/common/00_pre_configurations.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/cypress/integration/common/00_pre_configurations.js b/scripts/cypress/integration/common/00_pre_configurations.js index 1cd04c5cb2..c4edc6c659 100644 --- a/scripts/cypress/integration/common/00_pre_configurations.js +++ b/scripts/cypress/integration/common/00_pre_configurations.js @@ -164,7 +164,7 @@ export const genTest = (apiType, dbType) => { it("Admin SignUp", () => { cy.task("log", "This will be output to the terminal"); - cy.task("log", "This will be output to the terminal"); + loginPage.signUp(roles.owner.credentials); }); function cy_createProjectBlock(proj, apiType, dbType) { From b5cff62c47adb5e89b38e3fb17edb4346b79e8da Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Thu, 29 Sep 2022 11:23:39 +0530 Subject: [PATCH 07/49] docs: Enabling CI-CD for draft PR --- .../noco-docs/content/en/engineering/development-setup.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/noco-docs/content/en/engineering/development-setup.md b/packages/noco-docs/content/en/engineering/development-setup.md index bae546371a..6f79ff9218 100644 --- a/packages/noco-docs/content/en/engineering/development-setup.md +++ b/packages/noco-docs/content/en/engineering/development-setup.md @@ -166,3 +166,7 @@ npm run cypress:open # run test script - quickTest.js ``` + +## Enabling CI-CD for draft PR +CI-CD will be triggered on moving a PR from draft state to `Ready for review` state & on pushing changes to `Develop`. To verify CI-CD before requesting for review, add label `trigger-CI` on Draft PR. + From f73f1d5c4dc9e3692d01c7b1ca722517edb552e0 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Thu, 29 Sep 2022 12:18:47 +0530 Subject: [PATCH 08/49] test: enable duration column tests Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- .../integration/common/3e_duration_column.js | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/scripts/cypress/integration/common/3e_duration_column.js b/scripts/cypress/integration/common/3e_duration_column.js index e86c36b1b4..c0f9f466df 100644 --- a/scripts/cypress/integration/common/3e_duration_column.js +++ b/scripts/cypress/integration/common/3e_duration_column.js @@ -13,21 +13,26 @@ export const genTest = (apiType, dbType) => { cy.get("label").contains(label).parents(".ant-row").first().click(); }; - // Run once before test- create table - // before(() => { - mainPage.tabReset(); - - // // close team & auth tab - // cy.get('button.ant-tabs-tab-remove').should('exist').click(); - + cy.restoreLocalStorage(); cy.createTable(tableName); + cy.saveLocalStorage(); }); - beforeEach(() => {}); + // Run once before test- create table + // + beforeEach(() => { + cy.restoreLocalStorage(); + }); + + afterEach(() => { + cy.saveLocalStorage(); + }); after(() => { + cy.restoreLocalStorage(); cy.deleteTable(tableName); + cy.saveLocalStorage(); }); // Routine to create a new look up column @@ -42,7 +47,6 @@ export const genTest = (apiType, dbType) => { .should("exist") .clear() .type(columnName); - // cy.get(".nc-column-type-input").last().click().type("Duration"); cy.getActiveMenu(".nc-dropdown-grid-add-column") .find(".nc-column-type-input") .last() @@ -60,7 +64,6 @@ export const genTest = (apiType, dbType) => { .contains(durationFormat) .click(); - // cy.get(".ant-btn-primary").contains("Save").should('exist').click(); cy.getActiveMenu(".nc-dropdown-grid-add-column") .find(".ant-btn-primary:visible") .contains("Save") @@ -83,8 +86,6 @@ export const genTest = (apiType, dbType) => { .trigger("mouseover", { force: true }) .click({ force: true }); - // cy.get(".nc-column-edit").click(); - // cy.get(".nc-column-edit").should("not.be.visible"); cy.getActiveMenu(".nc-dropdown-column-operations") .find(".nc-column-edit") .click(); @@ -102,7 +103,6 @@ export const genTest = (apiType, dbType) => { .contains(newDurationFormat) .click(); - // cy.get(".ant-btn-primary:visible").contains("Save").click(); cy.getActiveMenu(".nc-dropdown-edit-column") .find(".ant-btn-primary:visible") .contains("Save") @@ -145,9 +145,6 @@ export const genTest = (apiType, dbType) => { .contains("Cancel") .should("exist") .click(); - // mainPage.getCell(colName, index).find('input').then(($e) => { - // expect($e[0].value).to.equal(expectedValue) - // }) mainPage.getCell(colName, index).contains(expectedValue).should("exist"); }; From 9dacc167983e8fbb1296e12efbb8f58c11a45558 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Thu, 29 Sep 2022 12:19:33 +0530 Subject: [PATCH 09/49] test: enable duration column tests Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- scripts/cypress/integration/test/pg-restTableOps.js | 2 +- scripts/cypress/integration/test/restTableOps.js | 2 +- scripts/cypress/integration/test/xcdb-restTableOps.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/cypress/integration/test/pg-restTableOps.js b/scripts/cypress/integration/test/pg-restTableOps.js index b60b13805f..d4a2d52e9f 100644 --- a/scripts/cypress/integration/test/pg-restTableOps.js +++ b/scripts/cypress/integration/test/pg-restTableOps.js @@ -31,7 +31,7 @@ const nocoTestSuite = (apiType, dbType) => { t3b.genTest(apiType, dbType); t3c.genTest(apiType, dbType); t3d.genTest(apiType, dbType); - // NcGUI v2 t3e.genTest(apiType, dbType); + t3e.genTest(apiType, dbType); }; nocoTestSuite("rest", "postgres"); diff --git a/scripts/cypress/integration/test/restTableOps.js b/scripts/cypress/integration/test/restTableOps.js index 75777ca93d..755e78599b 100644 --- a/scripts/cypress/integration/test/restTableOps.js +++ b/scripts/cypress/integration/test/restTableOps.js @@ -31,7 +31,7 @@ const nocoTestSuite = (apiType, dbType) => { t3b.genTest(apiType, dbType); t3c.genTest(apiType, dbType); t3d.genTest(apiType, dbType); - // NcGUI v2 t3e.genTest(apiType, dbType); + t3e.genTest(apiType, dbType); t3f.genTest(apiType, dbType); }; diff --git a/scripts/cypress/integration/test/xcdb-restTableOps.js b/scripts/cypress/integration/test/xcdb-restTableOps.js index ff9e8b9460..c10904d458 100644 --- a/scripts/cypress/integration/test/xcdb-restTableOps.js +++ b/scripts/cypress/integration/test/xcdb-restTableOps.js @@ -30,7 +30,7 @@ const nocoTestSuite = (apiType, dbType) => { t3b.genTest(apiType, dbType); t3c.genTest(apiType, dbType); t3d.genTest(apiType, dbType); - // NcGUI v2 t3e.genTest(apiType, dbType); + t3e.genTest(apiType, dbType); }; nocoTestSuite("rest", "xcdb"); From b2ac82c1274a385405ead4ac70103290463388dc Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Thu, 29 Sep 2022 12:27:23 +0530 Subject: [PATCH 10/49] test: enable preview mode tests Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- .../integration/common/5b_preview_role.js | 23 +++-- .../integration/common/5c_super_user_role.js | 88 +++++++++---------- .../cypress/integration/test/pg-restRoles.js | 2 +- scripts/cypress/integration/test/restRoles.js | 5 +- .../integration/test/xcdb-restRoles.js | 2 +- 5 files changed, 61 insertions(+), 59 deletions(-) diff --git a/scripts/cypress/integration/common/5b_preview_role.js b/scripts/cypress/integration/common/5b_preview_role.js index df14c0aefe..a90cfbf198 100644 --- a/scripts/cypress/integration/common/5b_preview_role.js +++ b/scripts/cypress/integration/common/5b_preview_role.js @@ -27,36 +27,42 @@ export const genTest = (apiType, dbType, roleType) => { /////////////////////////////////////////////////////////// //// Test Suite + let clear; + describe("Role preview validations", () => { // Sign in/ open project before(() => { loginPage.loginAndOpenProject(apiType, dbType); cy.openTableTab("City", 25); - cy.wait(3000); - settingsPage.openProjectMenu(); cy.getActiveMenu(".nc-dropdown-project-menu") .find(`[data-submenu-id="preview-as"]`) .should("exist") .click(); - cy.wait(1000); cy.get(".ant-dropdown-menu-submenu") .eq(4) .find(`[data-menu-id="editor"]`) .should("exist") .click(); - - cy.wait(10000); - cy.saveLocalStorage(); + + clear = Cypress.LocalStorage.clear; + Cypress.LocalStorage.clear = () => {}; }); beforeEach(() => { cy.restoreLocalStorage(); }); + afterEach(() => { + cy.saveLocalStorage(); + Cypress.LocalStorage.clear = clear; + }); + after(() => { + cy.restoreLocalStorage(); + // cy.get(".nc-preview-reset").click({ force: true }); cy.get(".mdi-exit-to-app").click(); // wait for page rendering to complete @@ -88,6 +94,8 @@ export const genTest = (apiType, dbType, roleType) => { enableTableAccess("customerlist", "editor"); enableTableAccess("customerlist", "commenter"); enableTableAccess("customerlist", "viewer"); + + cy.saveLocalStorage(); }); const genTestSub = (roleType) => { @@ -97,9 +105,6 @@ export const genTest = (apiType, dbType, roleType) => { .find(`[type="radio"][value="${roleType}"]`) .should("exist") .click(); - - cy.wait(5000); - cy.saveLocalStorage(); }); it(`Role preview: ${roleType}: Advance settings`, () => { diff --git a/scripts/cypress/integration/common/5c_super_user_role.js b/scripts/cypress/integration/common/5c_super_user_role.js index fe72773dc0..ed51a2171d 100644 --- a/scripts/cypress/integration/common/5c_super_user_role.js +++ b/scripts/cypress/integration/common/5c_super_user_role.js @@ -1,12 +1,9 @@ -import { loginPage } from '../../support/page_objects/navigation'; -import { roles } from '../../support/page_objects/projectConstants'; +import { loginPage } from "../../support/page_objects/navigation"; +import { roles } from "../../support/page_objects/projectConstants"; export const genTest = (apiType, dbType) => { describe(`${apiType.toUpperCase()} api - Super user test`, () => { - before(() => { - loginPage.signIn(roles.owner.credentials); - cy.saveLocalStorage(); - }); + before(() => {}); beforeEach(() => { cy.restoreLocalStorage(); @@ -16,70 +13,71 @@ export const genTest = (apiType, dbType) => { cy.saveLocalStorage(); }); - after(() => { - }); - + after(() => {}); it(`Open App store page and check slack app`, () => { - - cy.visit('/#/apps').then(win => { - cy.get('.nc-app-store-title').should('exist'); - cy.get('.nc-app-store-card-Slack').should('exist'); + cy.visit("/#/apps").then((win) => { + cy.get(".nc-app-store-title").should("exist"); + cy.get(".nc-app-store-card-Slack").should("exist"); // install slack app - cy.get('.nc-app-store-card-Slack .install-btn') - .invoke('attr', 'style', 'right: 10px') + cy.get(".nc-app-store-card-Slack .install-btn").invoke( + "attr", + "style", + "right: 10px" + ); - cy.get('.nc-app-store-card-Slack .install-btn .nc-app-store-card-install') - .click(); + cy.get( + ".nc-app-store-card-Slack .install-btn .nc-app-store-card-install" + ).click(); - cy.getActiveModal('.nc-modal-plugin-install') + cy.getActiveModal(".nc-modal-plugin-install") .find('[placeholder="Channel Name"]') - .type('Test channel') + .type("Test channel"); - cy.getActiveModal('.nc-modal-plugin-install') + cy.getActiveModal(".nc-modal-plugin-install") .find('[placeholder="Webhook URL"]') - .type('http://test.com') - + .type("http://test.com"); - cy.getActiveModal('.nc-modal-plugin-install') + cy.getActiveModal(".nc-modal-plugin-install") .find('button:contains("Save")') - .click() - - cy.toastWait('Successfully installed') + .click(); - cy.get('.nc-app-store-card-Slack .install-btn .nc-app-store-card-install').should('not.exist'); + cy.toastWait("Successfully installed"); + cy.get( + ".nc-app-store-card-Slack .install-btn .nc-app-store-card-install" + ).should("not.exist"); // update slack app config - cy.get('.nc-app-store-card-Slack .install-btn .nc-app-store-card-edit').should('exist').click() - cy.getActiveModal('.nc-modal-plugin-install') - .should('exist') + cy.get(".nc-app-store-card-Slack .install-btn .nc-app-store-card-edit") + .should("exist") + .click(); + cy.getActiveModal(".nc-modal-plugin-install") + .should("exist") .find('[placeholder="Channel Name"]') - .should('have.value', 'Test channel') + .should("have.value", "Test channel") .clear() - .type('Test channel 2') + .type("Test channel 2"); - cy.getActiveModal('.nc-modal-plugin-install') + cy.getActiveModal(".nc-modal-plugin-install") .get('button:contains("Save")') - .click() - - - cy.toastWait('Successfully installed') + .click(); + cy.toastWait("Successfully installed"); // reset slack app - cy.get('.nc-app-store-card-Slack .install-btn .nc-app-store-card-reset').should('exist').click() + cy.get(".nc-app-store-card-Slack .install-btn .nc-app-store-card-reset") + .should("exist") + .click(); - cy.getActiveModal('.nc-modal-plugin-uninstall') - .should('exist') + cy.getActiveModal(".nc-modal-plugin-uninstall") + .should("exist") .find('button:contains("Confirm")') - .click() - - cy.toastWait('Plugin uninstalled successfully') + .click(); + cy.toastWait("Plugin uninstalled successfully"); }); - }); }); -} +}; diff --git a/scripts/cypress/integration/test/pg-restRoles.js b/scripts/cypress/integration/test/pg-restRoles.js index fa868a3df1..a2300c70f5 100644 --- a/scripts/cypress/integration/test/pg-restRoles.js +++ b/scripts/cypress/integration/test/pg-restRoles.js @@ -12,7 +12,7 @@ const nocoTestSuite = (apiType, dbType) => { t01.genTest(apiType, dbType); t5a.genTest(apiType, dbType); - // t5b.genTest(apiType, dbType); + t5b.genTest(apiType, dbType); t5c.genTest(apiType, dbType); }; diff --git a/scripts/cypress/integration/test/restRoles.js b/scripts/cypress/integration/test/restRoles.js index b636dff4ec..187cbaf1ec 100644 --- a/scripts/cypress/integration/test/restRoles.js +++ b/scripts/cypress/integration/test/restRoles.js @@ -12,9 +12,8 @@ const nocoTestSuite = (apiType, dbType) => { t01.genTest(apiType, dbType); t5a.genTest(apiType, dbType); - // t5b.genTest(apiType, dbType); - t5c.genTest(apiType, dbType); - + t5b.genTest(apiType, dbType); + t5c.genTest(apiType, dbType); }; nocoTestSuite("rest", "mysql"); diff --git a/scripts/cypress/integration/test/xcdb-restRoles.js b/scripts/cypress/integration/test/xcdb-restRoles.js index fd6edd531d..b49058dee1 100644 --- a/scripts/cypress/integration/test/xcdb-restRoles.js +++ b/scripts/cypress/integration/test/xcdb-restRoles.js @@ -12,7 +12,7 @@ const nocoTestSuite = (apiType, dbType) => { t01.genTest(apiType, dbType); t5a.genTest(apiType, dbType); - // t5b.genTest(apiType, dbType); + t5b.genTest(apiType, dbType); t5c.genTest(apiType, dbType); }; From 8a4b6fe3e39bef4aff851851603e4605b9bc359d Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Thu, 29 Sep 2022 12:46:24 +0530 Subject: [PATCH 11/49] docs: accessing CI-CD failure screenshots --- .../noco-docs/content/en/engineering/development-setup.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/noco-docs/content/en/engineering/development-setup.md b/packages/noco-docs/content/en/engineering/development-setup.md index 6f79ff9218..1f70d03381 100644 --- a/packages/noco-docs/content/en/engineering/development-setup.md +++ b/packages/noco-docs/content/en/engineering/development-setup.md @@ -170,3 +170,9 @@ npm run cypress:open ## Enabling CI-CD for draft PR CI-CD will be triggered on moving a PR from draft state to `Ready for review` state & on pushing changes to `Develop`. To verify CI-CD before requesting for review, add label `trigger-CI` on Draft PR. +## Accessing CI-CD failure screenshots +For Cypress tests, screenshots are captured on test failure. These will provide vital clues for debugging possible issues observed in CI-CD. To access screenshots, Open link associated with CI-CD run & click on `Artifacts` + +![Screenshot 2022-09-29 at 12 43 37 PM](https://user-images.githubusercontent.com/86527202/192965070-dc04b952-70fb-4197-b4bd-ca7eda066e60.png) + + From 0c542ee17a1e9edb3f357a60b7ac3cdb70f5f890 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Thu, 29 Sep 2022 13:52:28 +0530 Subject: [PATCH 12/49] test: preview-mode corrections Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- .../nc-gui/components/general/PreviewAs.vue | 4 +- .../integration/common/5b_preview_role.js | 88 ++++++++++--------- 2 files changed, 50 insertions(+), 42 deletions(-) diff --git a/packages/nc-gui/components/general/PreviewAs.vue b/packages/nc-gui/components/general/PreviewAs.vue index b99623b256..4faf78f335 100644 --- a/packages/nc-gui/components/general/PreviewAs.vue +++ b/packages/nc-gui/components/general/PreviewAs.vue @@ -82,7 +82,7 @@ watch(previewAs, (newRole) => {
-
+
{{ $t('general.close') }}
@@ -91,7 +91,7 @@ watch(previewAs, (newRole) => {