diff --git a/packages/nocodb/tests/unit/tsconfig.json b/packages/nocodb/tests/unit/tsconfig.json index e6f013a8a0..e361d28856 100644 --- a/packages/nocodb/tests/unit/tsconfig.json +++ b/packages/nocodb/tests/unit/tsconfig.json @@ -45,7 +45,7 @@ // "emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */, "lib": [ - "es2017", "DOM" + "es2017" ], "types": [ "mocha", "node" diff --git a/scripts/cypress/cypress.json b/scripts/cypress/cypress.json index eb8a6c4f92..c916289496 100644 --- a/scripts/cypress/cypress.json +++ b/scripts/cypress/cypress.json @@ -14,9 +14,7 @@ "test/pg-restRoles.js", "test/pg-restMisc.js", "test/quickTest.js", - "test/db-independent.js", - "test/pg-restMiscV2.js", - "test/restMiscV2.js" + "test/db-independent.js" ], "defaultCommandTimeout": 13000, "pageLoadTimeout": 600000, diff --git a/scripts/cypress/integration/common/6b_downloadCsv.js b/scripts/cypress/integration/common/6b_downloadCsv.js index 45f1389512..3b5e3bf27d 100644 --- a/scripts/cypress/integration/common/6b_downloadCsv.js +++ b/scripts/cypress/integration/common/6b_downloadCsv.js @@ -9,9 +9,10 @@ export const genTest = (apiType, dbType) => { if (!isTestSuiteActive(apiType, dbType)) return; describe(`${apiType.toUpperCase()} Upload/ Download CSV`, () => { - before(() => { - cy.setup({ dbType }) - }); + // before(() => { + // // standalone test + // // loginPage.loginAndOpenProject(apiType, dbType); + // }); beforeEach(() => { cy.restoreLocalStorage(); diff --git a/scripts/cypress/integration/common/6f_attachments.js b/scripts/cypress/integration/common/6f_attachments.js index b7b5d45556..13ea95295d 100644 --- a/scripts/cypress/integration/common/6f_attachments.js +++ b/scripts/cypress/integration/common/6f_attachments.js @@ -6,9 +6,9 @@ export const genTest = (apiType, dbType) => { if (!isTestSuiteActive(apiType, dbType)) return; describe(`${apiType.toUpperCase()} Columns of type attachment`, () => { - before(() => { - cy.setup({ dbType }) - }); + // before(() => { + // // loginPage.loginAndOpenProject(apiType, dbType); + // }); beforeEach(() => { cy.restoreLocalStorage(); diff --git a/scripts/cypress/integration/common/9b_ERD.js b/scripts/cypress/integration/common/9b_ERD.js index 983308eeb6..db8dc64261 100644 --- a/scripts/cypress/integration/common/9b_ERD.js +++ b/scripts/cypress/integration/common/9b_ERD.js @@ -15,23 +15,22 @@ export const genTest = (apiType, dbType) => { before(() => { cy.restoreLocalStorage(); - cy.setup({ dbType }).then(({project}) => { - cy.openTableTab("Country", 25); - - projectId = project.id - if (dbType === "postgres") { - sakilaTables = pgSakilaTables; - sakilaSqlViews = pgSakilaSqlViews; - } else if(dbType === "mysql") { - sakilaTables = mysqlSakilaTables; - sakilaSqlViews = mysqlSakilaSqlViews; - } else if(dbType === "xcdb") { - sakilaTables = mysqlSakilaTables.map((tableName) => `${projectId}${tableName}`); - sakilaSqlViews = sqliteSakilaSqlViews.map((viewName) => `${projectId}${viewName}`); - } - cy.saveLocalStorage(); - }) + // loginPage.loginAndOpenProject(apiType, dbType); + cy.openTableTab("Country", 25); + projectId = getProjectString() + cy.log('erd:getProjectString' + projectId) + if (dbType === "postgres") { + sakilaTables = pgSakilaTables; + sakilaSqlViews = pgSakilaSqlViews; + } else if(dbType === "mysql") { + sakilaTables = mysqlSakilaTables; + sakilaSqlViews = mysqlSakilaSqlViews; + } else if(dbType === "xcdb") { + sakilaTables = mysqlSakilaTables.map((tableName) => `${projectId}${tableName}`); + sakilaSqlViews = sqliteSakilaSqlViews.map((viewName) => `${projectId}${viewName}`); + } + cy.saveLocalStorage(); }); beforeEach(() => { @@ -42,10 +41,16 @@ export const genTest = (apiType, dbType) => { cy.saveLocalStorage(); }) + after(() => { + cy.restoreLocalStorage(); + cy.closeTableTab("Country"); + cy.saveLocalStorage(); + }); + // Test cases it(`Enable MM setting Open Table ERD`, () => { - cy.openTableTab("Country", 25); + // cy.openTableTab("Country", 25); mainPage.toggleShowMMSetting(); mainPage.openErdTab(); diff --git a/scripts/cypress/integration/test/pg-restMiscV2.js b/scripts/cypress/integration/test/pg-restMiscV2.js deleted file mode 100644 index 5f02e27af1..0000000000 --- a/scripts/cypress/integration/test/pg-restMiscV2.js +++ /dev/null @@ -1,51 +0,0 @@ -// let t0 = require("./explicitLogin"); -// let t01 = require("../common/00_pre_configurations"); -let t6b = require("../common/6b_downloadCsv"); -// let t6c = require("../common/6c_swagger_api"); -// let t6d = require("../common/6d_language_validation"); -// let t6e = require("../common/6e_project_operations"); -let t6f = require("../common/6f_attachments"); -// let t6g = require("../common/6g_base_share"); -// let t7a = require("../common/7a_create_project_from_excel"); -const { - setCurrentMode, -} = require("../../support/page_objects/projectConstants"); -// const t8a = require("../common/8a_webhook"); -const t9b = require("../common/9b_ERD"); - -const nocoTestSuite = (apiType, dbType) => { - setCurrentMode(apiType, dbType); - - // Download CSV - t6b.genTest(apiType, dbType); - - // Attachment cell - t6f.genTest(apiType, dbType); - - // ERD: - t9b.genTest(apiType, dbType); -}; - -nocoTestSuite("rest", "postgres"); - -/** - * @copyright Copyright (c) 2021, Xgene Cloud Ltd - * - * @author Raju Udava - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ diff --git a/scripts/cypress/integration/test/restMiscV2.js b/scripts/cypress/integration/test/restMiscV2.js deleted file mode 100644 index 293b70a3d3..0000000000 --- a/scripts/cypress/integration/test/restMiscV2.js +++ /dev/null @@ -1,30 +0,0 @@ -// let t0 = require("./explicitLogin"); -// let t01 = require("../common/00_pre_configurations"); -let t6b = require("../common/6b_downloadCsv"); -// let t6c = require("../common/6c_swagger_api"); -// let t6d = require("../common/6d_language_validation"); -// let t6e = require("../common/6e_project_operations"); -let t6f = require("../common/6f_attachments"); -// let t6g = require("../common/6g_base_share"); -// let t7a = require("../common/7a_create_project_from_excel"); -const { - setCurrentMode, -} = require("../../support/page_objects/projectConstants"); -// const t8a = require("../common/8a_webhook"); -const t9b = require("../common/9b_ERD"); - -const nocoTestSuite = (apiType, dbType) => { - setCurrentMode(apiType, dbType); - - // Download CSV - t6b.genTest(apiType, dbType); - - // Attachment cell - t6f.genTest(apiType, dbType); - - // ERD: - t9b.genTest(apiType, dbType); -}; - -nocoTestSuite("rest", "mysql"); - diff --git a/scripts/cypress/support/commands.js b/scripts/cypress/support/commands.js index e7cc5a3bfb..d3028fc528 100644 --- a/scripts/cypress/support/commands.js +++ b/scripts/cypress/support/commands.js @@ -29,46 +29,6 @@ import { isXcdb, isPostgres } from "./page_objects/projectConstants"; require("@4tw/cypress-drag-drop"); -let LOCAL_STORAGE_MEMORY = {}; -let LOCAL_STORAGE_MEMORY_v2 = {}; - -Cypress.Commands.add('setup', ({ dbType }) => { - cy.request('GET', 'http://localhost:8080/api/v1/meta/test/reset').then((response) => { - LOCAL_STORAGE_MEMORY = { - "nocodb-gui-v2": JSON.stringify({ - "token": response.body.token, - darkMode: false, - }) - } - cy.restoreLocalStorage().then(() => { - console.log('setup done', localStorage.getItem('nocodb-gui-v2')) - - Cypress.LocalStorage.clear = () => {}; - - let project; - - if(dbType === "postgres") { - project = response.body.projects.find((project) => project.title === 'pgExtREST'); - } - - if(dbType === "mysql") { - project = response.body.projects.find((project) => project.title === 'externalREST'); - } - - cy.visit(`http://localhost:3000/#/nc/${project.id}/auth`, { - retryOnNetworkFailure: true, - timeout: 1200000, - headers: { - "Accept-Encoding": "gzip, deflate", - } - }) - .getSettled('.nc-noco-brand-icon', {delay: 100}).should('be.visible') - .then(() => { - return {token: response.body.token, project} - }); - }) - }) -}); // recursively gets an element, returning only after it's determined to be attached to the DOM for good Cypress.Commands.add("getSettled", (selector, opts = {}) => { @@ -284,6 +244,9 @@ Cypress.Commands.add("openOrCreateGqlProject", (_args) => { cy.url({ timeout: 20000 }).should("contain", "#/nc/"); }); +let LOCAL_STORAGE_MEMORY = {}; +let LOCAL_STORAGE_MEMORY_v2 = {}; + Cypress.Commands.add("saveLocalStorage", (name) => { LOCAL_STORAGE_MEMORY = {}; Object.keys(localStorage).forEach((key) => {