多维表格
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

165 lines
5.6 KiB

// pre-requisite:
// user@nocodb.com signed up as admin
// sakilaDb database created already
import { loginPage, projectsPage } from "../../support/page_objects/navigation";
import { mainPage } from "../../support/page_objects/mainPage";
import {
isPostgres,
isTestSuiteActive,
isXcdb,
} from "../../support/page_objects/projectConstants";
import {
_advSettings,
_editSchema,
_editData,
_editComment,
_viewMenu,
_topRightMenu,
enableTableAccess,
_accessControl,
} from "../spec/roleValidation.spec";
export const genTest = (apiType, dbType, roleType) => {
if (!isTestSuiteActive(apiType, dbType)) return;
///////////////////////////////////////////////////////////
//// Test Suite
describe("Role preview validations", () => {
// Sign in/ open project
before(() => {
loginPage.loginAndOpenProject(apiType, dbType);
cy.openTableTab("City", 25);
cy.get(".nc-btn-preview").click();
cy.getActiveMenu()
.find(".nc-preview-editor")
.should("exist")
.click();
});
after(() => {
// cy.get(".nc-preview-reset").click({ force: true });
cy.get(".mdi-exit-to-app").click();
// cy.wait(20000)
// wait for page rendering to complete
cy.get(".nc-grid-row", { timeout: 25000 }).should(
"have.length",
25
);
// cy.get('.nc-preview-reset:visible').should('not-exist')
// mainPage.navigationDraw(mainPage.ROLE_VIEW).contains('Reset Preview').should('not.exist')
// cy.get('.nc-preview-reset').should('not-exist')
cy.closeTableTab("City");
// open Project metadata tab
//
mainPage.navigationDraw(mainPage.PROJ_METADATA).click();
// cy.get(".nc-exp-imp-metadata").dblclick({ force: true });
cy.get(".nc-ui-acl-tab").click({ force: true });
// validate if it has 19 entries representing tables & views
if (isPostgres())
cy.get(".nc-acl-table-row").should("have.length", 24);
else if (isXcdb())
cy.get(".nc-acl-table-row").should("have.length", 19);
else cy.get(".nc-acl-table-row").should("have.length", 19);
// restore access
//
enableTableAccess("language", "editor");
enableTableAccess("language", "commenter");
enableTableAccess("language", "viewer");
enableTableAccess("customerlist", "editor");
enableTableAccess("customerlist", "commenter");
enableTableAccess("customerlist", "viewer");
});
const genTestSub = (roleType) => {
it(`Role preview: ${roleType}: Enable preview`, () => {
cy.get(`.nc-floating-preview-${roleType}`).click();
});
it(`Role preview: ${roleType}: Advance settings`, () => {
// project configuration settings
//
_advSettings(roleType, true);
});
it(`Role preview: ${roleType}: Access control`, () => {
// Access control validation
//
_accessControl(roleType, false);
});
it(`Role preview: ${roleType}: Edit data`, () => {
// Table data related validations
// - Add/delete/modify row
//
_editData(roleType, true);
});
it(`Role preview: ${roleType}: Edit comment`, () => {
// read &/ update comment
// Viewer: not allowed to read
// Everyone else: read &/ update
//
_editComment(roleType, true);
});
it(`Role preview: ${roleType}: Preview menu`, () => {
// right navigation menu bar
// Editor/Viewer/Commenter : can only view 'existing' views
// Rest: can create/edit
Feat - Next release improvements and bug fixes (#2120) * refactor: include log lev3l in progress Signed-off-by: Pranav C <pranavxc@gmail.com> * feat: migration logs classification Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: escape `?` in query Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: handle leading/trailing whitespace in table name re #2073 Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: replace knex.raw replace `knex.raw` with `knex.from` since response is different for each client Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: created time & modified time handling as dateTime datatype Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: at import issue and data list api corrections Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: richtext migration support Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: filter to ignore dateTime datatype along with date datatype Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: replace all occurance of . from column name Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * refactoring Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: correction in read api Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: keep correct dtxp value Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: replace ? with _ during column name processing Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * refactoring Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: allow singleLineText to text type instead of tinytext Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * chore: start scripts for pg Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * refactor: thumbnail size increased by 3x Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: exclude whitespace from table name and single select rendering correction Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: execute without extracting raw query in pg Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: upgrade nc-help Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: replace special characters in column name with an _ Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: handle duplicate table name Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: replace , in select options with a . Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: for title, trim only spaces Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: multiselect and single select import and rendering Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: unique column name generator Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: mmlist query correction Signed-off-by: Pranav C <pranavxc@gmail.com> * refactor: use common function for column/table name generation Signed-off-by: Pranav C <pranavxc@gmail.com> * refactor: type correction Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: upgrade nc-help Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: form view field alias & help text migration Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: handle column name referenced by $ * refactor: rename system field, change its position during creation Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: replace . in column name with _ Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: skip rollup for checkbox Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: replace title with id's in viewRowData APIs Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * chore: code cleanup and we are hiring button Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: ignore escaping . in alias Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: headercell overflow Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: support presence of existing tables during migration Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * enhancement: add reach out here link Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: skip default value configuration during import Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * enhancement: webhook prefill default values Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: add missing component properties Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: missing gallery view cover image re # 2099 Signed-off-by: Pranav C <pranavxc@gmail.com> * cache: fix view:[object Object] * fix: hide websocket button and other buttons from shared form view re # 2107 Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: hide virtual columns which are not relevant in expanded form(add) Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: handle view cache based on returned value Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: add galleryViewGet permission for roles Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: upgrade nc-help Signed-off-by: Pranav C <pranavxc@gmail.com> * refactor: add beta label Signed-off-by: Pranav C <pranavxc@gmail.com> * refactor: add beta label Signed-off-by: Pranav C <pranavxc@gmail.com> * test/cypress: fix- corrections for baseShare UI change Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test/cypress: fix view menu count Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: disable default autocomplete Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: update docs link Signed-off-by: Pranav C <pranavxc@gmail.com> Co-authored-by: Raju Udava <86527202+dstala@users.noreply.github.com> Co-authored-by: Wing-Kam Wong <wingkwong.code@gmail.com>
3 years ago
_viewMenu(roleType, true, 2);
});
it(`Role preview: ${roleType}: Top Right Menu bar`, () => {
// Share button is conditional
// Rest are static/ mandatory
//
_topRightMenu(roleType, false);
});
it(`Role preview: ${roleType}: Edit Schema`, () => {
// Schema related validations
// - Add/delete table
// - Add/Update/delete column
//
_editSchema(roleType, true);
});
};
genTestSub("editor");
genTestSub("commenter");
genTestSub("viewer");
});
};
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
*
* @author Pranav C Balan <pranavxc@gmail.com>
* @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/>.
*
*/