From 99726a55b96a8a53ec47bdd9683d3b085c0b54b6 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Fri, 16 Sep 2022 20:19:51 +0530 Subject: [PATCH] test: ERD base Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- packages/nc-gui/components/erd/View.vue | 4 +- scripts/cypress/cypress.json | 16 +---- scripts/cypress/integration/common/9b_ERD.js | 72 +++++++++++++++++++ scripts/cypress/integration/test/restMisc.js | 37 +++++----- .../cypress/support/page_objects/mainPage.js | 33 ++++++++- 5 files changed, 129 insertions(+), 33 deletions(-) create mode 100644 scripts/cypress/integration/common/9b_ERD.js diff --git a/packages/nc-gui/components/erd/View.vue b/packages/nc-gui/components/erd/View.vue index b47204e935..c3e6ed75cb 100644 --- a/packages/nc-gui/components/erd/View.vue +++ b/packages/nc-gui/components/erd/View.vue @@ -94,7 +94,9 @@ watch(
-
+
{{ diff --git a/scripts/cypress/cypress.json b/scripts/cypress/cypress.json index 2d162a3676..97f7179022 100644 --- a/scripts/cypress/cypress.json +++ b/scripts/cypress/cypress.json @@ -1,19 +1,7 @@ { "baseUrl": "http://localhost:3000/", "testFiles": [ - "test/restTableOps.js", - "test/restViews.js", - "test/restRoles.js", - "test/restMisc.js", - "test/xcdb-restTableOps.js", - "test/xcdb-restViews.js", - "test/xcdb-restRoles.js", - "test/xcdb-restMisc.js", - "test/pg-restTableOps.js", - "test/pg-restViews.js", - "test/pg-restRoles.js", - "test/pg-restMisc.js", - "test/quickTest.js" + "test/restMisc.js" ], "defaultCommandTimeout": 13000, "pageLoadTimeout": 600000, @@ -22,7 +10,7 @@ "video": false, "retries": 0, "screenshotOnRunFailure": true, - "numTestsKeptInMemory": 0, + "numTestsKeptInMemory": 5, "experimentalInteractiveRunEvents": true, "env": { "testMode": [ diff --git a/scripts/cypress/integration/common/9b_ERD.js b/scripts/cypress/integration/common/9b_ERD.js new file mode 100644 index 0000000000..90a5e1c98c --- /dev/null +++ b/scripts/cypress/integration/common/9b_ERD.js @@ -0,0 +1,72 @@ +import { mainPage, settingsPage } from "../../support/page_objects/mainPage"; +import {loginPage, projectsPage} from "../../support/page_objects/navigation"; +import { isTestSuiteActive } from "../../support/page_objects/projectConstants"; + +export const genTest = (apiType, dbType) => { + if (!isTestSuiteActive(apiType, dbType)) return; + + describe(`${apiType.toUpperCase()} ERD`, () => { + before(() => { + loginPage.loginAndOpenProject(apiType, dbType); + cy.openTableTab("Country", 25); + cy.saveLocalStorage(); + }); + + beforeEach(() => { + cy.restoreLocalStorage(); + }) + + afterEach(() => { + cy.saveLocalStorage(); + }) + + after(() => { + cy.restoreLocalStorage(); + cy.closeTableTab("Country"); + cy.saveLocalStorage(); + }); + + // Test cases + + it(`Open Table ERD`, () => { + mainPage.openErdTab(); + }); + + it(`Verify ERD Context menu`, () => { + cy.get('.nc-erd-context-menu').should('be.visible'); + cy.get('.nc-erd-context-menu').find('.ant-checkbox').should('have.length', 3); + cy.get('.nc-erd-context-menu').find('.ant-checkbox').eq(0).should('have.class', 'ant-checkbox-checked'); + cy.get('.nc-erd-context-menu').find('.ant-checkbox').eq(1).should('have.class', 'ant-checkbox-checked'); + cy.get('.nc-erd-context-menu').find('.ant-checkbox').eq(2).should('not.have.class', 'ant-checkbox-checked'); + + cy.get('.nc-erd-context-menu').find('.ant-checkbox').eq(0).click(); + }); + + it(`test-1`, () => { + cy.log("test-1"); + }); + + }); +}; + +/** + * @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/restMisc.js b/scripts/cypress/integration/test/restMisc.js index d348792c20..8f40fb6be2 100644 --- a/scripts/cypress/integration/test/restMisc.js +++ b/scripts/cypress/integration/test/restMisc.js @@ -7,30 +7,33 @@ 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"); -let t8a = require("../common/8a_webhook") +let t8a = require("../common/8a_webhook"); +let t9b = require("../common/9b_ERD"); const { setCurrentMode, } = require("../../support/page_objects/projectConstants"); const nocoTestSuite = (apiType, dbType) => { setCurrentMode(apiType, dbType); - t01.genTest(apiType, dbType); + // t01.genTest(apiType, dbType); + // + // t6b.genTest(apiType, dbType); + // t6d.genTest(apiType, dbType); + // // exclude@ncv2 t6c.genTest(apiType, dbType); + // t6f.genTest(apiType, dbType); + // t6g.genTest(apiType, dbType); + // + // // webhook tests + // t8a.genTest(apiType, dbType) + // + // // **deletes created project, hence place it @ end + // t6e.genTest(apiType, dbType); + // + // // intended to keep this after earlier project deletion + // // creates project using excel & deletes it + // t7a.genTest(apiType, dbType); - t6b.genTest(apiType, dbType); - t6d.genTest(apiType, dbType); - // exclude@ncv2 t6c.genTest(apiType, dbType); - t6f.genTest(apiType, dbType); - t6g.genTest(apiType, dbType); - - // webhook tests - t8a.genTest(apiType, dbType) - - // **deletes created project, hence place it @ end - t6e.genTest(apiType, dbType); - - // intended to keep this after earlier project deletion - // creates project using excel & deletes it - t7a.genTest(apiType, dbType); + t9b.genTest(apiType, dbType); }; nocoTestSuite("rest", "mysql"); diff --git a/scripts/cypress/support/page_objects/mainPage.js b/scripts/cypress/support/page_objects/mainPage.js index 63b431512a..ab55fda4bf 100644 --- a/scripts/cypress/support/page_objects/mainPage.js +++ b/scripts/cypress/support/page_objects/mainPage.js @@ -16,7 +16,7 @@ export class _settingsPage { // menu this.TEAM_N_AUTH = "teamAndAuth"; this.APPSTORE = "appStore"; - this.PROJ_METADATA = "metaData"; + this.PROJ_METADATA = "projMetaData"; this.AUDIT = "audit"; // submenu @@ -26,6 +26,8 @@ export class _settingsPage { this.METADATA = "metaData"; this.UI_ACCESS_CONTROL = "acl"; this.AUDIT_LOG = "audit"; + this.ERD = "erd"; + this.MISC = "misc"; } openMenu(menuId) { @@ -40,6 +42,35 @@ export class _settingsPage { cy.get(`[data-menu-id=${menuId}]`).should("exist").click(); } + openMiscTab() { + // open Project metadata tab + // + settingsPage.openMenu(settingsPage.PROJ_METADATA); + settingsPage.openTab(settingsPage.MISC); + } + + toggleShowMMSetting() { + // toggle show MM setting + // + this.openMiscTab(); + cy.get(".nc-settings-meta-misc").click(); + + settingsPage.openTab(settingsPage.TEAM_N_AUTH); + this.closeMetaTab(); + } + + openErdTab() { + // open Project metadata tab + // + settingsPage.openMenu(settingsPage.PROJ_METADATA); + settingsPage.openTab(settingsPage.ERD); + } + + openTableErdView() { + cy.get(".nc-actions-menu-btn").should("exist").click(); + cy.get(".nc-view-action-erd").should("exist").click(); + } + openTab(tabId) { cy.get(`[data-menu-id=${tabId}]`).should("exist").last().click(); }