mirror of
https://github.com/nocodb/nocodb.git
synced 2026-04-30 16:26:54 +00:00
chore(test): JS prettier for all files
Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
This commit is contained in:
@@ -1,117 +1,140 @@
|
||||
import { mainPage } from "../../support/page_objects/mainPage";
|
||||
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
|
||||
import {loginPage} from "../../support/page_objects/navigation";
|
||||
import { loginPage } from "../../support/page_objects/navigation";
|
||||
|
||||
let storedURL = "";
|
||||
let linkText = "";
|
||||
|
||||
const generateLinkWithPwd = () => {
|
||||
mainPage.shareView().click();
|
||||
cy.getActiveModal(".nc-modal-share-view").find(".ant-modal-title").contains("This view is shared via a private link").should("be.visible");
|
||||
mainPage.shareView().click();
|
||||
cy.getActiveModal(".nc-modal-share-view")
|
||||
.find(".ant-modal-title")
|
||||
.contains("This view is shared via a private link")
|
||||
.should("be.visible");
|
||||
|
||||
// enable checkbox & feed pwd, save
|
||||
cy.getActiveModal(".nc-modal-share-view").find('.ant-collapse').should('exist').click();
|
||||
cy.getActiveModal(".nc-modal-share-view").find('.ant-checkbox-input').should('exist').first().then(($el) => {
|
||||
// enable checkbox & feed pwd, save
|
||||
cy.getActiveModal(".nc-modal-share-view")
|
||||
.find(".ant-collapse")
|
||||
.should("exist")
|
||||
.click();
|
||||
cy.getActiveModal(".nc-modal-share-view")
|
||||
.find(".ant-checkbox-input")
|
||||
.should("exist")
|
||||
.first()
|
||||
.then(($el) => {
|
||||
if (!$el.prop("checked")) {
|
||||
cy.wrap($el).click({ force: true });
|
||||
cy.getActiveModal(".nc-modal-share-view").find('input[type="password"]').clear().type("1");
|
||||
cy.getActiveModal(".nc-modal-share-view").find('button:contains("Save password")').click();
|
||||
cy.toastWait("Successfully updated");
|
||||
cy.wrap($el).click({ force: true });
|
||||
cy.getActiveModal(".nc-modal-share-view")
|
||||
.find('input[type="password"]')
|
||||
.clear()
|
||||
.type("1");
|
||||
cy.getActiveModal(".nc-modal-share-view")
|
||||
.find('button:contains("Save password")')
|
||||
.click();
|
||||
cy.toastWait("Successfully updated");
|
||||
}
|
||||
});
|
||||
|
||||
// copy link text, visit URL
|
||||
cy.getActiveModal(".nc-modal-share-view")
|
||||
.find(".nc-share-link-box")
|
||||
.then(($obj) => {
|
||||
linkText = $obj.text().trim();
|
||||
cy.log(linkText);
|
||||
});
|
||||
|
||||
// copy link text, visit URL
|
||||
cy.getActiveModal(".nc-modal-share-view")
|
||||
.find(".nc-share-link-box")
|
||||
.then(($obj) => {
|
||||
linkText = $obj.text().trim();
|
||||
cy.log(linkText);
|
||||
});
|
||||
};
|
||||
|
||||
export const genTest = (apiType, dbType) => {
|
||||
if (!isTestSuiteActive(apiType, dbType)) return;
|
||||
if (!isTestSuiteActive(apiType, dbType)) return;
|
||||
|
||||
describe(`${apiType.toUpperCase()} api - Shared VIEWs (GRID)`, () => {
|
||||
// Run once before test- create project (rest/graphql)
|
||||
//
|
||||
before(() => {
|
||||
cy.restoreLocalStorage();
|
||||
cy.openTableTab("City", 25);
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
cy.restoreLocalStorage();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
cy.saveLocalStorage();
|
||||
});
|
||||
|
||||
after(() => {
|
||||
cy.restoreLocalStorage();
|
||||
cy.closeTableTab("City");
|
||||
cy.saveLocalStorage();
|
||||
});
|
||||
|
||||
it("Generate link with password", () => {
|
||||
// store base URL- to re-visit and delete form view later
|
||||
cy.url().then((url) => {
|
||||
storedURL = url;
|
||||
});
|
||||
generateLinkWithPwd();
|
||||
|
||||
cy.signOut();
|
||||
});
|
||||
|
||||
it("Share view with incorrect password", () => {
|
||||
cy.visit(linkText, {
|
||||
baseUrl: null,
|
||||
});
|
||||
|
||||
cy.getActiveModal(".nc-modal-shared-view-password-dlg").should("exist");
|
||||
|
||||
// feed password
|
||||
cy.getActiveModal(".nc-modal-shared-view-password-dlg").find('input[type="password"]').clear().type("a");
|
||||
cy.getActiveModal(".nc-modal-shared-view-password-dlg").find('button:contains("Unlock")').click();
|
||||
|
||||
// if pwd is incorrect, active modal requesting to feed in password again will persist
|
||||
cy.getActiveModal(".nc-modal-shared-view-password-dlg").find('button:contains("Unlock")').should('exist');
|
||||
});
|
||||
|
||||
// fallover test- use previously opened view & continue verification instead of opening again
|
||||
it("Share view with correct password", () => {
|
||||
|
||||
// feed password
|
||||
cy.getActiveModal(".nc-modal-shared-view-password-dlg")
|
||||
.find('input[type="password"]')
|
||||
.clear()
|
||||
.type("1");
|
||||
cy.getActiveModal(".nc-modal-shared-view-password-dlg").find('button:contains("Unlock")').click();
|
||||
|
||||
// if pwd is incorrect, active modal requesting to feed in password again will persist
|
||||
// cy.getActiveModal().find('button:contains("Unlock")').should('not.exist');
|
||||
// cy.get(".ant-modal-content:visible").should("not.exist")
|
||||
|
||||
cy.wait(1000);
|
||||
|
||||
// Verify Download as CSV is here
|
||||
mainPage.downloadCsv().should("exist");
|
||||
cy.get(".nc-actions-menu-btn").should('exist').click();
|
||||
|
||||
mainPage.downloadExcel().should("exist");
|
||||
cy.get(".nc-actions-menu-btn").should('exist').click();
|
||||
});
|
||||
|
||||
it("Delete view", () => {
|
||||
loginPage.loginAndOpenProject(apiType, dbType);
|
||||
cy.openTableTab("City", 25);
|
||||
|
||||
// wait for page load to complete
|
||||
cy.get(".nc-grid-row").should("have.length", 25);
|
||||
mainPage.deleteCreatedViews();
|
||||
});
|
||||
describe(`${apiType.toUpperCase()} api - Shared VIEWs (GRID)`, () => {
|
||||
// Run once before test- create project (rest/graphql)
|
||||
//
|
||||
before(() => {
|
||||
cy.restoreLocalStorage();
|
||||
cy.openTableTab("City", 25);
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
cy.restoreLocalStorage();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
cy.saveLocalStorage();
|
||||
});
|
||||
|
||||
after(() => {
|
||||
cy.restoreLocalStorage();
|
||||
cy.closeTableTab("City");
|
||||
cy.saveLocalStorage();
|
||||
});
|
||||
|
||||
it("Generate link with password", () => {
|
||||
// store base URL- to re-visit and delete form view later
|
||||
cy.url().then((url) => {
|
||||
storedURL = url;
|
||||
});
|
||||
generateLinkWithPwd();
|
||||
|
||||
cy.signOut();
|
||||
});
|
||||
|
||||
it("Share view with incorrect password", () => {
|
||||
cy.visit(linkText, {
|
||||
baseUrl: null,
|
||||
});
|
||||
|
||||
cy.getActiveModal(".nc-modal-shared-view-password-dlg").should("exist");
|
||||
|
||||
// feed password
|
||||
cy.getActiveModal(".nc-modal-shared-view-password-dlg")
|
||||
.find('input[type="password"]')
|
||||
.clear()
|
||||
.type("a");
|
||||
cy.getActiveModal(".nc-modal-shared-view-password-dlg")
|
||||
.find('button:contains("Unlock")')
|
||||
.click();
|
||||
|
||||
// if pwd is incorrect, active modal requesting to feed in password again will persist
|
||||
cy.getActiveModal(".nc-modal-shared-view-password-dlg")
|
||||
.find('button:contains("Unlock")')
|
||||
.should("exist");
|
||||
});
|
||||
|
||||
// fallover test- use previously opened view & continue verification instead of opening again
|
||||
it("Share view with correct password", () => {
|
||||
// feed password
|
||||
cy.getActiveModal(".nc-modal-shared-view-password-dlg")
|
||||
.find('input[type="password"]')
|
||||
.clear()
|
||||
.type("1");
|
||||
cy.getActiveModal(".nc-modal-shared-view-password-dlg")
|
||||
.find('button:contains("Unlock")')
|
||||
.click();
|
||||
|
||||
// if pwd is incorrect, active modal requesting to feed in password again will persist
|
||||
// cy.getActiveModal().find('button:contains("Unlock")').should('not.exist');
|
||||
// cy.get(".ant-modal-content:visible").should("not.exist")
|
||||
|
||||
cy.wait(1000);
|
||||
|
||||
// Verify Download as CSV is here
|
||||
mainPage.downloadCsv().should("exist");
|
||||
cy.get(".nc-actions-menu-btn").should("exist").click();
|
||||
|
||||
mainPage.downloadExcel().should("exist");
|
||||
cy.get(".nc-actions-menu-btn").should("exist").click();
|
||||
});
|
||||
|
||||
it("Delete view", () => {
|
||||
loginPage.loginAndOpenProject(apiType, dbType);
|
||||
cy.openTableTab("City", 25);
|
||||
|
||||
// wait for page load to complete
|
||||
cy.get(".nc-grid-row").should("have.length", 25);
|
||||
mainPage.deleteCreatedViews();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user