Browse Source

test: updates to pg grid view share

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/3857/head
Raju Udava 2 years ago
parent
commit
e0b09f3068
  1. 36
      scripts/cypress/integration/common/4f_pg_grid_view_share.js
  2. 34
      scripts/cypress/support/commands.js

36
scripts/cypress/integration/common/4f_pg_grid_view_share.js

@ -27,17 +27,17 @@ export const genTest = (apiType, dbType) => {
.getCell(columnName, index)
.click()
.find(".nc-icon.nc-unlink-icon")
.should(options.unlink ? "exist" : "not.exist");
.should(`${options.unlink ? "exist" : "not.exist"}`);
mainPage
.getCell(columnName, index)
.click()
.find(".nc-icon.nc-plus")
.should(options.plus ? "exist" : "not.exist");
.should(`${options.plus ? "exist" : "not.exist"}`);
mainPage
.getCell(columnName, index)
.click()
.find(".nc-icon.nc-arrow-expand")
.should(options.expand ? "exist" : "not.exist");
.should(`${options.expand ? "exist" : "not.exist"}`);
}
function actionLtarCell(columnName, index, button) {
@ -45,38 +45,38 @@ export const genTest = (apiType, dbType) => {
.getCell(columnName, index)
.click()
.find(`.nc-icon${button}`)
.click();
.click({ force: true });
}
function verifyChildListCard(cardValue, options) {
// reload button
cy.getActiveModal(".nc-modal-child-list")
.find(`[data-cy="nc-child-list-reload"]`)
.should(options.reload ? "exist" : "not.exist");
.should(`${options.reload ? "exist" : "not.exist"}`);
// link-to button
cy.getActiveModal(".nc-modal-child-list")
.find(`[data-cy="nc-child-list-button-link-to"]`)
.should(options.linkTo ? "exist" : "not.exist");
.should(`${options.linkTo ? "exist" : "not.exist"}`);
// child card
// - contents : should exist
// - link-to button : should not exist
// - delete button : should not exist
if (cardValue !== "")
if (cardValue !== "") {
cy.getActiveModal(".nc-modal-child-list")
.find(".child-card")
.find(".ant-card")
.contains(cardValue)
.should("exist");
cy.getActiveModal(".nc-modal-child-list")
.find(".child-card")
.find(`[data-cy="nc-child-list-icon-unlink"]`)
.should(options.unlink ? "exist" : "not.exist");
cy.getActiveModal(".nc-modal-child-list")
.find(".child-card")
.find(`[data-cy="nc-child-list-icon-delete"]`)
.should(opitons.delete ? "exist" : "not.exist");
cy.getActiveModal(".nc-modal-child-list")
.find(".ant-card")
.find(`[data-cy="nc-child-list-icon-unlink"]`)
.should(`${options.unlink ? "exist" : "not.exist"}`);
cy.getActiveModal(".nc-modal-child-list")
.find(".ant-card")
.find(`[data-cy="nc-child-list-icon-delete"]`)
.should(`${options.delete ? "exist" : "not.exist"}`);
}
}
const generateViewLink = (viewName) => {
@ -349,7 +349,7 @@ export const genTest = (apiType, dbType) => {
unlink: false,
delete: false,
});
cy.get("body").type("{esc}");
cy.closeActiveModal(".nc-modal-child-list");
});
it(`Share GRID view : Virtual column validation > belongs to`, () => {

34
scripts/cypress/support/commands.js

@ -30,32 +30,32 @@ import { isXcdb, isPostgres } from "./page_objects/projectConstants";
require("@4tw/cypress-drag-drop");
// recursively gets an element, returning only after it's determined to be attached to the DOM for good
Cypress.Commands.add('getSettled', (selector, opts = {}) => {
Cypress.Commands.add("getSettled", (selector, opts = {}) => {
const retries = opts.retries || 3;
const delay = opts.delay || 400;
const isAttached = (resolve, count = 0) => {
const el = Cypress.$(selector);
const el = Cypress.$(selector);
// is element attached to the DOM?
count = Cypress.dom.isAttached(el) ? count + 1 : 0;
// is element attached to the DOM?
count = Cypress.dom.isAttached(el) ? count + 1 : 0;
// hit our base case, return the element
if (count >= retries) {
return resolve(el);
}
// hit our base case, return the element
if (count >= retries) {
return resolve(el);
}
// retry after a bit of a delay
setTimeout(() => isAttached(resolve, count), delay);
// retry after a bit of a delay
setTimeout(() => isAttached(resolve, count), delay);
};
// wrap, so we can chain cypress commands off the result
return cy.wrap(null).then(() => {
return new Cypress.Promise((resolve) => {
return isAttached(resolve, 0);
}).then((el) => {
return cy.wrap(el);
});
return new Cypress.Promise((resolve) => {
return isAttached(resolve, 0);
}).then((el) => {
return cy.wrap(el);
});
});
});
@ -280,6 +280,10 @@ Cypress.Commands.add("getActiveModal", (wrapperSelector) => {
return cy.get(".ant-modal-content:visible").last();
});
Cypress.Commands.add("closeActiveModal", (wrapperSelector) => {
cy.getActiveModal(wrapperSelector).find(".ant-modal-close-x").click();
});
Cypress.Commands.add("getActiveMenu", (overlaySelector) => {
if (overlaySelector) {
return cy.getSettled(`${overlaySelector} .ant-dropdown-content:visible`);

Loading…
Cancel
Save