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.
140 lines
4.5 KiB
140 lines
4.5 KiB
3 years ago
|
import { mainPage } from "../../support/page_objects/mainPage";
|
||
|
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
|
||
3 years ago
|
|
||
3 years ago
|
let storedURL = "";
|
||
|
let linkText = "";
|
||
3 years ago
|
|
||
3 years ago
|
const generateLinkWithPwd = () => {
|
||
2 years ago
|
mainPage.shareView().click({ force: true });
|
||
3 years ago
|
|
||
2 years ago
|
cy.wait(3000);
|
||
2 years ago
|
|
||
3 years ago
|
cy.snipActiveModal("Modal_ShareView");
|
||
3 years ago
|
|
||
3 years ago
|
// enable checkbox & feed pwd, save
|
||
2 years ago
|
cy.getActiveModal().find('button:contains("More Options")').click({ force: true });
|
||
2 years ago
|
cy.getActiveModal().find('[role="checkbox"][type="checkbox"]').first().then(($el) => {
|
||
|
if (!$el.prop("checked")) {
|
||
|
cy.wrap($el).click({ force: true });
|
||
|
cy.getActiveModal().find('input[type="password"]').type("1");
|
||
|
cy.snipActiveModal("Modal_ShareView_Password");
|
||
|
cy.getActiveModal().find('button:contains("Save password")').click();
|
||
|
cy.toastWait("Successfully updated");
|
||
|
}
|
||
|
});
|
||
|
|
||
3 years ago
|
// copy link text, visit URL
|
||
|
cy.getActiveModal()
|
||
|
.find(".share-link-box")
|
||
|
.then(($obj) => {
|
||
|
linkText = $obj.text().trim();
|
||
|
cy.log(linkText);
|
||
|
});
|
||
|
};
|
||
3 years ago
|
|
||
3 years ago
|
export const genTest = (apiType, dbType) => {
|
||
|
if (!isTestSuiteActive(apiType, dbType)) return;
|
||
|
|
||
|
describe(`${apiType.toUpperCase()} api - Shared VIEWs (GRID)`, () => {
|
||
|
// Run once before test- create project (rest/graphql)
|
||
|
//
|
||
|
before(() => {
|
||
3 years ago
|
mainPage.tabReset();
|
||
3 years ago
|
cy.openTableTab("City", 25);
|
||
|
|
||
|
// store base URL- to re-visit and delete form view later
|
||
|
cy.url().then((url) => {
|
||
|
storedURL = url;
|
||
|
});
|
||
|
|
||
|
generateLinkWithPwd();
|
||
|
});
|
||
|
|
||
|
beforeEach(() => {
|
||
|
cy.restoreLocalStorage();
|
||
|
});
|
||
|
|
||
|
afterEach(() => {
|
||
|
cy.saveLocalStorage();
|
||
|
});
|
||
|
|
||
|
it("Share view with incorrect password", () => {
|
||
|
cy.visit(linkText, {
|
||
|
baseUrl: null,
|
||
|
});
|
||
3 years ago
|
cy.wait(5000);
|
||
3 years ago
|
|
||
|
cy.getActiveModal().should("exist");
|
||
|
|
||
|
// feed password
|
||
|
cy.getActiveModal().find('input[type="password"]').type("a");
|
||
|
cy.getActiveModal().find('button:contains("Unlock")').click();
|
||
|
|
||
|
// if pwd is incorrect, active modal requesting to feed in password again will persist
|
||
|
cy.get("body").find(".v-dialog.v-dialog--active").should("exist");
|
||
|
});
|
||
|
|
||
|
// fallover test- use previously opened view & continue verification instead of opening again
|
||
|
it("Share view with correct password", () => {
|
||
|
// cy.visit(linkText, {
|
||
|
// baseUrl: null
|
||
|
// })
|
||
|
|
||
|
// feed password
|
||
|
cy.getActiveModal()
|
||
|
.find('input[type="password"]')
|
||
|
.clear()
|
||
|
.type("1");
|
||
|
cy.getActiveModal().find('button:contains("Unlock")').click();
|
||
|
|
||
|
// if pwd is incorrect, active modal requesting to feed in password again will persist
|
||
|
cy.get("body")
|
||
|
.find(".v-dialog.v-dialog--active")
|
||
|
.should("not.exist");
|
||
2 years ago
|
|
||
|
// Verify Download as CSV is here
|
||
|
cy.get(".nc-actions-menu-btn").click();
|
||
|
cy.snipActiveMenu("Menu_ActionsMenu");
|
||
|
cy.get(`.menuable__content__active .v-list-item span:contains("Download as CSV")`).should("exist");
|
||
3 years ago
|
});
|
||
|
|
||
|
it("Delete view", () => {
|
||
|
cy.visit(storedURL, {
|
||
|
baseUrl: null,
|
||
|
});
|
||
3 years ago
|
cy.wait(5000);
|
||
3 years ago
|
mainPage.deleteCreatedViews();
|
||
|
});
|
||
|
|
||
|
after(() => {
|
||
|
cy.closeTableTab("City");
|
||
|
});
|
||
3 years ago
|
});
|
||
|
};
|
||
3 years ago
|
|
||
3 years ago
|
// genTest('rest', false)
|
||
|
// genTest('graphql', false)
|
||
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/>.
|
||
|
*
|
||
3 years ago
|
*/
|