Browse Source

test: add missing functions

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/3563/head
Raju Udava 2 years ago
parent
commit
9309da98a6
  1. 3
      scripts/cypress/integration/common/00_pre_configurations.js
  2. 74
      scripts/cypress/support/commands.js

3
scripts/cypress/integration/common/00_pre_configurations.js

@ -164,7 +164,7 @@ export const genTest = (apiType, dbType) => {
it("Admin SignUp", () => {
cy.task("log", "This will be output to the terminal");
loginPage.signUp(roles.owner.credentials);
loginPage.signIn(roles.owner.credentials);
});
function cy_createProjectBlock(proj, apiType, dbType) {
@ -240,6 +240,7 @@ export const genTest = (apiType, dbType) => {
}
// close team & auth tab
cy.wait(2000);
cy.get("button.ant-tabs-tab-remove").should("exist").click();
cy.get("button.ant-tabs-tab-remove").should("not.exist");

74
scripts/cypress/support/commands.js

@ -480,6 +480,78 @@ Cypress.Commands.add("gotoProjectsPage", () => {
cy.get(`.nc-project-page-title:contains("My Projects")`).should("exist");
});
// View basic routines
//
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
// viewCreate
// : viewType: grid, gallery, kanban, form
// : creates view with default name
//
Cypress.Commands.add("viewCreate", (viewType) => {
// click on 'Grid/Gallery/Form/Kanban' button on Views bar
cy.get(`.nc-create-${viewType}-view`).click();
// Pop up window, click Submit (accepting default name for view)
cy.getActiveModal(".nc-modal-view-create").find(".ant-btn-primary").click();
cy.toastWait("View created successfully");
// validate if view was created && contains default name 'Country1'
cy.get(`.nc-${viewType}-view-item`)
.contains(`${capitalizeFirstLetter(viewType)}-1`)
.should("exist");
});
// viewDelete
// : delete view by index (0-based, exclude default view)
//
Cypress.Commands.add("viewDelete", (viewIndex) => {
// click on delete icon (becomes visible on hovering mouse)
cy.get(".nc-view-delete-icon").eq(viewIndex).click({ force: true });
cy.wait(300);
// click on 'Delete' button on confirmation modal
cy.getActiveModal(".nc-modal-view-delete").find(".ant-btn-dangerous").click();
cy.toastWait("View deleted successfully");
});
// viewDuplicate
// : duplicate view by index (0-based, *include* default view)
//
Cypress.Commands.add("viewCopy", (viewIndex) => {
// click on delete icon (becomes visible on hovering mouse)
cy.get(".nc-view-copy-icon").eq(viewIndex).click({ force: true });
cy.wait(300);
// click on 'Delete' button on confirmation modal
cy.getActiveModal(".nc-modal-view-create").find(".ant-btn-primary").click();
cy.toastWait("View created successfully");
});
// viewRename
// : rename view by index (0-based, exclude default view)
//
Cypress.Commands.add("viewRename", (viewType, viewIndex, newName) => {
// click on edit-icon (becomes visible on hovering mouse)
cy.get(`.nc-${viewType}-view-item`).eq(viewIndex).dblclick();
// feed new name
cy.get(`.nc-${viewType}-view-item input`).clear().type(`${newName}{enter}`);
cy.toastWait("View renamed successfully");
// validate
cy.get(`.nc-${viewType}-view-item`).contains(`${newName}`).should("exist");
});
// openTableView
// : open view by type & name
//
Cypress.Commands.add("openTableView", (viewType, viewName) => {
cy.get(`.nc-${viewType}-view-item`).contains(`${viewName}`).click();
});
// Drag n Drop
// refer: https://stackoverflow.com/a/55409853
/*
@ -589,4 +661,4 @@ Cypress.Commands.addAll(
dragTo,
}
)
*/
*/

Loading…
Cancel
Save