Browse Source

test: use class names for accessing active expand-drawer

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/3655/head
Raju Udava 2 years ago
parent
commit
a4b1218e0b
  1. 10
      scripts/cypress/integration/common/1b_table_column_operations.js
  2. 218
      scripts/cypress/integration/common/2b_table_with_m2m_column.js
  3. 379
      scripts/cypress/integration/common/3a_filter_sort_fields_operations.js
  4. 571
      scripts/cypress/integration/common/3e_duration_column.js
  5. 153
      scripts/cypress/integration/common/3f_link_to_another_record.js
  6. 12
      scripts/cypress/integration/common/4f_grid_view_share.js
  7. 3
      scripts/cypress/integration/common/8a_webhook.js
  8. 512
      scripts/cypress/integration/spec/roleValidation.spec.js
  9. 33
      scripts/cypress/integration/test/restTableOps.js

10
scripts/cypress/integration/common/1b_table_column_operations.js

@ -18,10 +18,11 @@ export const genTest = (apiType, dbType) => {
.clear()
.type(cellValue);
cy.getActiveDrawer()
cy.getActiveDrawer(".nc-drawer-expanded-form")
.find("button")
.contains("Save row")
.click({ force: true });
.should("exist")
.click();
cy.toastWait("updated successfully");
cy.get("body").type("{esc}");
@ -148,10 +149,11 @@ export const genTest = (apiType, dbType) => {
.clear()
.type(updatedRandVal);
cy.getActiveDrawer()
cy.getActiveDrawer(".nc-drawer-expanded-form")
.find("button")
.contains("Save row")
.click({ force: true });
.should("exist")
.click();
// partial toast message
cy.toastWait("updated successfully");

218
scripts/cypress/integration/common/2b_table_with_m2m_column.js

@ -2,121 +2,135 @@ import { mainPage } from "../../support/page_objects/mainPage";
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
export const genTest = (apiType, dbType) => {
if (!isTestSuiteActive(apiType, dbType)) return;
if (!isTestSuiteActive(apiType, dbType)) return;
describe(`${apiType.toUpperCase()} api - M2M Column validation`, () => {
// before(() => {
// cy.openTableTab("Actor", 25);
// });
describe(`${apiType.toUpperCase()} api - M2M Column validation`, () => {
// before(() => {
// cy.openTableTab("Actor", 25);
// });
beforeEach(() => {
cy.restoreLocalStorage();
})
beforeEach(() => {
cy.restoreLocalStorage();
});
afterEach(() => {
cy.saveLocalStorage();
})
afterEach(() => {
cy.saveLocalStorage();
});
// after(() => {
// cy.closeTableTab("Actor");
// });
// after(() => {
// cy.closeTableTab("Actor");
// });
it("Table column header, URL validation", () => {
cy.openTableTab("Actor", 25);
// column name validation
// cy.get(`.project-tab:contains(Actor):visible`).should("exist");
// URL validation
cy.url().should("contain", `table/Actor`);
});
it("Table column header, URL validation", () => {
cy.openTableTab("Actor", 25);
// column name validation
// cy.get(`.project-tab:contains(Actor):visible`).should("exist");
// URL validation
cy.url().should("contain", `table/Actor`);
});
it("M2m chip content validation on grid", () => {
// grid m2m content validation
mainPage.getCell("Film List", 1)
.find('.nc-virtual-cell > .chips-wrapper > .chips > .group > .name')
.contains("ACADEMY DINOSAUR")
.should('exist');
mainPage.getCell("Film List", 1)
.find('.nc-virtual-cell > .chips-wrapper > .chips > .group > .name')
.contains("ANACONDA CONFESSIONS")
.should('exist');
});
it("M2m chip content validation on grid", () => {
// grid m2m content validation
mainPage
.getCell("Film List", 1)
.find(".nc-virtual-cell > .chips-wrapper > .chips > .group > .name")
.contains("ACADEMY DINOSAUR")
.should("exist");
mainPage
.getCell("Film List", 1)
.find(".nc-virtual-cell > .chips-wrapper > .chips > .group > .name")
.contains("ANACONDA CONFESSIONS")
.should("exist");
});
it("Expand m2m column", () => {
// expand first row
mainPage.getCell("Film List", 1).should("exist").trigger("mouseover").click();
cy.get('.nc-action-icon').eq(0).should('exist').click({ force: true });
it("Expand m2m column", () => {
// expand first row
mainPage
.getCell("Film List", 1)
.should("exist")
.trigger("mouseover")
.click();
cy.get(".nc-action-icon").eq(0).should("exist").click({ force: true });
// GUI-v2 Kludge:
// validations
// cy.getActiveModal().contains("Film").should("exist");
// cy.getActiveModal().find("button.mdi-reload").should("exist");
// cy.getActiveModal()
// .find("button:contains(Link to 'Film')")
// .should("exist");
cy.getActiveModal(".nc-modal-child-list")
.find(".ant-card")
.eq(0)
.contains("ACADEMY DINOSAUR")
.should("exist");
});
// GUI-v2 Kludge:
// validations
// cy.getActiveModal().contains("Film").should("exist");
// cy.getActiveModal().find("button.mdi-reload").should("exist");
// cy.getActiveModal()
// .find("button:contains(Link to 'Film')")
// .should("exist");
cy.getActiveModal(".nc-modal-child-list")
.find(".ant-card")
.eq(0)
.contains("ACADEMY DINOSAUR")
.should("exist");
it('Expand "Link to" record, validate', () => {
cy.getActiveModal(".nc-modal-child-list")
.find("button:contains(Link to 'Film')")
.click()
.then(() => {
// Link record form validation
cy.getActiveModal(".nc-modal-link-record")
.contains("Link record")
.should("exist");
cy.getActiveModal(".nc-modal-link-record")
.find(".nc-reload")
.should("exist");
cy.getActiveModal(".nc-modal-link-record")
.find('button:contains("Add new record")')
.should("exist");
cy.getActiveModal(".nc-modal-link-record")
.find(".ant-card")
.eq(0)
.contains("ACE GOLDFINGER")
.should("exist");
cy.getActiveModal(".nc-modal-link-record")
.find("button.ant-modal-close")
.click();
});
});
it('Expand "Link to" record, validate', () => {
cy.getActiveModal(".nc-modal-child-list")
.find("button:contains(Link to 'Film')")
.click()
.then(() => {
// Link record form validation
cy.getActiveModal(".nc-modal-link-record").contains("Link record").should("exist");
cy.getActiveModal(".nc-modal-link-record")
.find(".nc-reload")
.should("exist");
cy.getActiveModal(".nc-modal-link-record")
.find('button:contains("Add new record")')
.should("exist");
cy.getActiveModal(".nc-modal-link-record")
.find(".ant-card")
.eq(0)
.contains("ACE GOLDFINGER")
.should("exist");
cy.getActiveModal(".nc-modal-link-record").find("button.ant-modal-close").click();
});
it("Expand first linked card, validate", () => {
// expand first row
mainPage
.getCell("Film List", 1)
.should("exist")
.trigger("mouseover")
.click();
cy.get(".nc-action-icon").eq(0).should("exist").click({ force: true });
cy.getActiveModal(".nc-modal-child-list")
.find(".ant-card")
.eq(0)
.contains("ACADEMY DINOSAUR", { timeout: 2000 })
.click()
.then(() => {
// wait to ensure pop up appears before we proceed further
cy.wait(1000);
// Link card validation
cy.getActiveDrawer(".nc-drawer-expanded-form")
.find(".text-lg")
.contains("ACADEMY DINOSAUR")
.should("exist");
cy.getActiveDrawer(".nc-drawer-expanded-form")
.find('button:contains("Save row")')
.should("exist");
cy.getActiveDrawer(".nc-drawer-expanded-form")
.find('button:contains("Cancel")')
.should("exist");
cy.getActiveDrawer(".nc-drawer-expanded-form")
.find('button:contains("Cancel")')
.should("exist")
.click();
cy.getActiveModal().find("button.ant-modal-close").click();
});
it("Expand first linked card, validate", () => {
// expand first row
mainPage.getCell("Film List", 1).should("exist").trigger("mouseover").click();
cy.get('.nc-action-icon').eq(0).should('exist').click({ force: true });
cy.getActiveModal(".nc-modal-child-list")
.find(".ant-card")
.eq(0)
.contains("ACADEMY DINOSAUR", { timeout: 2000 })
.click()
.then(() => {
// wait to ensure pop up appears before we proceed further
cy.wait(1000)
// Link card validation
cy.getActiveDrawer()
.find(".text-lg")
.contains("ACADEMY DINOSAUR")
.should("exist");
cy.getActiveDrawer()
.find('button:contains("Save row")')
.should("exist");
cy.getActiveDrawer()
.find('button:contains("Cancel")')
.should("exist");
cy.getActiveDrawer()
.find('button:contains("Cancel")')
.click();
cy.getActiveModal().find("button.ant-modal-close").click();
});
cy.closeTableTab("Actor");
});
cy.closeTableTab("Actor");
});
});
};
/**

379
scripts/cypress/integration/common/3a_filter_sort_fields_operations.js

@ -1,201 +1,194 @@
import { mainPage } from "../../support/page_objects/mainPage";
import { loginPage} from "../../support/page_objects/navigation";
import { loginPage } from "../../support/page_objects/navigation";
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
export const genTest = (apiType, dbType) => {
if (!isTestSuiteActive(apiType, dbType)) return;
describe(`${apiType.toUpperCase()} api - Grid operations`, () => {
// before(() => {
// // loginPage.loginAndOpenProject(apiType, dbType);
//
// // open country table
// cy.openTableTab("Country", 25);
// });
//
// after(() => {
// cy.closeTableTab("Country");
// });
beforeEach(() => {
cy.restoreLocalStorage();
})
afterEach(() => {
cy.saveLocalStorage();
})
it("Check country table - Pagination", () => {
cy.openTableTab("Country", 25);
cy.get(".nc-pagination").should("exist");
// verify > pagination option
mainPage.getPagination(">").click();
mainPage
.getPagination(2)
.should("have.class", "ant-pagination-item-active");
// verify < pagination option
mainPage.getPagination("<").click();
mainPage
.getPagination(1)
.should("have.class", "ant-pagination-item-active");
});
// create new row using + button in header
//
it("Add row using tool header button", () => {
// add a row to end of Country table
cy.get(".nc-add-new-row-btn").click();
cy.wait(1000);
cy.get(".nc-expand-col-Country").find(".nc-cell > input").first().type("Test Country");
cy.getActiveDrawer()
.find(".ant-btn-primary")
.contains("Save row")
.click();
// cy.get("#data-table-form-Country > input")
// .first()
// .type("Test Country");
// cy.contains("Save row").filter("button").click();
cy.toastWait("updated successfully");
cy.getActiveDrawer()
.find(".ant-btn")
.contains("Cancel")
.click();
// verify
mainPage.getPagination(5).click();
// kludge: flicker on load
cy.wait(3000)
mainPage
.getCell("Country", 10)
.contains("Test Country")
.should("exist");
});
// delete single row
//
it("Delete Row", () => {
// delete row added in previous step
mainPage.getCell("Country", 10).rightclick();
cy.getActiveMenu(".nc-dropdown-grid-context-menu").contains("Delete Row").click();
// cy.toastWait('Deleted row successfully')
// verify
cy.get(`:nth-child(10) > [data-title="Country"]`).should("not.exist");
mainPage.getPagination(1).click();
});
// create new row using right click menu option
//
it.skip("Add row using rightclick menu option", () => {
// Temporary
mainPage.getPagination(5).click();
mainPage.getCell("Country", 9).rightclick({ force: true });
cy.getActiveMenu(".nc-dropdown-grid-context-menu")
.contains("Insert New Row")
.click({ force: true });
mainPage
.getCell("Country", 10)
.dblclick()
.find("input")
.type("Test Country-1{enter}");
mainPage.getCell("Country", 10).rightclick({ force: true });
cy.getActiveMenu(".nc-dropdown-grid-context-menu")
.contains("Insert New Row")
.click({ force: true });
mainPage
.getCell("Country", 11)
.dblclick()
.find("input")
.type("Test Country-2{enter}");
// GUI-v2 Kludge:
// to move cursor away from input field; enter key is not recognized
// mainPage.getCell("Country", 10).click()
// verify
mainPage
.getCell("Country", 10)
.contains("Test Country-1")
.should("exist");
mainPage
.getCell("Country", 11)
.contains("Test Country-2")
.should("exist");
});
// delete selected rows (multiple)
//
it.skip("Delete Selected", () => {
cy.get(".ant-checkbox").should('exist')
.eq(10).click({ force: true });
cy.get(".ant-checkbox").should('exist')
.eq(11).click({ force: true });
mainPage.getCell("Country", 10).rightclick({ force: true });
cy.getActiveMenu(".nc-dropdown-grid-context-menu")
.contains("Delete Selected Rows")
.click({ force: true });
// verify
// mainPage.getCell("Country", 10).should("not.exist");
// mainPage.getCell("Country", 11).should("not.exist");
cy.get(
`:nth-child(10) > [data-title="Country"]`
).should("not.exist");
cy.get(
`:nth-child(11) > [data-title="Country"]`
).should("not.exist");
mainPage.getPagination(1).click();
});
it("Enable sort", () => {
mainPage.sortField("Country", "Z → A");
cy.contains("Zambia").should("exist");
});
it("Disable sort", () => {
mainPage.clearSort();
cy.contains("Zambia").should("not.exist");
});
it("Hide field", () => {
mainPage.hideField("LastUpdate");
});
it("Show field", () => {
mainPage.unhideField("LastUpdate");
});
it("Create Filter", () => {
mainPage.filterField("Country", "is equal", "India");
// cy.get("td:contains(India)").should("exist");
mainPage.getCell("Country", 1)
.contains("India")
.should("exist");
});
it("Delete Filter", () => {
// remove sort and check
mainPage.filterReset();
mainPage.getCell("Country", 1)
.contains("India")
.should("not.exist");
// cy.contains("td:contains(India)").should("not.exist");
cy.closeTableTab("Country");
});
if (!isTestSuiteActive(apiType, dbType)) return;
describe(`${apiType.toUpperCase()} api - Grid operations`, () => {
// before(() => {
// // loginPage.loginAndOpenProject(apiType, dbType);
//
// // open country table
// cy.openTableTab("Country", 25);
// });
//
// after(() => {
// cy.closeTableTab("Country");
// });
beforeEach(() => {
cy.restoreLocalStorage();
});
afterEach(() => {
cy.saveLocalStorage();
});
it("Check country table - Pagination", () => {
cy.openTableTab("Country", 25);
cy.get(".nc-pagination").should("exist");
// verify > pagination option
mainPage.getPagination(">").click();
mainPage
.getPagination(2)
.should("have.class", "ant-pagination-item-active");
// verify < pagination option
mainPage.getPagination("<").click();
mainPage
.getPagination(1)
.should("have.class", "ant-pagination-item-active");
});
// create new row using + button in header
//
it("Add row using tool header button", () => {
// add a row to end of Country table
cy.get(".nc-add-new-row-btn").click();
cy.wait(1000);
cy.get(".nc-expand-col-Country")
.find(".nc-cell > input")
.first()
.type("Test Country");
cy.getActiveDrawer(".nc-drawer-expanded-form")
.find(".ant-btn-primary")
.contains("Save row")
.should("exist")
.click();
// cy.get("#data-table-form-Country > input")
// .first()
// .type("Test Country");
// cy.contains("Save row").filter("button").click();
cy.toastWait("updated successfully");
cy.getActiveDrawer(".nc-drawer-expanded-form")
.find(".ant-btn")
.contains("Cancel")
.should("exist")
.click();
// verify
mainPage.getPagination(5).click();
// kludge: flicker on load
cy.wait(3000);
mainPage.getCell("Country", 10).contains("Test Country").should("exist");
});
// delete single row
//
it("Delete Row", () => {
// delete row added in previous step
mainPage.getCell("Country", 10).rightclick();
cy.getActiveMenu(".nc-dropdown-grid-context-menu")
.contains("Delete Row")
.click();
// cy.toastWait('Deleted row successfully')
// verify
cy.get(`:nth-child(10) > [data-title="Country"]`).should("not.exist");
mainPage.getPagination(1).click();
});
// create new row using right click menu option
//
it.skip("Add row using rightclick menu option", () => {
// Temporary
mainPage.getPagination(5).click();
mainPage.getCell("Country", 9).rightclick({ force: true });
cy.getActiveMenu(".nc-dropdown-grid-context-menu")
.contains("Insert New Row")
.click({ force: true });
mainPage
.getCell("Country", 10)
.dblclick()
.find("input")
.type("Test Country-1{enter}");
mainPage.getCell("Country", 10).rightclick({ force: true });
cy.getActiveMenu(".nc-dropdown-grid-context-menu")
.contains("Insert New Row")
.click({ force: true });
mainPage
.getCell("Country", 11)
.dblclick()
.find("input")
.type("Test Country-2{enter}");
// GUI-v2 Kludge:
// to move cursor away from input field; enter key is not recognized
// mainPage.getCell("Country", 10).click()
// verify
mainPage
.getCell("Country", 10)
.contains("Test Country-1")
.should("exist");
mainPage
.getCell("Country", 11)
.contains("Test Country-2")
.should("exist");
});
// delete selected rows (multiple)
//
it.skip("Delete Selected", () => {
cy.get(".ant-checkbox").should("exist").eq(10).click({ force: true });
cy.get(".ant-checkbox").should("exist").eq(11).click({ force: true });
mainPage.getCell("Country", 10).rightclick({ force: true });
cy.getActiveMenu(".nc-dropdown-grid-context-menu")
.contains("Delete Selected Rows")
.click({ force: true });
// verify
// mainPage.getCell("Country", 10).should("not.exist");
// mainPage.getCell("Country", 11).should("not.exist");
cy.get(`:nth-child(10) > [data-title="Country"]`).should("not.exist");
cy.get(`:nth-child(11) > [data-title="Country"]`).should("not.exist");
mainPage.getPagination(1).click();
});
it("Enable sort", () => {
mainPage.sortField("Country", "Z → A");
cy.contains("Zambia").should("exist");
});
it("Disable sort", () => {
mainPage.clearSort();
cy.contains("Zambia").should("not.exist");
});
it("Hide field", () => {
mainPage.hideField("LastUpdate");
});
it("Show field", () => {
mainPage.unhideField("LastUpdate");
});
it("Create Filter", () => {
mainPage.filterField("Country", "is equal", "India");
// cy.get("td:contains(India)").should("exist");
mainPage.getCell("Country", 1).contains("India").should("exist");
});
it("Delete Filter", () => {
// remove sort and check
mainPage.filterReset();
mainPage.getCell("Country", 1).contains("India").should("not.exist");
// cy.contains("td:contains(India)").should("not.exist");
cy.closeTableTab("Country");
});
});
};
/**

571
scripts/cypress/integration/common/3e_duration_column.js

@ -1,282 +1,301 @@
import { mainPage } from "../../support/page_objects/mainPage";
import {
isTestSuiteActive,
} from "../../support/page_objects/projectConstants";
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
export const genTest = (apiType, dbType) => {
if (!isTestSuiteActive(apiType, dbType)) return;
describe(`${apiType.toUpperCase()} api - DURATION`, () => {
const tableName = "DurationTable";
// to retrieve few v-input nodes from their label
//
const fetchParentFromLabel = (label) => {
cy.get("label").contains(label).parents(".ant-row").first().click();
};
// Run once before test- create table
//
before(() => {
mainPage.tabReset();
// // kludge: wait for page load to finish
// cy.wait(1000);
// // close team & auth tab
// cy.get('button.ant-tabs-tab-remove').should('exist').click();
// cy.wait(1000);
cy.createTable(tableName);
});
beforeEach(() => {
});
after(() => {
cy.deleteTable(tableName);
});
// Routine to create a new look up column
//
const addDurationColumn = (columnName, durationFormat) => {
cy.get(".nc-grid tr > th:last .nc-icon").click({
force: true,
});
cy.getActiveMenu(".nc-dropdown-grid-add-column")
.find('input.nc-column-name-input', { timeout: 3000 })
.should('exist')
.clear()
.type(columnName);
// cy.get(".nc-column-type-input").last().click().type("Duration");
cy.getActiveMenu('.nc-dropdown-grid-add-column')
.find(".nc-column-type-input")
.last()
.click()
.type("Duration")
cy.getActiveSelection('.nc-dropdown-column-type')
.find('.ant-select-item-option')
.contains("Duration")
.click();
// Configure Duration format
fetchParentFromLabel("Duration Format");
cy.getActiveSelection('.nc-dropdown-duration-option')
.find('.ant-select-item-option')
.contains(durationFormat)
.click();
// cy.get(".ant-btn-primary").contains("Save").should('exist').click();
cy.getActiveMenu('.nc-dropdown-grid-add-column')
.find(".ant-btn-primary:visible")
.contains("Save")
.click();
cy.toastWait(`Column created`);
cy.get(`th[data-title="${columnName}"]`).should("exist");
};
// routine to delete column
//
const deleteColumnByName = (columnName) => {
mainPage.deleteColumn(columnName);
};
// routine to edit column
//
const editColumnByName = (oldName, newName, newDurationFormat) => {
cy.get(`th:contains(${oldName}) .nc-icon.ant-dropdown-trigger`)
.trigger("mouseover", { force: true })
.click({ force: true });
// cy.get(".nc-column-edit").click();
// cy.get(".nc-column-edit").should("not.be.visible");
cy.getActiveMenu(".nc-dropdown-column-operations")
.find(".nc-column-edit")
.click();
// rename column and verify
cy.getActiveMenu(".nc-dropdown-edit-column")
.find('input.nc-column-name-input', { timeout: 3000 })
.should('exist')
.clear()
.type(newName);
// Configure Duration format
fetchParentFromLabel("Duration Format");
cy.getActiveSelection('.nc-dropdown-duration-option')
.find('.ant-select-item-option')
.contains(newDurationFormat)
.click();
// cy.get(".ant-btn-primary:visible").contains("Save").click();
cy.getActiveMenu('.nc-dropdown-edit-column')
.find(".ant-btn-primary:visible")
.contains("Save")
.click();
cy.toastWait("Column updated");
cy.get(`th:contains(${oldName})`).should("not.exist");
cy.get(`th:contains(${newName})`).should("exist");
};
const addDurationData = (colName, index, cellValue, expectedValue, isNewRow = false) => {
if (isNewRow) {
cy.get(".nc-add-new-row-btn:visible").should("exist");
cy.wait(500)
cy.get(".nc-add-new-row-btn").click();
} else {
// mainPage.getRow(index).find(".nc-row-expand-icon").click({ force: true });
cy.get(".nc-row-expand")
.eq(index-1)
.click({ force: true });
}
cy.get(".duration-cell-wrapper > input").first().should('exist').type(cellValue);
cy.getActiveDrawer().find("button").contains("Save row").click({ force: true });
cy.toastWait("Row updated successfully");
cy.getActiveDrawer().find("button").contains("Cancel").click({ force: true });
// mainPage.getCell(colName, index).find('input').then(($e) => {
// expect($e[0].value).to.equal(expectedValue)
// })
mainPage.getCell(colName, index)
.contains(expectedValue)
.should("exist");
}
///////////////////////////////////////////////////
// Test case
{
// Duration: h:mm
it("Duration: h:mm", () => {
addDurationColumn("NC_DURATION_0", "h:mm (e.g. 1:23)");
addDurationData("NC_DURATION_0", 1, "1:30", "01:30", true);
addDurationData("NC_DURATION_0", 2, "30", "00:30", true);
addDurationData("NC_DURATION_0", 3, "60", "01:00", true);
addDurationData("NC_DURATION_0", 4, "80", "01:20", true);
addDurationData("NC_DURATION_0", 5, "12:34", "12:34", true);
addDurationData("NC_DURATION_0", 6, "15:130", "17:10", true);
addDurationData("NC_DURATION_0", 7, "123123", "2052:03", true);
});
it("Duration: Edit Column NC_DURATION_0", () => {
editColumnByName(
"NC_DURATION_0",
"NC_DURATION_EDITED_0",
"h:mm:ss (e.g. 3:45, 1:23:40)"
);
});
it("Duration: Delete column", () => {
deleteColumnByName("NC_DURATION_EDITED_0");
});
}
{
// Duration: h:mm:ss
it("Duration: h:mm:ss", () => {
addDurationColumn("NC_DURATION_1", "h:mm:ss (e.g. 3:45, 1:23:40)");
addDurationData("NC_DURATION_1", 1, "11:22:33", "11:22:33");
addDurationData("NC_DURATION_1", 2, "1234", "00:20:34");
addDurationData("NC_DURATION_1", 3, "50", "00:00:50");
addDurationData("NC_DURATION_1", 4, "1:1111", "00:19:31");
addDurationData("NC_DURATION_1", 5, "1:11:1111", "01:29:31");
addDurationData("NC_DURATION_1", 6, "15:130", "00:17:10");
addDurationData("NC_DURATION_1", 7, "123123", "34:12:03");
});
it("Duration: Edit Column NC_DURATION_1", () => {
editColumnByName(
"NC_DURATION_1",
"NC_DURATION_EDITED_1",
"h:mm:ss.s (e.g. 3:34.6, 1:23:40.0)"
);
});
it("Duration: Delete column", () => {
deleteColumnByName("NC_DURATION_EDITED_1");
});
}
{
// h:mm:ss.s
it("Duration: h:mm:ss.s", () => {
addDurationColumn("NC_DURATION_2", "h:mm:ss.s (e.g. 3:34.6, 1:23:40.0)");
addDurationData("NC_DURATION_2", 1, "1234", "00:20:34.0");
addDurationData("NC_DURATION_2", 2, "12:34", "00:12:34.0");
addDurationData("NC_DURATION_2", 3, "12:34:56", "12:34:56.0");
addDurationData("NC_DURATION_2", 4, "12:34:999", "12:50:39.0");
addDurationData("NC_DURATION_2", 5, "12:999:56", "28:39:56.0");
addDurationData("NC_DURATION_2", 6, "12:34:56.12", "12:34:56.1");
addDurationData("NC_DURATION_2", 7, "12:34:56.199", "12:34:56.2");
});
it("Duration: Edit Column NC_DURATION_2", () => {
editColumnByName(
"NC_DURATION_2",
"NC_DURATION_EDITED_2",
"h:mm:ss (e.g. 3:45, 1:23:40)"
);
});
it("Duration: Delete column", () => {
deleteColumnByName("NC_DURATION_EDITED_2");
});
}
{
// h:mm:ss.ss
it("Duration: h:mm:ss.ss", () => {
addDurationColumn("NC_DURATION_3", "h:mm:ss.ss (e.g. 3.45.67, 1:23:40.00)");
addDurationData("NC_DURATION_3", 1, "1234", "00:20:34.00");
addDurationData("NC_DURATION_3", 2, "12:34", "00:12:34.00");
addDurationData("NC_DURATION_3", 3, "12:34:56", "12:34:56.00");
addDurationData("NC_DURATION_3", 4, "12:34:999", "12:50:39.00");
addDurationData("NC_DURATION_3", 5, "12:999:56", "28:39:56.00");
addDurationData("NC_DURATION_3", 6, "12:34:56.12", "12:34:56.12");
addDurationData("NC_DURATION_3", 7, "12:34:56.199", "12:34:56.20");
});
it("Duration: Edit Column NC_DURATION_3", () => {
editColumnByName(
"NC_DURATION_3",
"NC_DURATION_EDITED_3",
"h:mm:ss.ss (e.g. 3.45.67, 1:23:40.00)"
);
});
it("Duration: Delete column", () => {
deleteColumnByName("NC_DURATION_EDITED_3");
});
}
{
// h:mm:ss.sss
it("Duration: h:mm:ss.sss", () => {
addDurationColumn("NC_DURATION_4", "h:mm:ss.sss (e.g. 3.45.678, 1:23:40.000)");
addDurationData("NC_DURATION_4", 1, "1234", "00:20:34.000");
addDurationData("NC_DURATION_4", 2, "12:34", "00:12:34.000");
addDurationData("NC_DURATION_4", 3, "12:34:56", "12:34:56.000");
addDurationData("NC_DURATION_4", 4, "12:34:999", "12:50:39.000");
addDurationData("NC_DURATION_4", 5, "12:999:56", "28:39:56.000");
addDurationData("NC_DURATION_4", 6, "12:34:56.12", "12:34:56.012");
addDurationData("NC_DURATION_4", 7, "12:34:56.199", "12:34:56.199");
});
it("Duration: Edit Column NC_DURATION_4", () => {
editColumnByName(
"NC_DURATION_4",
"NC_DURATION_EDITED_4",
"h:mm (e.g. 1:23)"
);
});
it("Duration: Delete column", () => {
deleteColumnByName("NC_DURATION_EDITED_4");
});
}
if (!isTestSuiteActive(apiType, dbType)) return;
describe(`${apiType.toUpperCase()} api - DURATION`, () => {
const tableName = "DurationTable";
// to retrieve few v-input nodes from their label
//
const fetchParentFromLabel = (label) => {
cy.get("label").contains(label).parents(".ant-row").first().click();
};
// Run once before test- create table
//
before(() => {
mainPage.tabReset();
// // kludge: wait for page load to finish
// cy.wait(1000);
// // close team & auth tab
// cy.get('button.ant-tabs-tab-remove').should('exist').click();
// cy.wait(1000);
cy.createTable(tableName);
});
beforeEach(() => {});
after(() => {
cy.deleteTable(tableName);
});
// Routine to create a new look up column
//
const addDurationColumn = (columnName, durationFormat) => {
cy.get(".nc-grid tr > th:last .nc-icon").click({
force: true,
});
cy.getActiveMenu(".nc-dropdown-grid-add-column")
.find("input.nc-column-name-input", { timeout: 3000 })
.should("exist")
.clear()
.type(columnName);
// cy.get(".nc-column-type-input").last().click().type("Duration");
cy.getActiveMenu(".nc-dropdown-grid-add-column")
.find(".nc-column-type-input")
.last()
.click()
.type("Duration");
cy.getActiveSelection(".nc-dropdown-column-type")
.find(".ant-select-item-option")
.contains("Duration")
.click();
// Configure Duration format
fetchParentFromLabel("Duration Format");
cy.getActiveSelection(".nc-dropdown-duration-option")
.find(".ant-select-item-option")
.contains(durationFormat)
.click();
// cy.get(".ant-btn-primary").contains("Save").should('exist').click();
cy.getActiveMenu(".nc-dropdown-grid-add-column")
.find(".ant-btn-primary:visible")
.contains("Save")
.click();
cy.toastWait(`Column created`);
cy.get(`th[data-title="${columnName}"]`).should("exist");
};
// routine to delete column
//
const deleteColumnByName = (columnName) => {
mainPage.deleteColumn(columnName);
};
// routine to edit column
//
const editColumnByName = (oldName, newName, newDurationFormat) => {
cy.get(`th:contains(${oldName}) .nc-icon.ant-dropdown-trigger`)
.trigger("mouseover", { force: true })
.click({ force: true });
// cy.get(".nc-column-edit").click();
// cy.get(".nc-column-edit").should("not.be.visible");
cy.getActiveMenu(".nc-dropdown-column-operations")
.find(".nc-column-edit")
.click();
// rename column and verify
cy.getActiveMenu(".nc-dropdown-edit-column")
.find("input.nc-column-name-input", { timeout: 3000 })
.should("exist")
.clear()
.type(newName);
// Configure Duration format
fetchParentFromLabel("Duration Format");
cy.getActiveSelection(".nc-dropdown-duration-option")
.find(".ant-select-item-option")
.contains(newDurationFormat)
.click();
// cy.get(".ant-btn-primary:visible").contains("Save").click();
cy.getActiveMenu(".nc-dropdown-edit-column")
.find(".ant-btn-primary:visible")
.contains("Save")
.click();
cy.toastWait("Column updated");
cy.get(`th:contains(${oldName})`).should("not.exist");
cy.get(`th:contains(${newName})`).should("exist");
};
const addDurationData = (
colName,
index,
cellValue,
expectedValue,
isNewRow = false
) => {
if (isNewRow) {
cy.get(".nc-add-new-row-btn:visible").should("exist");
cy.wait(500);
cy.get(".nc-add-new-row-btn").click();
} else {
// mainPage.getRow(index).find(".nc-row-expand-icon").click({ force: true });
cy.get(".nc-row-expand")
.eq(index - 1)
.click({ force: true });
}
cy.get(".duration-cell-wrapper > input")
.first()
.should("exist")
.type(cellValue);
cy.getActiveDrawer(".nc-drawer-expanded-form")
.find("button")
.contains("Save row")
.should("exist")
.click();
cy.toastWait("Row updated successfully");
cy.getActiveDrawer(".nc-drawer-expanded-form")
.find("button")
.contains("Cancel")
.should("exist")
.click();
// mainPage.getCell(colName, index).find('input').then(($e) => {
// expect($e[0].value).to.equal(expectedValue)
// })
mainPage.getCell(colName, index).contains(expectedValue).should("exist");
};
///////////////////////////////////////////////////
// Test case
{
// Duration: h:mm
it("Duration: h:mm", () => {
addDurationColumn("NC_DURATION_0", "h:mm (e.g. 1:23)");
addDurationData("NC_DURATION_0", 1, "1:30", "01:30", true);
addDurationData("NC_DURATION_0", 2, "30", "00:30", true);
addDurationData("NC_DURATION_0", 3, "60", "01:00", true);
addDurationData("NC_DURATION_0", 4, "80", "01:20", true);
addDurationData("NC_DURATION_0", 5, "12:34", "12:34", true);
addDurationData("NC_DURATION_0", 6, "15:130", "17:10", true);
addDurationData("NC_DURATION_0", 7, "123123", "2052:03", true);
});
it("Duration: Edit Column NC_DURATION_0", () => {
editColumnByName(
"NC_DURATION_0",
"NC_DURATION_EDITED_0",
"h:mm:ss (e.g. 3:45, 1:23:40)"
);
});
it("Duration: Delete column", () => {
deleteColumnByName("NC_DURATION_EDITED_0");
});
}
{
// Duration: h:mm:ss
it("Duration: h:mm:ss", () => {
addDurationColumn("NC_DURATION_1", "h:mm:ss (e.g. 3:45, 1:23:40)");
addDurationData("NC_DURATION_1", 1, "11:22:33", "11:22:33");
addDurationData("NC_DURATION_1", 2, "1234", "00:20:34");
addDurationData("NC_DURATION_1", 3, "50", "00:00:50");
addDurationData("NC_DURATION_1", 4, "1:1111", "00:19:31");
addDurationData("NC_DURATION_1", 5, "1:11:1111", "01:29:31");
addDurationData("NC_DURATION_1", 6, "15:130", "00:17:10");
addDurationData("NC_DURATION_1", 7, "123123", "34:12:03");
});
it("Duration: Edit Column NC_DURATION_1", () => {
editColumnByName(
"NC_DURATION_1",
"NC_DURATION_EDITED_1",
"h:mm:ss.s (e.g. 3:34.6, 1:23:40.0)"
);
});
it("Duration: Delete column", () => {
deleteColumnByName("NC_DURATION_EDITED_1");
});
}
{
// h:mm:ss.s
it("Duration: h:mm:ss.s", () => {
addDurationColumn(
"NC_DURATION_2",
"h:mm:ss.s (e.g. 3:34.6, 1:23:40.0)"
);
addDurationData("NC_DURATION_2", 1, "1234", "00:20:34.0");
addDurationData("NC_DURATION_2", 2, "12:34", "00:12:34.0");
addDurationData("NC_DURATION_2", 3, "12:34:56", "12:34:56.0");
addDurationData("NC_DURATION_2", 4, "12:34:999", "12:50:39.0");
addDurationData("NC_DURATION_2", 5, "12:999:56", "28:39:56.0");
addDurationData("NC_DURATION_2", 6, "12:34:56.12", "12:34:56.1");
addDurationData("NC_DURATION_2", 7, "12:34:56.199", "12:34:56.2");
});
it("Duration: Edit Column NC_DURATION_2", () => {
editColumnByName(
"NC_DURATION_2",
"NC_DURATION_EDITED_2",
"h:mm:ss (e.g. 3:45, 1:23:40)"
);
});
it("Duration: Delete column", () => {
deleteColumnByName("NC_DURATION_EDITED_2");
});
}
{
// h:mm:ss.ss
it("Duration: h:mm:ss.ss", () => {
addDurationColumn(
"NC_DURATION_3",
"h:mm:ss.ss (e.g. 3.45.67, 1:23:40.00)"
);
addDurationData("NC_DURATION_3", 1, "1234", "00:20:34.00");
addDurationData("NC_DURATION_3", 2, "12:34", "00:12:34.00");
addDurationData("NC_DURATION_3", 3, "12:34:56", "12:34:56.00");
addDurationData("NC_DURATION_3", 4, "12:34:999", "12:50:39.00");
addDurationData("NC_DURATION_3", 5, "12:999:56", "28:39:56.00");
addDurationData("NC_DURATION_3", 6, "12:34:56.12", "12:34:56.12");
addDurationData("NC_DURATION_3", 7, "12:34:56.199", "12:34:56.20");
});
it("Duration: Edit Column NC_DURATION_3", () => {
editColumnByName(
"NC_DURATION_3",
"NC_DURATION_EDITED_3",
"h:mm:ss.ss (e.g. 3.45.67, 1:23:40.00)"
);
});
it("Duration: Delete column", () => {
deleteColumnByName("NC_DURATION_EDITED_3");
});
}
{
// h:mm:ss.sss
it("Duration: h:mm:ss.sss", () => {
addDurationColumn(
"NC_DURATION_4",
"h:mm:ss.sss (e.g. 3.45.678, 1:23:40.000)"
);
addDurationData("NC_DURATION_4", 1, "1234", "00:20:34.000");
addDurationData("NC_DURATION_4", 2, "12:34", "00:12:34.000");
addDurationData("NC_DURATION_4", 3, "12:34:56", "12:34:56.000");
addDurationData("NC_DURATION_4", 4, "12:34:999", "12:50:39.000");
addDurationData("NC_DURATION_4", 5, "12:999:56", "28:39:56.000");
addDurationData("NC_DURATION_4", 6, "12:34:56.12", "12:34:56.012");
addDurationData("NC_DURATION_4", 7, "12:34:56.199", "12:34:56.199");
});
it("Duration: Edit Column NC_DURATION_4", () => {
editColumnByName(
"NC_DURATION_4",
"NC_DURATION_EDITED_4",
"h:mm (e.g. 1:23)"
);
});
it("Duration: Delete column", () => {
deleteColumnByName("NC_DURATION_EDITED_4");
});
}
});
};
/**
@ -299,4 +318,4 @@ export const genTest = (apiType, dbType) => {
* 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/>.
*
*/
*/

153
scripts/cypress/integration/common/3f_link_to_another_record.js

@ -6,22 +6,20 @@ export const genTest = (apiType, dbType) => {
if (!isTestSuiteActive(apiType, dbType)) return;
describe(`${apiType.toUpperCase()} api - Link to another record`, () => {
function fetchParentFromLabel(label) {
cy.get("label").contains(label).parents(".ant-row").click();
}
// Insert new row
function addRow(index, cellValue) {
cy.get('.nc-grid-add-new-cell').should('exist').click();
mainPage.getCell('Title', index)
.dblclick().then(($el) => {
cy.wrap($el).find('input')
.clear()
.type(`${cellValue}{enter}`);
});
mainPage.getCell('Title', index)
.contains(cellValue).should('exist');
cy.get(".nc-grid-add-new-cell").should("exist").click();
mainPage
.getCell("Title", index)
.dblclick()
.then(($el) => {
cy.wrap($el).find("input").clear().type(`${cellValue}{enter}`);
});
mainPage.getCell("Title", index).contains(cellValue).should("exist");
}
// Insert LTAR column
@ -31,8 +29,9 @@ export const genTest = (apiType, dbType) => {
cy.get(".nc-grid tr > th:last .nc-icon").click();
// Column name
cy.getActiveMenu(".nc-dropdown-grid-add-column").find('input.nc-column-name-input', { timeout: 3000 })
.should('exist')
cy.getActiveMenu(".nc-dropdown-grid-add-column")
.find("input.nc-column-name-input", { timeout: 3000 })
.should("exist")
.clear()
.type(columnName);
@ -40,30 +39,27 @@ export const genTest = (apiType, dbType) => {
// cy.get(".nc-column-type-input").last()
// .click()
// .type("Link");
cy.getActiveMenu('.nc-dropdown-grid-add-column')
cy.getActiveMenu(".nc-dropdown-grid-add-column")
.find(".nc-column-type-input")
.last()
.click()
.type("Link")
cy.getActiveSelection('.nc-dropdown-column-type')
.find('.ant-select-item-option')
.type("Link");
cy.getActiveSelection(".nc-dropdown-column-type")
.find(".ant-select-item-option")
.contains("LinkToAnotherRecord")
.click();
// relation type (hm/ mm)
cy.get('.nc-ltar-relation-type')
.find('.ant-radio')
.eq(relationType==='hm'?0:1)
cy.get(".nc-ltar-relation-type")
.find(".ant-radio")
.eq(relationType === "hm" ? 0 : 1)
.click();
// Foreign table
fetchParentFromLabel("Child table");
cy.get(".nc-ltar-child-table")
.last()
.click()
.type(foreignTable);
cy.getActiveSelection('.nc-dropdown-ltar-child-table')
.find('.ant-select-item-option')
cy.get(".nc-ltar-child-table").last().click().type(foreignTable);
cy.getActiveSelection(".nc-dropdown-ltar-child-table")
.find(".ant-select-item-option")
.contains(foreignTable)
.click();
@ -72,7 +68,7 @@ export const genTest = (apiType, dbType) => {
// .contains("Save")
// .should('exist')
// .click();
cy.getActiveMenu('.nc-dropdown-grid-add-column')
cy.getActiveMenu(".nc-dropdown-grid-add-column")
.find(".ant-btn-primary:visible")
.contains("Save")
.click();
@ -81,16 +77,15 @@ export const genTest = (apiType, dbType) => {
cy.toastWait(`Column created`);
// Verify
cy.get(`th[data-title="${columnName}"]`)
.should("exist");
};
cy.get(`th[data-title="${columnName}"]`).should("exist");
}
// Content verification for LTAR cell
// Validates only 1st chip contents
//
function verifyLtarCell(columnName, index, cellValue) {
cy.get(`:nth-child(${index}) > [data-title="${columnName}"]`)
.find('.chip')
.find(".chip")
.eq(0)
.contains(cellValue)
.should("exist");
@ -100,12 +95,14 @@ export const genTest = (apiType, dbType) => {
//
function ltarUnlink(columnName, index) {
// Click on cell to enable unlink icon
cy.get(`:nth-child(${index}) > [data-title="${columnName}"]`).last()
.click()
cy.get(`:nth-child(${index}) > [data-title="${columnName}"]`)
.last()
.click();
// Click on unlink icon
cy.get(`:nth-child(${index}) > [data-title="${columnName}"]`).last()
.find('.unlink-icon')
cy.get(`:nth-child(${index}) > [data-title="${columnName}"]`)
.last()
.find(".unlink-icon")
.should("exist")
.click();
@ -120,7 +117,7 @@ export const genTest = (apiType, dbType) => {
afterEach(() => {
cy.saveLocalStorage();
})
});
beforeEach(() => {
cy.restoreLocalStorage();
@ -174,7 +171,8 @@ export const genTest = (apiType, dbType) => {
cy.get(".nc-add-new-row-btn").click();
// Title
cy.get(".nc-expand-col-Title").find(".nc-cell > input")
cy.get(".nc-expand-col-Title")
.find(".nc-cell > input")
.should("exist")
.first()
.clear()
@ -186,80 +184,84 @@ export const genTest = (apiType, dbType) => {
//
// BT
cy.get(".nc-expand-col-Sheet1").find(".nc-action-icon")
cy.get(".nc-expand-col-Sheet1")
.find(".nc-action-icon")
.should("exist")
.click({ force: true });
cy.wait(1000);
cy.getActiveModal(".nc-modal-link-record")
.find('.ant-card').should('exist')
.eq(0).click();
.find(".ant-card")
.should("exist")
.eq(0)
.click();
// MM
cy.get(".nc-expand-col-Sheet1.List").find(".ant-btn-primary").click();
cy.wait(1000);
cy.getActiveModal(".nc-modal-link-record")
.find('.ant-card').should('exist')
.eq(0).click();
.find(".ant-card")
.should("exist")
.eq(0)
.click();
// HM
cy.get(".nc-expand-col-Link2-1hm")
.find(".ant-btn-primary")
.click();
cy.get(".nc-expand-col-Link2-1hm").find(".ant-btn-primary").click();
cy.wait(1000);
cy.getActiveModal()
.find('.ant-card').should('exist')
.eq(0).click();
cy.getActiveModal().find(".ant-card").should("exist").eq(0).click();
// Save row
cy.getActiveDrawer()
cy.getActiveDrawer(".nc-drawer-expanded-form")
.find("button")
.contains("Save row")
.click({ force: true });
.should("exist")
.click();
// Toast
cy.toastWait("updated successfully");
// Close modal
cy.get("body").type("{esc}");
})
});
// In cell insert
it("Add HM, BT, MM Link, In cell form", () => {
// Insert row with `Title` field, rest of links are empty
addRow(2, "2b");
// BT
mainPage.getCell("Sheet1", 2)
mainPage
.getCell("Sheet1", 2)
.find(".nc-action-icon")
.click({ force: true });
cy.getActiveModal(".nc-modal-link-record")
.find('.ant-card')
.should('exist')
.find(".ant-card")
.should("exist")
.eq(1)
.click();
cy.wait(1000);
// MM
mainPage.getCell("Sheet1 List", 2)
mainPage
.getCell("Sheet1 List", 2)
.find(".nc-action-icon")
.last()
.click({ force: true });
cy.getActiveModal(".nc-modal-link-record")
.find('.ant-card')
.should('exist')
.find(".ant-card")
.should("exist")
.eq(1)
.click();
cy.wait(1000);
// HM
mainPage.getCell("Link2-1hm", 2)
mainPage
.getCell("Link2-1hm", 2)
.find(".nc-action-icon")
.last()
.click({ force: true });
cy.getActiveModal(".nc-modal-link-record")
.find('.ant-card')
.should('exist')
.find(".ant-card")
.should("exist")
.eq(1)
.click();
});
@ -277,31 +279,36 @@ export const genTest = (apiType, dbType) => {
.click({ force: true });
cy.wait(1000);
cy.getActiveModal(".nc-modal-link-record")
.find('.ant-card').should('exist')
.eq(2).click();
.find(".ant-card")
.should("exist")
.eq(2)
.click();
// MM
cy.get(".nc-expand-col-Sheet1.List")
.find(".ant-btn-primary").click();
cy.get(".nc-expand-col-Sheet1.List").find(".ant-btn-primary").click();
cy.wait(1000);
cy.getActiveModal(".nc-modal-link-record")
.find('.ant-card').should('exist')
.eq(2).click();
.find(".ant-card")
.should("exist")
.eq(2)
.click();
cy.wait(1000);
// HM
cy.get(".nc-expand-col-Link2-1hm")
.find(".ant-btn-primary").click();
cy.get(".nc-expand-col-Link2-1hm").find(".ant-btn-primary").click();
cy.wait(1000);
cy.getActiveModal(".nc-modal-link-record")
.find('.ant-card').should('exist')
.eq(2).click();
.find(".ant-card")
.should("exist")
.eq(2)
.click();
cy.wait(1000);
cy.getActiveDrawer()
cy.getActiveDrawer(".nc-drawer-expanded-form")
.find("button")
.contains("Save row")
.click({ force: true });
.should("exist")
.click();
// cy.toastWait("updated successfully");
cy.toastWait("No columns to update");
@ -332,7 +339,7 @@ export const genTest = (apiType, dbType) => {
verifyLtarCell("Sheet2", 2, "2b");
verifyLtarCell("Sheet2", 3, "2c");
cy.closeTableTab("Sheet1");
})
});
it("Unlink", () => {
cy.openTableTab("Sheet1", 3);

12
scripts/cypress/integration/common/4f_grid_view_share.js

@ -396,9 +396,17 @@ export const genTest = (apiType, dbType) => {
.first()
.clear({ force: true })
.type("a");
cy.getActiveDrawer().find("button").contains("Save row").click();
cy.getActiveDrawer(".nc-drawer-expanded-form")
.find("button")
.contains("Save row")
.should("exist")
.click();
cy.toastWait("updated successfully");
cy.getActiveDrawer().find("button").contains("Cancel").click();
cy.getActiveDrawer(".nc-drawer-expanded-form")
.find("button")
.contains("Cancel")
.should("exist")
.click();
// add column
mainPage.addColumn("dummy", "Country");

3
scripts/cypress/integration/common/8a_webhook.js

@ -205,7 +205,8 @@ function updateRow(index, cellValue) {
cy.getActiveDrawer(".nc-drawer-expanded-form")
.find("button")
.contains("Save row")
.click({ force: true });
.should("exist")
.click();
// partial toast message
cy.toastWait("updated successfully");

512
scripts/cypress/integration/spec/roleValidation.spec.js

@ -7,151 +7,187 @@ import { roles } from "../../support/page_objects/projectConstants";
// 3. Preview mode menu
//
export function _advSettings(roleType, mode) {
cy.log(roleType, mode);
if(mode === 'baseShare') {
// open modal
cy.get('.nc-project-menu').should('exist').click()
cy.getActiveMenu(".nc-dropdown-project-menu").find(`[data-menu-id="language"]`).should('exist')
// click again to close modal
cy.get('.nc-project-menu').should('exist').click()
return;
}
let validationString =
true == roles[roleType].validations.advSettings ? "exist" : "not.exist";
// cy.get(".nc-team-settings").should(validationString);
cy.get('.nc-project-menu').should('exist').click()
cy.getActiveMenu(".nc-dropdown-project-menu").find(`[data-menu-id="preview-as"]`).should(validationString)
cy.getActiveMenu(".nc-dropdown-project-menu").find(`[data-menu-id="teamAndSettings"]:visible`).should(validationString)
if (true === roles[roleType].validations.advSettings) {
cy.getActiveMenu(".nc-dropdown-project-menu").find(`[data-menu-id="teamAndSettings"]:visible`).should(validationString).click()
cy.get(`[data-menu-id="teamAndAuth"]`).should('exist')
cy.get(`[data-menu-id="appStore"]`).should('exist')
cy.get(`[data-menu-id="metaData"]`).should('exist')
cy.get(`[data-menu-id="audit"]`).should('exist')
settingsPage.closeMenu()
} else {
cy.get('.nc-project-menu').should('exist').click()
}
// float menu in preview mode
if ("preview" === mode) {
cy.get(".nc-floating-preview-btn").should("exist");
cy.get('.nc-floating-preview-btn')
.find(`[type="radio"][value="${roles[roleType].name}"]`)
.should("be.checked");
}
// cy.get("body").click("bottomRight");
cy.log(roleType, mode);
if (mode === "baseShare") {
// open modal
cy.get(".nc-project-menu").should("exist").click();
cy.getActiveMenu(".nc-dropdown-project-menu")
.find(`[data-menu-id="language"]`)
.should("exist");
// click again to close modal
cy.get(".nc-project-menu").should("exist").click();
return;
}
let validationString =
true == roles[roleType].validations.advSettings ? "exist" : "not.exist";
// cy.get(".nc-team-settings").should(validationString);
cy.get(".nc-project-menu").should("exist").click();
cy.getActiveMenu(".nc-dropdown-project-menu")
.find(`[data-menu-id="preview-as"]`)
.should(validationString);
cy.getActiveMenu(".nc-dropdown-project-menu")
.find(`[data-menu-id="teamAndSettings"]:visible`)
.should(validationString);
if (true === roles[roleType].validations.advSettings) {
cy.getActiveMenu(".nc-dropdown-project-menu")
.find(`[data-menu-id="teamAndSettings"]:visible`)
.should(validationString)
.click();
cy.get(`[data-menu-id="teamAndAuth"]`).should("exist");
cy.get(`[data-menu-id="appStore"]`).should("exist");
cy.get(`[data-menu-id="metaData"]`).should("exist");
cy.get(`[data-menu-id="audit"]`).should("exist");
settingsPage.closeMenu();
} else {
cy.get(".nc-project-menu").should("exist").click();
}
// float menu in preview mode
if ("preview" === mode) {
cy.get(".nc-floating-preview-btn").should("exist");
cy.get(".nc-floating-preview-btn")
.find(`[type="radio"][value="${roles[roleType].name}"]`)
.should("be.checked");
}
// cy.get("body").click("bottomRight");
}
export function _editSchema(roleType, mode) {
let columnName = "City";
let validationString =
true === roles[roleType].validations.editSchema ? "exist" : "not.exist";
cy.openTableTab(columnName, 25);
// create table
cy.get(`.nc-add-new-table`).should(validationString);
// delete table option
cy.get(`.nc-project-tree-tbl-City`).should("exist").rightclick();
cy.get(".ant-dropdown-content:visible").should(validationString);
if(validationString === "exist"){
cy.getActiveMenu(".nc-dropdown-tree-view-context-menu").find('[role="menuitem"]').contains("Delete").should("exist");
cy.getActiveMenu(".nc-dropdown-tree-view-context-menu").find('[role="menuitem"]').contains("Rename").should("exist");
// click on a cell to close table context menu
mainPage.getCell(columnName, 3).click();
}
// add new column option
//
cy.get(".nc-column-add").should(validationString);
// update column (edit/ delete menu)
cy.get('.nc-ui-dt-dropdown').should(validationString)
if(validationString === "exist"){
cy.get('.nc-import-menu').should('exist').click();
cy.getActiveMenu(".nc-dropdown-import-menu").should('exist')
cy.getActiveMenu(".nc-dropdown-import-menu").find('.ant-dropdown-menu-item').contains('Airtable')
cy.getActiveMenu(".nc-dropdown-import-menu").find('.ant-dropdown-menu-item').contains('CSV file')
cy.getActiveMenu(".nc-dropdown-import-menu").find('.ant-dropdown-menu-item').contains('JSON file')
cy.getActiveMenu(".nc-dropdown-import-menu").find('.ant-dropdown-menu-item').contains('Microsoft Excel')
}
let columnName = "City";
let validationString =
true === roles[roleType].validations.editSchema ? "exist" : "not.exist";
cy.openTableTab(columnName, 25);
// create table
cy.get(`.nc-add-new-table`).should(validationString);
// delete table option
cy.get(`.nc-project-tree-tbl-City`).should("exist").rightclick();
cy.get(".ant-dropdown-content:visible").should(validationString);
if (validationString === "exist") {
cy.getActiveMenu(".nc-dropdown-tree-view-context-menu")
.find('[role="menuitem"]')
.contains("Delete")
.should("exist");
cy.getActiveMenu(".nc-dropdown-tree-view-context-menu")
.find('[role="menuitem"]')
.contains("Rename")
.should("exist");
// click on a cell to close table context menu
mainPage.getCell(columnName, 3).click();
}
// add new column option
//
cy.get(".nc-column-add").should(validationString);
// update column (edit/ delete menu)
cy.get(".nc-ui-dt-dropdown").should(validationString);
if (validationString === "exist") {
cy.get(".nc-import-menu").should("exist").click();
cy.getActiveMenu(".nc-dropdown-import-menu").should("exist");
cy.getActiveMenu(".nc-dropdown-import-menu")
.find(".ant-dropdown-menu-item")
.contains("Airtable");
cy.getActiveMenu(".nc-dropdown-import-menu")
.find(".ant-dropdown-menu-item")
.contains("CSV file");
cy.getActiveMenu(".nc-dropdown-import-menu")
.find(".ant-dropdown-menu-item")
.contains("JSON file");
cy.getActiveMenu(".nc-dropdown-import-menu")
.find(".ant-dropdown-menu-item")
.contains("Microsoft Excel");
}
}
export function _editData(roleType, mode) {
let columnName = "City";
let validationString =
true === roles[roleType].validations.editData ? "exist" : "not.exist";
let columnName = "City";
let validationString =
true === roles[roleType].validations.editData ? "exist" : "not.exist";
cy.openTableTab(columnName, 25);
cy.openTableTab(columnName, 25);
// add row button
cy.get(".nc-add-new-row-btn:visible").should(validationString);
// add row button
cy.get('.nc-add-new-row-btn:visible').should(validationString);
// add button at bottom of page
mainPage.getCell(columnName, 25).scrollIntoView();
cy.get(".nc-grid-add-new-cell:visible").should(validationString);
// add button at bottom of page
mainPage.getCell(columnName, 25).scrollIntoView();
cy.get('.nc-grid-add-new-cell:visible').should(validationString);
// update row option (right click)
//
mainPage.getCell("City", 5).rightclick();
cy.wait(100);
cy.get(".ant-dropdown-content:visible").should(validationString);
// update row option (right click)
if (validationString === "exist") {
// right click options will exist (only for 'exist' case)
//
mainPage.getCell("City", 5).rightclick();
cy.wait(100);
cy.get(".ant-dropdown-content:visible").should(validationString);
if (validationString === "exist") {
// right click options will exist (only for 'exist' case)
//
cy.getActiveMenu(".nc-dropdown-grid-context-menu").contains("Insert New Row").should(validationString);
cy.getActiveMenu(".nc-dropdown-grid-context-menu").contains("Clear cell").should(validationString);
cy.getActiveMenu(".nc-dropdown-grid-context-menu").contains("Delete Row").should(validationString);
cy.getActiveMenu(".nc-dropdown-grid-context-menu").contains("Delete Selected Rows").should(validationString);
// cy.get("body").type("{esc}");
mainPage.getCell("City", 13).click();
// update cell contents option using row expander should be enabled
//
mainPage
.getRow(1)
.find('.nc-row-no').should('exist')
.eq(0)
.trigger('mouseover', { force: true })
cy.get(".nc-row-expand")
.should("exist")
.eq(10)
.click({ force: true });
cy.getActiveDrawer().find("button").contains("Save row").should("exist");
cy.getActiveDrawer().find("button").contains("Cancel").should("exist").click();
} else {
// update cell contents option using row expander should be disabled
//
cy.get(".nc-row-expand")
.should("exist")
.eq(10)
.click({ force: true });
cy.getActiveDrawer().find("button:disabled").contains("Save row").should("exist");
cy.getActiveDrawer().find("button").contains("Cancel").should("exist").click();
}
// double click cell entries to edit
cy.getActiveMenu(".nc-dropdown-grid-context-menu")
.contains("Insert New Row")
.should(validationString);
cy.getActiveMenu(".nc-dropdown-grid-context-menu")
.contains("Clear cell")
.should(validationString);
cy.getActiveMenu(".nc-dropdown-grid-context-menu")
.contains("Delete Row")
.should(validationString);
cy.getActiveMenu(".nc-dropdown-grid-context-menu")
.contains("Delete Selected Rows")
.should(validationString);
// cy.get("body").type("{esc}");
mainPage.getCell("City", 13).click();
// update cell contents option using row expander should be enabled
//
mainPage
.getRow(1)
.find(".nc-row-no")
.should("exist")
.eq(0)
.trigger("mouseover", { force: true });
cy.get(".nc-row-expand").should("exist").eq(10).click({ force: true });
cy.getActiveDrawer(".nc-drawer-expanded-form")
.find("button")
.contains("Save row")
.should("exist");
cy.getActiveDrawer(".nc-drawer-expanded-form")
.find("button")
.contains("Cancel")
.should("exist")
.click();
} else {
// update cell contents option using row expander should be disabled
//
mainPage.getCell("City", 5)
.dblclick()
.find("input")
.should(validationString);
cy.get(".nc-row-expand").should("exist").eq(10).click({ force: true });
cy.getActiveDrawer(".nc-drawer-expanded-form")
.find("button:disabled")
.contains("Save row")
.should("exist");
cy.getActiveDrawer(".nc-drawer-expanded-form")
.find("button")
.contains("Cancel")
.should("exist")
.click();
}
// double click cell entries to edit
//
mainPage.getCell("City", 5).dblclick().find("input").should(validationString);
}
// read &/ update comment
@ -159,136 +195,138 @@ export function _editData(roleType, mode) {
// Everyone else: read &/ update
//
export function _editComment(roleType, mode) {
let columnName = "City";
let validationString =
true === roles[roleType].validations.editComment
? "Comment added successfully"
: "Not allowed";
let columnName = "City";
let validationString =
true === roles[roleType].validations.editComment
? "Comment added successfully"
: "Not allowed";
cy.openTableTab(columnName, 25);
cy.openTableTab(columnName, 25);
cy.wait(1000);
cy.wait(1000);
// click on comment icon & type comment
//
cy.get(".nc-row-expand")
.should("exist")
.eq(10)
.click({force:true});
// click on comment icon & type comment
//
cy.get(".nc-row-expand").should("exist").eq(10).click({ force: true });
// Expected response:
// Viewer: Not able to see comment option
// Everyone else: Comment added/read successfully
//
// Expected response:
// Viewer: Not able to see comment option
// Everyone else: Comment added/read successfully
//
cy.wait(3000);
if ("viewer" === roleType) {
cy.getActiveDrawer(".nc-drawer-expanded-form")
.should("exist")
.find(".nc-toggle-comments")
.should("not.exist");
} else {
cy.getActiveDrawer(".nc-drawer-expanded-form")
.should("exist")
.find(".nc-toggle-comments")
.should("exist")
.click();
cy.wait(3000);
if ("viewer" === roleType) {
cy.getActiveDrawer()
.should('exist')
.find(".nc-toggle-comments")
.should("not.exist");
} else {
cy.getActiveDrawer()
.should('exist')
.find(".nc-toggle-comments")
.should("exist")
.click();
cy.getActiveDrawer().find(".nc-comment-box").should('exist').type("Comment-1{enter}");
// cy.toastWait('Comment added successfully')
cy.getActiveDrawer().find(".nc-toggle-comments").click();
}
cy.getActiveDrawer()
.find("button")
.contains("Cancel")
.should("exist")
.click();
cy.getActiveDrawer(".nc-drawer-expanded-form")
.find(".nc-comment-box")
.should("exist")
.type("Comment-1{enter}");
// cy.toastWait('Comment added successfully')
cy.getActiveDrawer(".nc-drawer-expanded-form")
.find(".nc-toggle-comments")
.click();
}
cy.getActiveDrawer(".nc-drawer-expanded-form")
.find("button")
.contains("Cancel")
.should("exist")
.click();
}
// right navigation menu bar
// Editor/Viewer/Commenter : can only view 'existing' views
// Rest: can create/edit
export function _viewMenu(roleType, mode) {
let columnName = "City";
// Lock, Download, Upload
let menuWithSubmenuCount = 3;
// share view list, webhook
let menuWithoutSubmenuCount = 3;
cy.openTableTab(columnName, 25);
let validationString =
true === roles[roleType].validations.shareView ? "exist" : "not.exist";
if (roleType === "editor") {
// Download / Upload CSV
menuWithSubmenuCount = 2;
// Get API Snippet
menuWithoutSubmenuCount = 1
if(mode === 'baseShare') menuWithoutSubmenuCount = 0
} else if (roleType === "commenter" || roleType === "viewer") {
// Download CSV & Download excel
menuWithSubmenuCount = 0;
menuWithoutSubmenuCount = 2
}
// view list field (default GRID view)
cy.get(`.nc-view-item`).should("exist");
// view create option, exists only for owner/ creator
cy.get(`.nc-create-grid-view`).should(validationString);
cy.get(`.nc-create-gallery-view`).should(validationString);
cy.get(`.nc-create-form-view`).should(validationString);
// share view permissions are role specific
// actions menu (more), only download csv should be visible for non-previlaged users
cy.get(".nc-actions-menu-btn").click();
cy.getActiveMenu(".nc-dropdown-actions-menu")
.find('.ant-dropdown-menu-submenu:visible')
.should("have.length", menuWithSubmenuCount);
cy.getActiveMenu(".nc-dropdown-actions-menu")
.find('.ant-dropdown-menu-item:visible')
.should("have.length", menuWithoutSubmenuCount);
// click again to close menu
cy.get(".nc-actions-menu-btn").click();
let columnName = "City";
// Lock, Download, Upload
let menuWithSubmenuCount = 3;
// share view list, webhook
let menuWithoutSubmenuCount = 3;
cy.openTableTab(columnName, 25);
let validationString =
true === roles[roleType].validations.shareView ? "exist" : "not.exist";
if (roleType === "editor") {
// Download / Upload CSV
menuWithSubmenuCount = 2;
// Get API Snippet
menuWithoutSubmenuCount = 1;
if (mode === "baseShare") menuWithoutSubmenuCount = 0;
} else if (roleType === "commenter" || roleType === "viewer") {
// Download CSV & Download excel
menuWithSubmenuCount = 0;
menuWithoutSubmenuCount = 2;
}
// view list field (default GRID view)
cy.get(`.nc-view-item`).should("exist");
// view create option, exists only for owner/ creator
cy.get(`.nc-create-grid-view`).should(validationString);
cy.get(`.nc-create-gallery-view`).should(validationString);
cy.get(`.nc-create-form-view`).should(validationString);
// share view permissions are role specific
// actions menu (more), only download csv should be visible for non-previlaged users
cy.get(".nc-actions-menu-btn").click();
cy.getActiveMenu(".nc-dropdown-actions-menu")
.find(".ant-dropdown-menu-submenu:visible")
.should("have.length", menuWithSubmenuCount);
cy.getActiveMenu(".nc-dropdown-actions-menu")
.find(".ant-dropdown-menu-item:visible")
.should("have.length", menuWithoutSubmenuCount);
// click again to close menu
cy.get(".nc-actions-menu-btn").click();
}
export function _topRightMenu(roleType, mode) {
// kludge; download csv menu persists until clicked
let columnName = "City";
// cy.closeTableTab(columnName);
// cy.openTableTab(columnName, 25);
// kludge; download csv menu persists until clicked
let columnName = "City";
// cy.closeTableTab(columnName);
// cy.openTableTab(columnName, 25);
let validationString =
true == roles[roleType].validations.shareView ? "exist" : "not.exist";
let validationString =
true == roles[roleType].validations.shareView ? "exist" : "not.exist";
cy.get(`.nc-share-base`).should(validationString);
cy.get(".nc-menu-translate").should("exist");
cy.get(".nc-menu-accounts").should("exist");
cy.get(`.nc-share-base`).should(validationString);
cy.get(".nc-menu-translate").should("exist");
cy.get(".nc-menu-accounts").should("exist");
}
// Access control list
//
export function disableTableAccess(tbl, role) {
const cls = `.nc-acl-${tbl}-${role}-chkbox`;
cy.get(cls).find("input").should("be.checked").click({ force: true });
cy.get(cls).find("input").should("not.be.checked");
const cls = `.nc-acl-${tbl}-${role}-chkbox`;
cy.get(cls).find("input").should("be.checked").click({ force: true });
cy.get(cls).find("input").should("not.be.checked");
}
export function enableTableAccess(tbl, role) {
const cls = `.nc-acl-${tbl}-${role}-chkbox`;
cy.get(cls).find("input").should("not.be.checked").click({ force: true });
cy.get(cls).find("input").should("be.checked");
const cls = `.nc-acl-${tbl}-${role}-chkbox`;
cy.get(cls).find("input").should("not.be.checked").click({ force: true });
cy.get(cls).find("input").should("be.checked");
}
export function _accessControl(roleType, previewMode) {
let validationString = roleType === "creator" ? "exist" : "not.exist";
let validationString = roleType === "creator" ? "exist" : "not.exist";
cy.get(`.nc-project-tree-tbl-Language`).should(validationString)
cy.get(`.nc-project-tree-tbl-CustomerList`).should(validationString)
cy.get(`.nc-project-tree-tbl-Language`).should(validationString);
cy.get(`.nc-project-tree-tbl-CustomerList`).should(validationString);
}

33
scripts/cypress/integration/test/restTableOps.js

@ -1,4 +1,3 @@
let t01 = require("../common/00_pre_configurations");
let t1a = require("../common/1a_table_operations");
let t1b = require("../common/1b_table_column_operations");
@ -14,26 +13,26 @@ let t3d = require("../common/3d_rollup_column");
let t3e = require("../common/3e_duration_column");
let t3f = require("../common/3f_link_to_another_record");
const {
setCurrentMode,
setCurrentMode,
} = require("../../support/page_objects/projectConstants");
const nocoTestSuite = (apiType, dbType) => {
setCurrentMode(apiType, dbType);
t01.genTest(apiType, dbType);
setCurrentMode(apiType, dbType);
t01.genTest(apiType, dbType);
t1a.genTest(apiType, dbType);
t1b.genTest(apiType, dbType);
t1c.genTest(apiType, dbType);
// NcGUI v2 t1d.genTest(apiType, dbType);
t1e.genTest(apiType, dbType);
t2a.genTest(apiType, dbType);
t2b.genTest(apiType, dbType);
t3a.genTest(apiType, dbType);
t3b.genTest(apiType, dbType);
t3c.genTest(apiType, dbType);
t3d.genTest(apiType, dbType);
// NcGUI v2 t3e.genTest(apiType, dbType);
t3f.genTest(apiType, dbType);
t1a.genTest(apiType, dbType);
t1b.genTest(apiType, dbType);
t1c.genTest(apiType, dbType);
// NcGUI v2 t1d.genTest(apiType, dbType);
t1e.genTest(apiType, dbType);
t2a.genTest(apiType, dbType);
t2b.genTest(apiType, dbType);
t3a.genTest(apiType, dbType);
t3b.genTest(apiType, dbType);
t3c.genTest(apiType, dbType);
t3d.genTest(apiType, dbType);
// NcGUI v2 t3e.genTest(apiType, dbType);
t3f.genTest(apiType, dbType);
};
nocoTestSuite("rest", "mysql");

Loading…
Cancel
Save