Browse Source

test: ERD base

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/3612/head
Raju Udava 2 years ago committed by Muhammed Mustafa
parent
commit
99726a55b9
  1. 4
      packages/nc-gui/components/erd/View.vue
  2. 16
      scripts/cypress/cypress.json
  3. 72
      scripts/cypress/integration/common/9b_ERD.js
  4. 37
      scripts/cypress/integration/test/restMisc.js
  5. 33
      scripts/cypress/support/page_objects/mainPage.js

4
packages/nc-gui/components/erd/View.vue

@ -94,7 +94,9 @@ watch(
<div v-else class="relative h-full"> <div v-else class="relative h-full">
<ErdSimpleView :key="erdKey" :tables="tablesFilteredWithConfig" :config="config" /> <ErdSimpleView :key="erdKey" :tables="tablesFilteredWithConfig" :config="config" />
<div class="absolute top-2 right-10 flex-col bg-white py-2 px-4 border-1 border-gray-100 rounded-md z-50 space-y-1"> <div
class="absolute top-2 right-10 flex-col bg-white py-2 px-4 border-1 border-gray-100 rounded-md z-50 space-y-1 nc-erd-context-menu"
>
<div class="flex flex-row items-center"> <div class="flex flex-row items-center">
<a-checkbox v-model:checked="config.showAllColumns" v-e="['c:erd:showAllColumns']" /> <a-checkbox v-model:checked="config.showAllColumns" v-e="['c:erd:showAllColumns']" />
<span class="ml-2 select-none" style="font-size: 0.65rem" @dblclick="showAdvancedOptions = true">{{ <span class="ml-2 select-none" style="font-size: 0.65rem" @dblclick="showAdvancedOptions = true">{{

16
scripts/cypress/cypress.json

@ -1,19 +1,7 @@
{ {
"baseUrl": "http://localhost:3000/", "baseUrl": "http://localhost:3000/",
"testFiles": [ "testFiles": [
"test/restTableOps.js", "test/restMisc.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"
], ],
"defaultCommandTimeout": 13000, "defaultCommandTimeout": 13000,
"pageLoadTimeout": 600000, "pageLoadTimeout": 600000,
@ -22,7 +10,7 @@
"video": false, "video": false,
"retries": 0, "retries": 0,
"screenshotOnRunFailure": true, "screenshotOnRunFailure": true,
"numTestsKeptInMemory": 0, "numTestsKeptInMemory": 5,
"experimentalInteractiveRunEvents": true, "experimentalInteractiveRunEvents": true,
"env": { "env": {
"testMode": [ "testMode": [

72
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 <sivadstala@gmail.com>
*
* @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 <http://www.gnu.org/licenses/>.
*
*/

37
scripts/cypress/integration/test/restMisc.js

@ -7,30 +7,33 @@ let t6e = require("../common/6e_project_operations");
let t6f = require("../common/6f_attachments"); let t6f = require("../common/6f_attachments");
let t6g = require("../common/6g_base_share"); let t6g = require("../common/6g_base_share");
let t7a = require("../common/7a_create_project_from_excel"); 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 { const {
setCurrentMode, setCurrentMode,
} = require("../../support/page_objects/projectConstants"); } = require("../../support/page_objects/projectConstants");
const nocoTestSuite = (apiType, dbType) => { const nocoTestSuite = (apiType, dbType) => {
setCurrentMode(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); t9b.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);
}; };
nocoTestSuite("rest", "mysql"); nocoTestSuite("rest", "mysql");

33
scripts/cypress/support/page_objects/mainPage.js

@ -16,7 +16,7 @@ export class _settingsPage {
// menu // menu
this.TEAM_N_AUTH = "teamAndAuth"; this.TEAM_N_AUTH = "teamAndAuth";
this.APPSTORE = "appStore"; this.APPSTORE = "appStore";
this.PROJ_METADATA = "metaData"; this.PROJ_METADATA = "projMetaData";
this.AUDIT = "audit"; this.AUDIT = "audit";
// submenu // submenu
@ -26,6 +26,8 @@ export class _settingsPage {
this.METADATA = "metaData"; this.METADATA = "metaData";
this.UI_ACCESS_CONTROL = "acl"; this.UI_ACCESS_CONTROL = "acl";
this.AUDIT_LOG = "audit"; this.AUDIT_LOG = "audit";
this.ERD = "erd";
this.MISC = "misc";
} }
openMenu(menuId) { openMenu(menuId) {
@ -40,6 +42,35 @@ export class _settingsPage {
cy.get(`[data-menu-id=${menuId}]`).should("exist").click(); 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) { openTab(tabId) {
cy.get(`[data-menu-id=${tabId}]`).should("exist").last().click(); cy.get(`[data-menu-id=${tabId}]`).should("exist").last().click();
} }

Loading…
Cancel
Save