多维表格
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.

328 lines
11 KiB

import { mainPage } from "../../support/page_objects/mainPage";
import { roles } from "../../support/page_objects/projectConstants";
// Left hand navigation bar, validation for
// 1. Audit menu
// 2. Advance settings menu
// 3. Preview mode menu
//
export function _advSettings(roleType, previewMode) {
cy.log(roleType, previewMode);
let validationString =
true == roles[roleType].validations.advSettings ? "exist" : "not.exist";
cy.get(".nc-team-settings").should(validationString);
if (true === roles[roleType].validations.advSettings) {
// audit/advance settings menu visible only for owner/ creator
mainPage.navigationDraw(mainPage.AUDIT).should(validationString);
mainPage.closeMetaTab();
mainPage.navigationDraw(mainPage.APPSTORE).should(validationString);
mainPage.closeMetaTab();
mainPage.navigationDraw(mainPage.TEAM_N_AUTH).should(validationString);
mainPage.closeMetaTab();
mainPage
.navigationDraw(mainPage.PROJ_METADATA)
.should(validationString);
mainPage.closeMetaTab();
}
// option to add new user conditionally visible only to owner/ creator
cy.get('button:contains("New User")').should(validationString);
// preview button visibility
cy.get(".nc-btn-preview:visible").should(validationString);
// float menu in preview mode
if (true === previewMode) {
cy.get(".nc-floating-preview-btn").should("exist");
cy.getActiveMenu()
.find(`[type="radio"][value="${roles[roleType].name}"]`)
.should("be.checked");
}
// if (true == previewMode) {
// // preview mode, role toggle menubar is visible
// mainPage.navigationDraw(mainPage.ROLE_VIEW_EDITOR).should("exist");
// mainPage.navigationDraw(mainPage.ROLE_VIEW_COMMENTER).should("exist");
// mainPage.navigationDraw(mainPage.ROLE_VIEW_VIEWER).should("exist");
// mainPage.navigationDraw(mainPage.ROLE_VIEW_RESET).should("exist");
// } else {
// // normal mode, role toggle menubar is visible only for owner/ creator
// mainPage
// .navigationDraw(mainPage.ROLE_VIEW_EDITOR)
// .should(validationString);
// mainPage
// .navigationDraw(mainPage.ROLE_VIEW_COMMENTER)
// .should(validationString);
// mainPage
// .navigationDraw(mainPage.ROLE_VIEW_VIEWER)
// .should(validationString);
// }
cy.get("body").click("bottomRight");
}
export function _editSchema(roleType, previewMode) {
let columnName = "City";
let validationString =
true == roles[roleType].validations.editSchema ? "exist" : "not.exist";
if (false == previewMode) {
cy.openTableTab(columnName, 25);
}
// create table options
//
cy.get(".add-btn").should(validationString);
cy.get(".v-tabs-bar")
.eq(0)
feat: quick import (#2042) * wip: basic add / import layout * chore: move excel from create project options to project tabs * chore: move drag attributes & rm unused methods * chore: remove create project logic * chore: rm project title text field * fix: import excel into an existing project logic * refactor: add / import menu ui * feat: integrate with import-csv logic * wip: new csv import logic * feat: import csv basic ui * refactor: use excel adapter for csv import * chore: merge excel & csv together * fix: accept csv for import * i18n: add csv to excelSupport * fix: empty map & extract error msg * fix: duplicate columns with system fields during import * chore: rename excel import -> quick import * chore: separate csv & excel for better tele * chore: pass quickImportType * i18n: remove .csv from the message * fix: wrong import type * chore: hide gradient generator * fix: file type validation * i18n: add importCSV * fix: import button text * fix: set modal to false after importing * fix: header text in quick import * chore: show error message in parseAndExtractData * i18n: add csvURL * fix: import url label * fix: wrong import type * fix: failed to execute 'insertBefore' on 'Node' * fix: delete logic & add pv to first column * feat: set default primary value * chore: disable virtual columns in dropdown * fix: set pk & rqd to ID by default * docs: remove creating project from excel * docs: add quick import * feat: add loadFirstCreatedTableTab * feat: open the tab automatically after import * test/cypress: UI corrections for quick-import Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: add UI permission to Add / Import * fix: remove unnecessary drop handler * fix: wrong class name in cypress test * fix: use v-if instead of v-show * fix: move _isUIAllowed to parent v-menu Co-authored-by: Raju Udava <86527202+dstala@users.noreply.github.com>
3 years ago
.find(".add-btn.mdi-plus-box")
.should(validationString);
// delete table option
//
cy.get(".nc-table-delete-btn").should(validationString);
// add new column option
//
cy.get(".new-column-header").should(validationString);
// update column (edit/ delete menu)
//
cy.get(`th:contains(${columnName}) .mdi-menu-down`).should(
validationString
);
}
export function _editData(roleType, previewMode) {
let columnName = "City";
let validationString =
true == roles[roleType].validations.editData ? "exist" : "not.exist";
cy.openTableTab(columnName, 25);
// add new row option (from menu header)
//
cy.get(".nc-add-new-row-btn").should(validationString);
// update row option (right click)
//
cy.get(`tbody > :nth-child(4) > [data-col="City"]`).rightclick();
if (previewMode)
cy.getActiveMenu().contains("Insert New Row").should(validationString);
else cy.get(".menuable__content__active").should(validationString);
if (validationString == "exist") {
// right click options will exist (only for 'exist' case)
//
cy.getActiveMenu().contains("Insert New Row").should(validationString);
cy.getActiveMenu().contains("Delete Row").should(validationString);
cy.getActiveMenu()
.contains("Delete Selected Rows")
.should(validationString);
cy.get("body").type("{esc}");
// update cell contents option using row expander should be enabled
//
//cy.get('.nc-row-expand-icon').eq(4).click({ force: true })
cy.get(".v-input.row-checkbox")
.eq(4)
.next()
.next()
.click({ force: true });
cy.getActiveModal().find("button").contains("Save row").should("exist");
cy.get("body").type("{esc}");
} else {
// update cell contents option using row expander should be disabled
//
//cy.get('.nc-row-expand-icon').eq(4).click({ force: true })
cy.get(".v-input.row-checkbox")
.eq(4)
.next()
.next()
.click({ force: true });
cy.getActiveModal()
.find("button:disabled")
.contains("Save row")
.should("exist");
cy.getActiveModal().find("button").contains("Cancel").click();
cy.get("body").type("{esc}");
}
// double click cell entries to edit
//
cy.get(`tbody > :nth-child(4) > [data-col="City"]`)
.dblclick()
.find("input")
.should(validationString);
}
// read &/ update comment
// Viewer: only allowed to read
// Everyone else: read &/ update
//
export function _editComment(roleType, previewMode) {
let columnName = "City";
let validationString =
true == roles[roleType].validations.editComment
? "Comment added successfully"
: "Not allowed";
cy.openTableTab(columnName, 25);
// click on comment icon & type comment
//
cy.get(".v-input.row-checkbox").eq(4).next().next().click({ force: true });
// Expected response:
// Viewer: Not able to see comment option
// Everyone else: Comment added/read successfully
//
if ("viewer" == roleType) {
cy.getActiveModal()
.find(".mdi-comment-multiple-outline")
.should("not.exist");
} else {
cy.getActiveModal()
.find(".mdi-comment-multiple-outline")
.should("exist")
.click();
cy.getActiveModal().find(".comment-box").type("Comment-1{enter}");
// cy.toastWait('Comment added successfully')
cy.getActiveModal().find(".mdi-door-open").click();
cy.get("body")
.contains(validationString, { timeout: 2000 })
.should("exist");
}
cy.getActiveModal()
.find("button")
.contains("Cancel")
.should("exist")
.click();
cy.get("body").type("{esc}");
}
// 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
export function _viewMenu(roleType, previewMode, navDrawListCnt) {
let columnName = "City";
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
// let navDrawListCnt = 2;
// Download CSV
let actionsMenuItemsCnt = 1;
cy.openTableTab(columnName, 25);
let validationString =
true == roles[roleType].validations.shareView ? "exist" : "not.exist";
// validate if Share button is visible at header tool bar
cy.get("header.v-toolbar")
.eq(0)
.find('button:contains("Share")')
.should(validationString);
// Owner, Creator will have two navigation drawer (on each side of center panel)
if (roleType == "owner" || roleType == "creator") {
navDrawListCnt = 3;
// Download CSV / Upload CSV / Shared View List / Webhook
actionsMenuItemsCnt = 4;
} else if (roleType == "editor") {
// Download CSV / Upload CSV
actionsMenuItemsCnt = 2;
}
cy.get(".v-navigation-drawer__content")
.eq(1)
.find('[role="list"]')
.should("have.length", navDrawListCnt);
// view list field (default GRID view)
cy.get(`.nc-view-item`).should("exist");
// view create option, exists only for owner/ creator
cy.get(`.nc-create-gallery-view`).should(validationString);
cy.get(`.nc-create-grid-view`).should(validationString);
cy.get(`.nc-create-form-view`).should(validationString);
// share view & automations, exists only for owner/creator
// cy.get(`.nc-share-view`).should(validationString);
// cy.get(`.nc-automations`).should(validationString);
// mainPage.shareView().should(validationString);
// mainPage.automations().should(validationString);
// share view permissions are role specific
cy.get(".nc-btn-share-view").should(validationString);
// actions menu (more), only download csv should be visible for non-previlaged users
cy.get(".nc-actions-menu-btn").click();
cy.getActiveMenu()
.find('[role="menuitem"]')
.should("have.length", actionsMenuItemsCnt);
}
export function _topRightMenu(roleType, previewMode) {
// kludge; download csv menu persists until clicked
let columnName = "City";
cy.closeTableTab(columnName);
cy.openTableTab(columnName, 25);
let validationString =
true == roles[roleType].validations.shareView ? "exist" : "not.exist";
cy.get(".nc-topright-menu").find(".nc-menu-share").should(validationString);
// cy.get(".nc-topright-menu").find(".nc-menu-theme").should("exist");
// cy.get(".nc-topright-menu").find(".nc-menu-dark-theme").should("exist");
cy.get(".nc-topright-menu").find(".nc-menu-translate").should("exist");
cy.get(".nc-topright-menu").find(".nc-menu-account").should("exist");
// cy.get(".nc-topright-menu").find(".nc-menu-alert").should("exist");
}
// Access control list
//
export function disableTableAccess(tbl, role) {
const cls = `.nc-acl-${tbl}-${role}-chkbox`;
cy.get(cls).find("input").should("be.checked").click({ force: true });
cy.get(cls).find("input").should("not.be.checked");
cy.get(".nc-acl-save").next().click({ force: true });
cy.toastWait("Updated UI ACL for tables successfully");
}
export function enableTableAccess(tbl, role) {
const cls = `.nc-acl-${tbl}-${role}-chkbox`;
cy.get(cls).find("input").should("not.be.checked").click({ force: true });
cy.get(cls).find("input").should("be.checked");
cy.get(".nc-acl-save").next().click({ force: true });
cy.toastWait("Updated UI ACL for tables successfully");
}
export function _accessControl(roleType, previewMode) {
let validationString = roleType == "creator" ? "exist" : "not.exist";
cy.get(".nc-project-tree")
.find(".v-list-item__title:contains(Tables)", { timeout: 10000 })
.should("exist")
.first()
.click({ force: true });
cy.get(".nc-project-tree")
.contains("Language", { timeout: 6000 })
.should(validationString);
cy.get(".nc-project-tree")
.contains("CustomerList", { timeout: 6000 })
.should(validationString);
cy.get(".nc-project-tree")
.find(".v-list-item__title:contains(Tables)", { timeout: 10000 })
.first()
.click({ force: true });
}