mirror of https://github.com/nocodb/nocodb
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.
128 lines
4.9 KiB
128 lines
4.9 KiB
3 years ago
|
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
|
||
|
import { mainPage } from "../../support/page_objects/mainPage";
|
||
3 years ago
|
|
||
3 years ago
|
export const genTest = (apiType, dbType) => {
|
||
3 years ago
|
if (!isTestSuiteActive(apiType, dbType)) return;
|
||
3 years ago
|
|
||
3 years ago
|
describe(`${apiType.toUpperCase()} api - Lock view`, () => {
|
||
|
// Run once before test- create project (rest/graphql)
|
||
|
//
|
||
|
before(() => {
|
||
3 years ago
|
mainPage.tabReset();
|
||
3 years ago
|
// open a table to work on views
|
||
|
//
|
||
|
cy.openTableTab("Country", 25);
|
||
|
});
|
||
3 years ago
|
|
||
3 years ago
|
after(() => {
|
||
|
cy.closeTableTab("Country");
|
||
|
});
|
||
3 years ago
|
|
||
3 years ago
|
const lockViewTest = (enabled) => {
|
||
|
it(`Grid: lock view set to ${enabled}: validation`, () => {
|
||
|
let vString = enabled ? "not." : "";
|
||
|
let menuOption = enabled ? 1 : 0;
|
||
3 years ago
|
|
||
3 years ago
|
// on menu, collaboration view appears first (at index 0)
|
||
|
// followed by Locked view (at index 1)
|
||
|
cy.get(".xc-toolbar")
|
||
|
.find(".nc-view-lock-menu:enabled")
|
||
|
.click();
|
||
|
cy.snipActiveMenu("Menu_Collaboration");
|
||
|
cy.getActiveMenu()
|
||
|
.find('[role="menuitem"]')
|
||
|
.eq(menuOption)
|
||
|
.click();
|
||
3 years ago
|
|
||
3 years ago
|
// expected toolbar for Lock view: Only lock-view menu, reload, toggle-nav-drawer to be enabled
|
||
|
//
|
||
|
cy.get(".xc-toolbar")
|
||
|
.find(".nc-view-lock-menu:enabled")
|
||
|
.should("exist");
|
||
|
cy.get(".xc-toolbar")
|
||
|
.find(".nc-table-reload-btn:enabled")
|
||
|
.should("exist");
|
||
|
cy.get(".xc-toolbar")
|
||
|
.find(".nc-add-new-row-btn:enabled")
|
||
|
.should(`${vString}exist`);
|
||
|
// cy.get('.xc-toolbar').find('.nc-save-new-row-btn:disabled') .should('exist')
|
||
|
cy.get(".xc-toolbar")
|
||
|
.find(".nc-fields-menu-btn:enabled")
|
||
|
.should(`${vString}exist`);
|
||
|
cy.get(".xc-toolbar")
|
||
|
.find(".nc-sort-menu-btn:enabled")
|
||
|
.should(`${vString}exist`);
|
||
|
cy.get(".xc-toolbar")
|
||
|
.find(".nc-filter-menu-btn:enabled")
|
||
|
.should(`${vString}exist`);
|
||
|
cy.get(".xc-toolbar")
|
||
|
.find(".nc-table-delete-btn:enabled")
|
||
|
.should(`${vString}exist`);
|
||
|
cy.get(".xc-toolbar")
|
||
|
.find(".nc-toggle-nav-drawer:enabled")
|
||
|
.should("exist");
|
||
3 years ago
|
|
||
3 years ago
|
// dblClick on a cell & see if we can edit
|
||
|
mainPage.getCell("Country", 1).dblclick();
|
||
|
mainPage
|
||
|
.getCell("Country", 1)
|
||
|
.find("input")
|
||
|
.should(`${vString}exist`);
|
||
3 years ago
|
|
||
3 years ago
|
// check if expand row option is available?
|
||
|
cy.get("td")
|
||
|
.find(".nc-row-expand-icon")
|
||
|
.should(`${vString}exist`);
|
||
|
// alt validation: mainPage.getRow(1).find('.nc-row-expand-icon').should(`${vString}exist`)
|
||
3 years ago
|
|
||
3 years ago
|
// check if add/ expand options available for 'has many' column type
|
||
|
mainPage
|
||
2 years ago
|
.getCell("City List", 1)
|
||
3 years ago
|
.click()
|
||
|
.find("button.mdi-plus")
|
||
|
.should(`${vString}exist`);
|
||
|
mainPage
|
||
2 years ago
|
.getCell("City List", 1)
|
||
3 years ago
|
.click()
|
||
|
.find("button.mdi-arrow-expand")
|
||
|
.should(`${vString}exist`);
|
||
3 years ago
|
|
||
3 years ago
|
// update row option (right click) - should not be available for Lock view
|
||
2 years ago
|
mainPage.getCell("City List", 1).rightclick();
|
||
3 years ago
|
cy.get(".menuable__content__active").should(
|
||
|
`${vString}be.visible`
|
||
|
);
|
||
|
});
|
||
|
};
|
||
3 years ago
|
|
||
3 years ago
|
// Locked view
|
||
|
lockViewTest(true);
|
||
3 years ago
|
|
||
3 years ago
|
// collaboration view
|
||
|
lockViewTest(false);
|
||
|
});
|
||
3 years ago
|
};
|
||
3 years ago
|
|
||
|
/**
|
||
|
* @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/>.
|
||
|
*
|
||
|
*/
|