diff --git a/scripts/cypress/integration/common/3d_rollup_column.js b/scripts/cypress/integration/common/3d_rollup_column.js index a6ec1055c9..a6048d32e5 100644 --- a/scripts/cypress/integration/common/3d_rollup_column.js +++ b/scripts/cypress/integration/common/3d_rollup_column.js @@ -1,142 +1,140 @@ import { isTestSuiteActive } from "../../support/page_objects/projectConstants"; export const genTest = (apiType, dbType) => { - if (!isTestSuiteActive(apiType, dbType)) return; - - describe(`${apiType.toUpperCase()} api - RollUp column`, () => { - // to retrieve few v-input nodes from their label - // - const fetchParentFromLabel = (label) => { - cy.get("label").contains(label).parents(".v-input").click(); - }; - - // Run once before test- create project (rest/graphql) - // - before(() => { - // open a table to work on views - // - cy.openTableTab("Country", 25); + if (!isTestSuiteActive(apiType, dbType)) return; + + describe(`${apiType.toUpperCase()} api - RollUp column`, () => { + // to retrieve few v-input nodes from their label + // + const fetchParentFromLabel = (label) => { + cy.get("label").contains(label).parents(".v-input").click(); + }; + + // Run once before test- create project (rest/graphql) + // + before(() => { + // open a table to work on views + // + cy.openTableTab("Country", 25); + }); + + after(() => { + cy.closeTableTab("Country"); + }); + + // Routine to create a new look up column + // + const addLookUpColumn = ( + columnName, + childTable, + childCol, + aggregateFunc + ) => { + // (+) icon at end of column header (to add a new column) + // opens up a pop up window + // + cy.get(".new-column-header").click(); + + // Column name + cy.get(".nc-column-name-input input").clear().type(`${columnName}`); + + // Column data type: to be set to rollup in this context + // Type 'Rollup' ensures item outside view is also listed (note, rollup is at bottom of scroll list) + cy.get(".nc-ui-dt-dropdown").click().type("Rollup"); + cy.getActiveMenu().contains("Rollup").click({ force: true }); + + // Configure Child table & column names + fetchParentFromLabel("Child table"); + cy.getActiveMenu().contains(childTable).click(); + + fetchParentFromLabel("Child column"); + cy.getActiveMenu().contains(childCol).click(); + + fetchParentFromLabel("Aggregate function"); + cy.getActiveMenu().contains(aggregateFunc).click(); + + cy.snipActiveMenu("RollUp"); + + // click on Save + cy.get(".nc-col-create-or-edit-card").contains("Save").click(); + + // Verify if column exists. + // + cy.get(`th:contains(${columnName})`).should("exist"); + }; + + // routine to delete column + // + const deleteColumnByName = (columnName) => { + // verify if column exists before delete + cy.get(`th:contains(${columnName})`).should("exist"); + + // delete opiton visible on mouse-over + cy.get(`th:contains(${columnName}) .mdi-menu-down`) + .trigger("mouseover") + .click(); + + // delete/ confirm on pop-up + cy.get(".nc-column-delete").click(); + cy.getActiveModal().find("button:contains(Confirm)").click(); + + // validate if deleted (column shouldnt exist) + cy.get(`th:contains(${columnName})`).should("not.exist"); + }; + + // routine to edit column + // + const editColumnByName = (oldName, newName) => { + // verify if column exists before delete + cy.get(`th:contains(${oldName})`).should("exist"); + + // delete opiton visible on mouse-over + cy.get(`th:contains(${oldName}) .mdi-menu-down`) + .trigger("mouseover") + .click(); + + // edit/ save on pop-up + cy.get(".nc-column-edit").click(); + cy.get(".nc-column-name-input input").clear().type(newName); + cy.get(".nc-col-create-or-edit-card").contains("Save").click(); + + cy.toastWait("Successfully updated alias"); + + // validate if deleted (column shouldnt exist) + cy.get(`th:contains(${oldName})`).should("not.exist"); + cy.get(`th:contains(${newName})`).should("exist"); + }; + + /////////////////////////////////////////////////// + // Test case + + it("Add Rollup column (City, CityId, sum) & Delete", () => { + addLookUpColumn("RollUpCol_2", "City", "CityId", "sum"); + + // Verify first entry, will be displayed as alias here 'childColumn (from childTable)' + // intentionally verifying 4th item, as initial items are being masked out by list scroll down + // to be fixed + // + cy.get(`tbody > :nth-child(4) > [data-col="RollUpCol_2"]`) + .contains("427") + .should("exist"); + + editColumnByName("RollUpCol_2", "RollUpCol_New"); + deleteColumnByName("RollUpCol_New"); + }); + + it.skip("Add Rollup column (City, CountryId, count) & Delete", () => { + addLookUpColumn("RollUpCol_1", "City", "CountryId", "count"); + + // Verify first entry, will be displayed as alias here 'childColumn (from childTable)' + cy.get(`tbody > :nth-child(4) > [data-col="RollUpCol_1"]`) + .contains("2") + .should("exist"); + + editColumnByName("RollUpCol_1", "RollUpCol_New"); + deleteColumnByName("RollUpCol_New"); + }); }); - - after(() => { - cy.closeTableTab("Country"); - }); - - // Routine to create a new look up column - // - const addLookUpColumn = ( - columnName, - childTable, - childCol, - aggregateFunc - ) => { - // (+) icon at end of column header (to add a new column) - // opens up a pop up window - // - cy.get(".new-column-header").click(); - - // Column name - cy.get(".nc-column-name-input input") - .clear() - .type(`${columnName}`); - - // Column data type: to be set to rollup in this context - // Type 'Rollup' ensures item outside view is also listed (note, rollup is at bottom of scroll list) - cy.get(".nc-ui-dt-dropdown").click().type("Rollup"); - cy.getActiveMenu().contains("Rollup").click({ force: true }); - - // Configure Child table & column names - fetchParentFromLabel("Child table"); - cy.getActiveMenu().contains(childTable).click(); - - fetchParentFromLabel("Child column"); - cy.getActiveMenu().contains(childCol).click(); - - fetchParentFromLabel("Aggregate function"); - cy.getActiveMenu().contains(aggregateFunc).click(); - - cy.snipActiveMenu("RollUp"); - - // click on Save - cy.get(".nc-col-create-or-edit-card").contains("Save").click(); - - // Verify if column exists. - // - cy.get(`th:contains(${columnName})`).should("exist"); - }; - - // routine to delete column - // - const deleteColumnByName = (columnName) => { - // verify if column exists before delete - cy.get(`th:contains(${columnName})`).should("exist"); - - // delete opiton visible on mouse-over - cy.get(`th:contains(${columnName}) .mdi-menu-down`) - .trigger("mouseover") - .click(); - - // delete/ confirm on pop-up - cy.get(".nc-column-delete").click(); - cy.getActiveModal().find("button:contains(Confirm)").click(); - - // validate if deleted (column shouldnt exist) - cy.get(`th:contains(${columnName})`).should("not.exist"); - }; - - // routine to edit column - // - const editColumnByName = (oldName, newName) => { - // verify if column exists before delete - cy.get(`th:contains(${oldName})`).should("exist"); - - // delete opiton visible on mouse-over - cy.get(`th:contains(${oldName}) .mdi-menu-down`) - .trigger("mouseover") - .click(); - - // edit/ save on pop-up - cy.get(".nc-column-edit").click(); - cy.get(".nc-column-name-input input").clear().type(newName); - cy.get(".nc-col-create-or-edit-card").contains("Save").click(); - - cy.toastWait("Successfully updated alias"); - - // validate if deleted (column shouldnt exist) - cy.get(`th:contains(${oldName})`).should("not.exist"); - cy.get(`th:contains(${newName})`).should("exist"); - }; - - /////////////////////////////////////////////////// - // Test case - - it("Add Rollup column (City, CityId, sum) & Delete", () => { - addLookUpColumn("RollUpCol_2", "City", "CityId", "sum"); - - // Verify first entry, will be displayed as alias here 'childColumn (from childTable)' - // intentionally verifying 4th item, as initial items are being masked out by list scroll down - // to be fixed - // - cy.get(`tbody > :nth-child(4) > [data-col="RollUpCol_2"]`) - .contains("427") - .should("exist"); - - editColumnByName("RollUpCol_2", "RollUpCol_New"); - deleteColumnByName("RollUpCol_New"); - }); - - it.skip("Add Rollup column (City, CountryId, count) & Delete", () => { - addLookUpColumn("RollUpCol_1", "City", "CountryId", "count"); - - // Verify first entry, will be displayed as alias here 'childColumn (from childTable)' - cy.get(`tbody > :nth-child(4) > [data-col="RollUpCol_1"]`) - .contains("2") - .should("exist"); - - editColumnByName("RollUpCol_1", "RollUpCol_New"); - deleteColumnByName("RollUpCol_New"); - }); - }); }; /** diff --git a/scripts/cypress/integration/common/4b_table_view_share.js b/scripts/cypress/integration/common/4b_table_view_share.js index e69b7bbcf1..0a2a055b19 100644 --- a/scripts/cypress/integration/common/4b_table_view_share.js +++ b/scripts/cypress/integration/common/4b_table_view_share.js @@ -5,100 +5,105 @@ let storedURL = ""; let linkText = ""; const generateLinkWithPwd = () => { - // cy.get(".v-navigation-drawer__content > .container") - // .find(".v-list > .v-list-item") - // .contains("Share View") - // .click(); - mainPage.shareView().click(); - - cy.snipActiveModal("Modal_ShareView") - - // enable checkbox & feed pwd, save - cy.getActiveModal() - .find('[role="switch"][type="checkbox"]') - .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"); - - // copy link text, visit URL - cy.getActiveModal() - .find(".share-link-box") - .then(($obj) => { - linkText = $obj.text().trim(); - cy.log(linkText); - }); -}; - -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(() => { - cy.openTableTab("City", 25); + // cy.get(".v-navigation-drawer__content > .container") + // .find(".v-list > .v-list-item") + // .contains("Share View") + // .click(); + mainPage.shareView().click(); - // store base URL- to re-visit and delete form view later - cy.url().then((url) => { - storedURL = url; - }); + cy.snipActiveModal("Modal_ShareView"); - generateLinkWithPwd(); - }); - - beforeEach(() => { - cy.restoreLocalStorage(); - }); - - afterEach(() => { - cy.saveLocalStorage(); - }); + // enable checkbox & feed pwd, save + cy.getActiveModal() + .find('[role="switch"][type="checkbox"]') + .click({ force: true }); + cy.getActiveModal().find('input[type="password"]').type("1"); - it("Share view with incorrect password", () => { - cy.visit(linkText, { - baseUrl: null, - }); + cy.snipActiveModal("Modal_ShareView_Password"); - cy.getActiveModal().should("exist"); + cy.getActiveModal().find('button:contains("Save password")').click(); - // feed password - cy.getActiveModal().find('input[type="password"]').type("a"); - cy.getActiveModal().find('button:contains("Unlock")').click(); + cy.toastWait("Successfully updated"); - // 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"); - }); - - it("Delete view", () => { - cy.visit(storedURL, { - baseUrl: null, - }); - mainPage.deleteCreatedViews(); - }); + // copy link text, visit URL + cy.getActiveModal() + .find(".share-link-box") + .then(($obj) => { + linkText = $obj.text().trim(); + cy.log(linkText); + }); +}; - after(() => { - cy.closeTableTab("City"); +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(() => { + 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, + }); + + 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"); + }); + + it("Delete view", () => { + cy.visit(storedURL, { + baseUrl: null, + }); + mainPage.deleteCreatedViews(); + }); + + after(() => { + cy.closeTableTab("City"); + }); }); - }); }; // genTest('rest', false) diff --git a/scripts/cypress/integration/common/4c_form_view_detailed.js b/scripts/cypress/integration/common/4c_form_view_detailed.js index 2c8ed55119..dd0aee0fe5 100644 --- a/scripts/cypress/integration/common/4c_form_view_detailed.js +++ b/scripts/cypress/integration/common/4c_form_view_detailed.js @@ -4,434 +4,477 @@ import { mainPage } from "../../support/page_objects/mainPage"; let formViewURL; export const genTest = (apiType, dbType) => { - if (!isTestSuiteActive(apiType, dbType)) return; + if (!isTestSuiteActive(apiType, dbType)) return; - describe(`${apiType.toUpperCase()} api - FORM view`, () => { - const name = "Test" + Date.now(); + describe(`${apiType.toUpperCase()} api - FORM view`, () => { + const name = "Test" + Date.now(); - // Run once before test- create project (rest/graphql) - // - before(() => { - // open a table to work on views - // - cy.openTableTab("Country", 25); - }); - - beforeEach(() => { - cy.restoreLocalStorage(); - }); - - afterEach(() => { - cy.saveLocalStorage(); - }); + // Run once before test- create project (rest/graphql) + // + before(() => { + // open a table to work on views + // + cy.openTableTab("Country", 25); + }); - after(() => { - cy.closeTableTab("Country"); - }); + beforeEach(() => { + cy.restoreLocalStorage(); + }); - // Common routine to create/edit/delete GRID & GALLERY view - // Input: viewType - 'grid'/'gallery' - // - const viewTest = (viewType) => { - it(`Create ${viewType} view`, () => { - // click on 'Grid/Gallery' button on Views bar - cy.get(`.nc-create-${viewType}-view`).click(); - - // Pop up window, click Submit (accepting default name for view) - cy.getActiveModal().find("button:contains(Submit)").click(); - - cy.toastWait("View created successfully"); - - // validate if view was creted && contains default name 'Country1' - cy.get(`.nc-view-item.nc-${viewType}-view-item`) - .contains("Country1") - .should("exist"); - }); - - it(`Validate ${viewType} view: Drag & drop for re-order items`, () => { - // default order: Country, LastUpdate, Country => City - cy.get(".nc-field-wrapper").eq(0).contains("Country").should("exist"); - cy.get(".nc-field-wrapper") - .eq(1) - .contains("LastUpdate") - .should("exist"); - - // move Country field down (drag, drop) - cy.get("#data-table-form-Country").drag("#data-table-form-LastUpdate"); - - // Verify if order is: LastUpdate, Country, Country => City - cy.get(".nc-field-wrapper") - .eq(0) - .contains("LastUpdate") - .should("exist"); - cy.get(".nc-field-wrapper").eq(1).contains("Country").should("exist"); - }); - - it(`Validate ${viewType} view: Drag & drop for add/remove items`, () => { - // default, only one item in menu-bar; ensure LastUpdate field was present in form view - cy.get(".col-md-4").find(".pointer.item").should("not.exist"); - cy.get(".nc-field-wrapper") - .eq(0) - .contains("LastUpdate") - .should("exist"); - - // drag 'LastUpdate' & drop into menu bar drag-drop box - cy.get("#data-table-form-LastUpdate").drag(".nc-drag-n-drop-to-hide"); - - // validate- fields count in menu bar to be increased by 1 && - // first member in 'formView' is Country - cy.get(".nc-field-wrapper").eq(0).contains("Country").should("exist"); - cy.get(".col-md-4").find(".pointer.item").its("length").should("eq", 1); - }); - - it(`Validate ${viewType} view: Inverted order field member addition from menu`, () => { - cy.get(".col-md-4") - .find(".pointer.caption") - .contains("Remove all") - .click(); - - // click fields in inverted order: LastUpdate, Country => City - cy.get(".col-md-4").find(".pointer.item").eq(1).click(); - cy.get(".col-md-4").find(".pointer.item").eq(0).click(); - - // verify if order of appearance in form is right - // Country was never removed as its required field. Other two will appear in inverted order - cy.get(".nc-field-wrapper").eq(0).contains("Country").should("exist"); - cy.get(".nc-field-wrapper") - .eq(1) - .contains("Country => City") - .should("exist"); - cy.get(".nc-field-wrapper") - .eq(2) - .contains("LastUpdate") - .should("exist"); - }); - - it(`Validate ${viewType}: Form header & description validation`, () => { - // Header & description should exist - cy.get(".nc-form").find('[placeholder="Form Title"]').should("exist"); - cy.get(".nc-form") - .find('[placeholder="Add form description"]') - .should("exist"); - - // Update header & add some description, verify - cy.get(".nc-form").find('[placeholder="Form Title"]').type("A B C D"); - cy.get(".nc-form") - .find('[placeholder="Add form description"]') - .type("Some description about form comes here"); - - // validate new contents - cy.get(".nc-form") - .find('[placeholder="Form Title"]') - .contains("A B C D") - .should("exist"); - cy.get(".nc-form") - .find('[placeholder="Add form description"]') - .contains("Some description about form comes here") - .should("exist"); - }); - - it(`Validate ${viewType}: Add all, Remove all validation`, () => { - // .col-md-4 : left hand menu - // .nc-form : form view (right hand side) - - // ensure buttons exist on left hand menu - cy.get(".col-md-4") - .find(".pointer.caption") - .contains("Add all") - .should("not.exist"); - cy.get(".col-md-4") - .find(".pointer.caption") - .contains("Remove all") - .should("exist"); - - // click: remove-all - cy.get(".col-md-4") - .find(".pointer.caption") - .contains("Remove all") - .click(); - // form should not contain any "field remove icons" -- except for mandatory field (Country) - cy.get(".nc-form") - .find(".nc-field-remove-icon") - .its("length") - .should("eq", 1); - // menu bar should contain 3 .pointer.item (LastUpdate, County->City) - cy.get(".col-md-4").find(".pointer.item").its("length").should("eq", 2); - - // click: Add all - // cy.get('.col-md-4').find('.pointer.caption').contains('Remove all').should('not.exist') - cy.get(".col-md-4") - .find(".pointer.caption") - .contains("Add all") - .click(); - cy.get(".col-md-4") - .find(".pointer.caption") - .contains("Remove all") - .should("exist"); - // form should contain "field remove icons" - cy.get(".nc-form").find(".nc-field-remove-icon").should("exist"); - // Fix me: a dummy remove icon is left over on screen - cy.get(".nc-form") - .find(".nc-field-remove-icon") - .its("length") - .should("eq", 3); - // menu bar should not contain .pointer.item (column name/ field name add options) - cy.get(".col-md-4").find(".pointer.item").should("not.exist"); - }); - - it(`Validate ${viewType}: Submit default, empty show this message textbox`, () => { - // fill up mandatory fields - cy.get("#data-table-form-Country").type("_abc"); - cy.get("#data-table-form-LastUpdate").click(); - cy.getActiveModal().find("button").contains("19").click(); - cy.getActiveModal().find("button").contains("OK").click(); - - // default message, no update - - // submit button & validate - cy.get(".nc-form").find("button").contains("Submit").click(); - cy.toastWait("Saved successfully"); - cy.get(".v-alert") - .contains("Successfully submitted form data") - .should("exist"); - - // end of test removes newly added rows from table. that step validates if row was successfully added. - }); - - it(`Validate ${viewType}: Submit default, with valid Show message entry`, () => { - // clicking again on view name shows blank still. work around- toggling between two views - // cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country').click() - cy.get(`.nc-view-item.nc-${viewType}-view-item`) - .contains("Country1") - .click(); - - // fill up mandatory fields - cy.get("#data-table-form-Country").type("_abc"); - cy.get("#data-table-form-LastUpdate").click(); - cy.getActiveModal().find("button").contains("19").click(); - cy.getActiveModal().find("button").contains("OK").click(); - - // add message - cy.get(".nc-form > .mx-auto").find("textarea").type("Congratulations!"); - - // submit button & validate - cy.get(".nc-form").find("button").contains("Submit").click(); - cy.toastWait("Congratulations"); - cy.get(".v-alert").contains("Congratulations").should("exist"); - - // end of test removes newly added rows from table. that step validates if row was successfully added. - }); - - it(`Validate ${viewType}: Submit default, Enable checkbox "Submit another form`, () => { - // clicking again on view name shows blank still. work around- toggling between two views - // cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country').click() - cy.get(`.nc-view-item.nc-${viewType}-view-item`) - .contains("Country1") - .click(); - - // fill up mandatory fields - cy.get("#data-table-form-Country").type("_abc"); - cy.get("#data-table-form-LastUpdate").click(); - cy.getActiveModal().find("button").contains("19").click(); - cy.getActiveModal().find("button").contains("OK").click(); - - // enable "Submit another form" check box - cy.get(".nc-form > .mx-auto").find('[type="checkbox"]').eq(0).click(); - - // submit button & validate - cy.get(".nc-form").find("button").contains("Submit").click(); - cy.toastWait("Congratulations"); - cy.get(".v-alert").contains("Congratulations").should("exist"); - cy.get("button").contains("Submit Another Form").should("exist"); - - cy.get("button").contains("Submit Another Form").click(); - cy.get(".nc-form").should("exist"); - // New form appeared? Header & description should exist - cy.get(".nc-form") - .find('[placeholder="Form Title"]') - .contains("A B C D") - .should("exist"); - cy.get(".nc-form") - .find('[placeholder="Add form description"]') - .contains("Some description about form comes here") - .should("exist"); - - // end of test removes newly added rows from table. that step validates if row was successfully added. - }); - - it(`Validate ${viewType}: Submit default, Enable checkbox "blank form after 5 seconds"`, () => { - // cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country').click() - // cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country1').click() - - cy.get("#data-table-form-Country").type("_abc"); - cy.get("#data-table-form-LastUpdate").click(); - cy.getActiveModal().find("button").contains("19").click(); - cy.getActiveModal().find("button").contains("OK").click(); - - // enable "New form after 5 seconds" button - cy.get(".nc-form > .mx-auto") - .find('[type="checkbox"]') - .eq(0) - .click({ force: true }); - cy.get(".nc-form > .mx-auto").find('[type="checkbox"]').eq(1).click(); - - // submit button & validate - cy.get(".nc-form").find("button").contains("Submit").click(); - cy.toastWait("Congratulations"); - cy.get(".v-alert") - .contains("Congratulations") - .should("exist") - .then(() => { - // wait for 5 seconds - cy.get(".nc-form").should("exist"); - - // validate if form has appeared again - cy.get(".nc-form") - .find('[placeholder="Form Title"]') - .contains("A B C D") - .should("exist"); - cy.get(".nc-form") - .find('[placeholder="Add form description"]') - .contains("Some description about form comes here") - .should("exist"); - }); - - // end of test removes newly added rows from table. that step validates if row was successfully added. - }); - - it(`Validate ${viewType}: Email me verification, without SMTP configuration`, () => { - // open formview & enable "email me" option - cy.get(`.nc-view-item.nc-${viewType}-view-item`) - .contains("Country1") - .click(); - cy.get(".nc-form > .mx-auto") - .find('[type="checkbox"]') - .eq(2) - .click({ force: true }); - // validate if toaster pops up requesting to activate SMTP - cy.toastWait( - "Please activate SMTP plugin in App store for enabling email notification" - ); - }); - - it(`Validate ${viewType}: Email me verification, with SMTP configuration`, () => { - // activate SMTP, dummy profile - mainPage.navigationDraw(mainPage.APPSTORE).click(); - mainPage.configureSMTP("admin@ex.com", "smtp.ex.com", "8080", "TLS"); - - // open form view & enable "email me" option - cy.openTableTab("Country", 25); - - cy.get(`.nc-view-item.nc-${viewType}-view-item`) - .contains("Country1") - .click(); - cy.get(".nc-form > .mx-auto") - .find('[type="checkbox"]') - .eq(2) - .click({ force: true }); - // validate if toaster pops up informing installation of email notification - // cy.get('.toasted:visible', { timout: 6000 }) - // .contains('Successfully installed and email notification will use SMTP configuration') - // .should('exist') - // reset SMPT config's - mainPage.navigationDraw(mainPage.APPSTORE).click(); - mainPage.resetSMTP(); - cy.openTableTab("Country", 25); - }); - - it(`Validate ${viewType}: Add/ remove field verification"`, () => { - cy.get(`.nc-view-item.nc-${viewType}-view-item`) - .contains("Country1") - .click(); - - cy.get("#data-table-form-LastUpdate").should("exist"); - // remove "LastUpdate field" - cy.get(".nc-form").find(".nc-field-remove-icon").eq(1).click(); - cy.get("#data-table-form-lastUpdate").should("not.exist"); - cy.get(".col-md-4") - .find(".pointer.item") - .contains("LastUpdate") - .should("exist"); - - // add it back - cy.get(".col-md-4") - .find(".pointer.item") - .contains("LastUpdate") - .click(); - cy.get("#data-table-form-LastUpdate").should("exist"); - }); - - it(`Validate ${viewType}: URL verification`, () => { - cy.get(`.nc-view-item.nc-${viewType}-view-item`) - .contains("Country1") - .click(); - // verify URL & copy it for subsequent test - cy.url().should("contain", `&view=Country1`); - cy.url().then((url) => { - cy.log(url); - formViewURL = url; + afterEach(() => { + cy.saveLocalStorage(); }); - }); - it(`Validate ${viewType}: URL validation after re-access`, () => { - // visit URL - cy.log(formViewURL); - cy.visit(formViewURL, { - baseUrl: null, + after(() => { + cy.closeTableTab("Country"); }); - // New form appeared? Header & description should exist - cy.get(".nc-form", { timeout: 10000 }) - .find('[placeholder="Form Title"]') - .contains("A B C D") - .should("exist"); - cy.get(".nc-form", { timeout: 10000 }) - .find('[placeholder="Add form description"]') - .contains("Some description about form comes here") - .should("exist"); - }); - - it(`Delete ${viewType} view`, () => { - // number of view entries should be 2 before we delete - cy.get(".nc-view-item").its("length").should("eq", 2); - - // click on delete icon (becomes visible on hovering mouse) - cy.get(".nc-view-delete-icon").click({ force: true }); - cy.toastWait("View deleted successfully"); - - // confirm if the number of veiw entries is reduced by 1 - cy.get(".nc-view-item").its("length").should("eq", 1); - - // clean up newly added rows into Country table operations - // this auto verifies successfull addition of rows to table as well - mainPage.getPagination(5).click(); - cy.get(".nc-grid-row").should("have.length", 13); - mainPage - .getRow(10) - .find(".mdi-checkbox-blank-outline") - .click({ force: true }); - mainPage - .getRow(11) - .find(".mdi-checkbox-blank-outline") - .click({ force: true }); - mainPage - .getRow(12) - .find(".mdi-checkbox-blank-outline") - .click({ force: true }); - mainPage - .getRow(13) - .find(".mdi-checkbox-blank-outline") - .click({ force: true }); - - mainPage.getCell("Country", 10).rightclick(); - cy.getActiveMenu().contains("Delete Selected Row").click(); - // cy.toastWait('Deleted selected rows successfully') - }); - }; - - // below scenario's will be invoked twice, once for rest & then for graphql - viewTest("form"); - }); + // Common routine to create/edit/delete GRID & GALLERY view + // Input: viewType - 'grid'/'gallery' + // + const viewTest = (viewType) => { + it(`Create ${viewType} view`, () => { + // click on 'Grid/Gallery' button on Views bar + cy.get(`.nc-create-${viewType}-view`).click(); + + // Pop up window, click Submit (accepting default name for view) + cy.getActiveModal().find("button:contains(Submit)").click(); + + cy.toastWait("View created successfully"); + + // validate if view was creted && contains default name 'Country1' + cy.get(`.nc-view-item.nc-${viewType}-view-item`) + .contains("Country1") + .should("exist"); + }); + + it(`Validate ${viewType} view: Drag & drop for re-order items`, () => { + // default order: Country, LastUpdate, Country => City + cy.get(".nc-field-wrapper") + .eq(0) + .contains("Country") + .should("exist"); + cy.get(".nc-field-wrapper") + .eq(1) + .contains("LastUpdate") + .should("exist"); + + // move Country field down (drag, drop) + cy.get("#data-table-form-Country").drag( + "#data-table-form-LastUpdate" + ); + + // Verify if order is: LastUpdate, Country, Country => City + cy.get(".nc-field-wrapper") + .eq(0) + .contains("LastUpdate") + .should("exist"); + cy.get(".nc-field-wrapper") + .eq(1) + .contains("Country") + .should("exist"); + }); + + it(`Validate ${viewType} view: Drag & drop for add/remove items`, () => { + // default, only one item in menu-bar; ensure LastUpdate field was present in form view + cy.get(".col-md-4").find(".pointer.item").should("not.exist"); + cy.get(".nc-field-wrapper") + .eq(0) + .contains("LastUpdate") + .should("exist"); + + // drag 'LastUpdate' & drop into menu bar drag-drop box + cy.get("#data-table-form-LastUpdate").drag( + ".nc-drag-n-drop-to-hide" + ); + + // validate- fields count in menu bar to be increased by 1 && + // first member in 'formView' is Country + cy.get(".nc-field-wrapper") + .eq(0) + .contains("Country") + .should("exist"); + cy.get(".col-md-4") + .find(".pointer.item") + .its("length") + .should("eq", 1); + }); + + it(`Validate ${viewType} view: Inverted order field member addition from menu`, () => { + cy.get(".col-md-4") + .find(".pointer.caption") + .contains("Remove all") + .click(); + + // click fields in inverted order: LastUpdate, Country => City + cy.get(".col-md-4").find(".pointer.item").eq(1).click(); + cy.get(".col-md-4").find(".pointer.item").eq(0).click(); + + // verify if order of appearance in form is right + // Country was never removed as its required field. Other two will appear in inverted order + cy.get(".nc-field-wrapper") + .eq(0) + .contains("Country") + .should("exist"); + cy.get(".nc-field-wrapper") + .eq(1) + .contains("Country => City") + .should("exist"); + cy.get(".nc-field-wrapper") + .eq(2) + .contains("LastUpdate") + .should("exist"); + }); + + it(`Validate ${viewType}: Form header & description validation`, () => { + // Header & description should exist + cy.get(".nc-form") + .find('[placeholder="Form Title"]') + .should("exist"); + cy.get(".nc-form") + .find('[placeholder="Add form description"]') + .should("exist"); + + // Update header & add some description, verify + cy.get(".nc-form") + .find('[placeholder="Form Title"]') + .type("A B C D"); + cy.get(".nc-form") + .find('[placeholder="Add form description"]') + .type("Some description about form comes here"); + + // validate new contents + cy.get(".nc-form") + .find('[placeholder="Form Title"]') + .contains("A B C D") + .should("exist"); + cy.get(".nc-form") + .find('[placeholder="Add form description"]') + .contains("Some description about form comes here") + .should("exist"); + }); + + it(`Validate ${viewType}: Add all, Remove all validation`, () => { + // .col-md-4 : left hand menu + // .nc-form : form view (right hand side) + + // ensure buttons exist on left hand menu + cy.get(".col-md-4") + .find(".pointer.caption") + .contains("Add all") + .should("not.exist"); + cy.get(".col-md-4") + .find(".pointer.caption") + .contains("Remove all") + .should("exist"); + + // click: remove-all + cy.get(".col-md-4") + .find(".pointer.caption") + .contains("Remove all") + .click(); + // form should not contain any "field remove icons" -- except for mandatory field (Country) + cy.get(".nc-form") + .find(".nc-field-remove-icon") + .its("length") + .should("eq", 1); + // menu bar should contain 3 .pointer.item (LastUpdate, County->City) + cy.get(".col-md-4") + .find(".pointer.item") + .its("length") + .should("eq", 2); + + // click: Add all + // cy.get('.col-md-4').find('.pointer.caption').contains('Remove all').should('not.exist') + cy.get(".col-md-4") + .find(".pointer.caption") + .contains("Add all") + .click(); + cy.get(".col-md-4") + .find(".pointer.caption") + .contains("Remove all") + .should("exist"); + // form should contain "field remove icons" + cy.get(".nc-form") + .find(".nc-field-remove-icon") + .should("exist"); + // Fix me: a dummy remove icon is left over on screen + cy.get(".nc-form") + .find(".nc-field-remove-icon") + .its("length") + .should("eq", 3); + // menu bar should not contain .pointer.item (column name/ field name add options) + cy.get(".col-md-4").find(".pointer.item").should("not.exist"); + }); + + it(`Validate ${viewType}: Submit default, empty show this message textbox`, () => { + // fill up mandatory fields + cy.get("#data-table-form-Country").type("_abc"); + cy.get("#data-table-form-LastUpdate").click(); + cy.getActiveModal().find("button").contains("19").click(); + cy.getActiveModal().find("button").contains("OK").click(); + + // default message, no update + + // submit button & validate + cy.get(".nc-form").find("button").contains("Submit").click(); + cy.toastWait("Saved successfully"); + cy.get(".v-alert") + .contains("Successfully submitted form data") + .should("exist"); + + // end of test removes newly added rows from table. that step validates if row was successfully added. + }); + + it(`Validate ${viewType}: Submit default, with valid Show message entry`, () => { + // clicking again on view name shows blank still. work around- toggling between two views + // cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country').click() + cy.get(`.nc-view-item.nc-${viewType}-view-item`) + .contains("Country1") + .click(); + + // fill up mandatory fields + cy.get("#data-table-form-Country").type("_abc"); + cy.get("#data-table-form-LastUpdate").click(); + cy.getActiveModal().find("button").contains("19").click(); + cy.getActiveModal().find("button").contains("OK").click(); + + // add message + cy.get(".nc-form > .mx-auto") + .find("textarea") + .type("Congratulations!"); + + // submit button & validate + cy.get(".nc-form").find("button").contains("Submit").click(); + cy.toastWait("Congratulations"); + cy.get(".v-alert").contains("Congratulations").should("exist"); + + // end of test removes newly added rows from table. that step validates if row was successfully added. + }); + + it(`Validate ${viewType}: Submit default, Enable checkbox "Submit another form`, () => { + // clicking again on view name shows blank still. work around- toggling between two views + // cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country').click() + cy.get(`.nc-view-item.nc-${viewType}-view-item`) + .contains("Country1") + .click(); + + // fill up mandatory fields + cy.get("#data-table-form-Country").type("_abc"); + cy.get("#data-table-form-LastUpdate").click(); + cy.getActiveModal().find("button").contains("19").click(); + cy.getActiveModal().find("button").contains("OK").click(); + + // enable "Submit another form" check box + cy.get(".nc-form > .mx-auto") + .find('[type="checkbox"]') + .eq(0) + .click(); + + // submit button & validate + cy.get(".nc-form").find("button").contains("Submit").click(); + cy.toastWait("Congratulations"); + cy.get(".v-alert").contains("Congratulations").should("exist"); + cy.get("button") + .contains("Submit Another Form") + .should("exist"); + + cy.get("button").contains("Submit Another Form").click(); + cy.get(".nc-form").should("exist"); + // New form appeared? Header & description should exist + cy.get(".nc-form") + .find('[placeholder="Form Title"]') + .contains("A B C D") + .should("exist"); + cy.get(".nc-form") + .find('[placeholder="Add form description"]') + .contains("Some description about form comes here") + .should("exist"); + + // end of test removes newly added rows from table. that step validates if row was successfully added. + }); + + it(`Validate ${viewType}: Submit default, Enable checkbox "blank form after 5 seconds"`, () => { + // cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country').click() + // cy.get(`.nc-view-item.nc-${viewType}-view-item`).contains('Country1').click() + + cy.get("#data-table-form-Country").type("_abc"); + cy.get("#data-table-form-LastUpdate").click(); + cy.getActiveModal().find("button").contains("19").click(); + cy.getActiveModal().find("button").contains("OK").click(); + + // enable "New form after 5 seconds" button + cy.get(".nc-form > .mx-auto") + .find('[type="checkbox"]') + .eq(0) + .click({ force: true }); + cy.get(".nc-form > .mx-auto") + .find('[type="checkbox"]') + .eq(1) + .click(); + + // submit button & validate + cy.get(".nc-form").find("button").contains("Submit").click(); + cy.toastWait("Congratulations"); + cy.get(".v-alert") + .contains("Congratulations") + .should("exist") + .then(() => { + // wait for 5 seconds + cy.get(".nc-form").should("exist"); + + // validate if form has appeared again + cy.get(".nc-form") + .find('[placeholder="Form Title"]') + .contains("A B C D") + .should("exist"); + cy.get(".nc-form") + .find('[placeholder="Add form description"]') + .contains("Some description about form comes here") + .should("exist"); + }); + + // end of test removes newly added rows from table. that step validates if row was successfully added. + }); + + it(`Validate ${viewType}: Email me verification, without SMTP configuration`, () => { + // open formview & enable "email me" option + cy.get(`.nc-view-item.nc-${viewType}-view-item`) + .contains("Country1") + .click(); + cy.get(".nc-form > .mx-auto") + .find('[type="checkbox"]') + .eq(2) + .click({ force: true }); + // validate if toaster pops up requesting to activate SMTP + cy.toastWait( + "Please activate SMTP plugin in App store for enabling email notification" + ); + }); + + it(`Validate ${viewType}: Email me verification, with SMTP configuration`, () => { + // activate SMTP, dummy profile + mainPage.navigationDraw(mainPage.APPSTORE).click(); + mainPage.configureSMTP( + "admin@ex.com", + "smtp.ex.com", + "8080", + "TLS" + ); + + // open form view & enable "email me" option + cy.openTableTab("Country", 25); + + cy.get(`.nc-view-item.nc-${viewType}-view-item`) + .contains("Country1") + .click(); + cy.get(".nc-form > .mx-auto") + .find('[type="checkbox"]') + .eq(2) + .click({ force: true }); + // validate if toaster pops up informing installation of email notification + // cy.get('.toasted:visible', { timout: 6000 }) + // .contains('Successfully installed and email notification will use SMTP configuration') + // .should('exist') + // reset SMPT config's + mainPage.navigationDraw(mainPage.APPSTORE).click(); + mainPage.resetSMTP(); + cy.openTableTab("Country", 25); + }); + + it(`Validate ${viewType}: Add/ remove field verification"`, () => { + cy.get(`.nc-view-item.nc-${viewType}-view-item`) + .contains("Country1") + .click(); + + cy.get("#data-table-form-LastUpdate").should("exist"); + // remove "LastUpdate field" + cy.get(".nc-form").find(".nc-field-remove-icon").eq(1).click(); + cy.get("#data-table-form-lastUpdate").should("not.exist"); + cy.get(".col-md-4") + .find(".pointer.item") + .contains("LastUpdate") + .should("exist"); + + // add it back + cy.get(".col-md-4") + .find(".pointer.item") + .contains("LastUpdate") + .click(); + cy.get("#data-table-form-LastUpdate").should("exist"); + }); + + it(`Validate ${viewType}: URL verification`, () => { + cy.get(`.nc-view-item.nc-${viewType}-view-item`) + .contains("Country1") + .click(); + // verify URL & copy it for subsequent test + cy.url().should("contain", `&view=Country1`); + cy.url().then((url) => { + cy.log(url); + formViewURL = url; + }); + }); + + it(`Validate ${viewType}: URL validation after re-access`, () => { + // visit URL + cy.log(formViewURL); + cy.visit(formViewURL, { + baseUrl: null, + }); + + // New form appeared? Header & description should exist + cy.get(".nc-form", { timeout: 10000 }) + .find('[placeholder="Form Title"]') + .contains("A B C D") + .should("exist"); + cy.get(".nc-form", { timeout: 10000 }) + .find('[placeholder="Add form description"]') + .contains("Some description about form comes here") + .should("exist"); + }); + + it(`Delete ${viewType} view`, () => { + // number of view entries should be 2 before we delete + cy.get(".nc-view-item").its("length").should("eq", 2); + + // click on delete icon (becomes visible on hovering mouse) + cy.get(".nc-view-delete-icon").click({ force: true }); + cy.toastWait("View deleted successfully"); + + // confirm if the number of veiw entries is reduced by 1 + cy.get(".nc-view-item").its("length").should("eq", 1); + + // clean up newly added rows into Country table operations + // this auto verifies successfull addition of rows to table as well + mainPage.getPagination(5).click(); + cy.get(".nc-grid-row").should("have.length", 13); + mainPage + .getRow(10) + .find(".mdi-checkbox-blank-outline") + .click({ force: true }); + mainPage + .getRow(11) + .find(".mdi-checkbox-blank-outline") + .click({ force: true }); + mainPage + .getRow(12) + .find(".mdi-checkbox-blank-outline") + .click({ force: true }); + mainPage + .getRow(13) + .find(".mdi-checkbox-blank-outline") + .click({ force: true }); + + mainPage.getCell("Country", 10).rightclick(); + cy.getActiveMenu().contains("Delete Selected Row").click(); + // cy.toastWait('Deleted selected rows successfully') + }); + }; + + // below scenario's will be invoked twice, once for rest & then for graphql + viewTest("form"); + }); }; /** diff --git a/scripts/cypress/integration/common/4d_table_view_grid_locked.js b/scripts/cypress/integration/common/4d_table_view_grid_locked.js index ccd14a3d2e..9d41031205 100644 --- a/scripts/cypress/integration/common/4d_table_view_grid_locked.js +++ b/scripts/cypress/integration/common/4d_table_view_grid_locked.js @@ -2,92 +2,104 @@ import { isTestSuiteActive } from "../../support/page_objects/projectConstants"; import { mainPage } from "../../support/page_objects/mainPage"; export const genTest = (apiType, dbType) => { - if (!isTestSuiteActive(apiType, dbType)) return; + if (!isTestSuiteActive(apiType, dbType)) return; - describe(`${apiType.toUpperCase()} api - Lock view`, () => { - // Run once before test- create project (rest/graphql) - // - before(() => { - // open a table to work on views - // - cy.openTableTab("Country", 25); - }); + describe(`${apiType.toUpperCase()} api - Lock view`, () => { + // Run once before test- create project (rest/graphql) + // + before(() => { + // open a table to work on views + // + cy.openTableTab("Country", 25); + }); - after(() => { - cy.closeTableTab("Country"); - }); + after(() => { + cy.closeTableTab("Country"); + }); - const lockViewTest = (enabled) => { - it(`Grid: lock view set to ${enabled}: validation`, () => { - let vString = enabled ? "not." : ""; - let menuOption = enabled ? 1 : 0; + const lockViewTest = (enabled) => { + it(`Grid: lock view set to ${enabled}: validation`, () => { + let vString = enabled ? "not." : ""; + let menuOption = enabled ? 1 : 0; - // on menu, collaboration view appears first (at index 0) - // followed by Locked view (at index 1) - cy.get(".xc-toolbar").find(".nc-view-lock-menu:enabled").click(); - cy.snipActiveMenu("Menu_Collaboration") - cy.getActiveMenu().find('[role="menuitem"]').eq(menuOption).click(); + // on menu, collaboration view appears first (at index 0) + // followed by Locked view (at index 1) + cy.get(".xc-toolbar") + .find(".nc-view-lock-menu:enabled") + .click(); + cy.snipActiveMenu("Menu_Collaboration"); + cy.getActiveMenu() + .find('[role="menuitem"]') + .eq(menuOption) + .click(); - // expected toolbar for Lock view: Only lock-view menu, reload, toggle-nav-drawer to be enabled - // - cy.get(".xc-toolbar") - .find(".nc-view-lock-menu:enabled") - .should("exist"); - cy.get(".xc-toolbar") - .find(".nc-table-reload-btn:enabled") - .should("exist"); - cy.get(".xc-toolbar") - .find(".nc-add-new-row-btn:enabled") - .should(`${vString}exist`); - // cy.get('.xc-toolbar').find('.nc-save-new-row-btn:disabled') .should('exist') - cy.get(".xc-toolbar") - .find(".nc-fields-menu-btn:enabled") - .should(`${vString}exist`); - cy.get(".xc-toolbar") - .find(".nc-sort-menu-btn:enabled") - .should(`${vString}exist`); - cy.get(".xc-toolbar") - .find(".nc-filter-menu-btn:enabled") - .should(`${vString}exist`); - cy.get(".xc-toolbar") - .find(".nc-table-delete-btn:enabled") - .should(`${vString}exist`); - cy.get(".xc-toolbar") - .find(".nc-toggle-nav-drawer:enabled") - .should("exist"); + // expected toolbar for Lock view: Only lock-view menu, reload, toggle-nav-drawer to be enabled + // + cy.get(".xc-toolbar") + .find(".nc-view-lock-menu:enabled") + .should("exist"); + cy.get(".xc-toolbar") + .find(".nc-table-reload-btn:enabled") + .should("exist"); + cy.get(".xc-toolbar") + .find(".nc-add-new-row-btn:enabled") + .should(`${vString}exist`); + // cy.get('.xc-toolbar').find('.nc-save-new-row-btn:disabled') .should('exist') + cy.get(".xc-toolbar") + .find(".nc-fields-menu-btn:enabled") + .should(`${vString}exist`); + cy.get(".xc-toolbar") + .find(".nc-sort-menu-btn:enabled") + .should(`${vString}exist`); + cy.get(".xc-toolbar") + .find(".nc-filter-menu-btn:enabled") + .should(`${vString}exist`); + cy.get(".xc-toolbar") + .find(".nc-table-delete-btn:enabled") + .should(`${vString}exist`); + cy.get(".xc-toolbar") + .find(".nc-toggle-nav-drawer:enabled") + .should("exist"); - // dblClick on a cell & see if we can edit - mainPage.getCell("Country", 1).dblclick(); - mainPage.getCell("Country", 1).find("input").should(`${vString}exist`); + // dblClick on a cell & see if we can edit + mainPage.getCell("Country", 1).dblclick(); + mainPage + .getCell("Country", 1) + .find("input") + .should(`${vString}exist`); - // check if expand row option is available? - cy.get("td").find(".nc-row-expand-icon").should(`${vString}exist`); - // alt validation: mainPage.getRow(1).find('.nc-row-expand-icon').should(`${vString}exist`) + // check if expand row option is available? + cy.get("td") + .find(".nc-row-expand-icon") + .should(`${vString}exist`); + // alt validation: mainPage.getRow(1).find('.nc-row-expand-icon').should(`${vString}exist`) - // check if add/ expand options available for 'has many' column type - mainPage - .getCell("Country => City", 1) - .click() - .find("button.mdi-plus") - .should(`${vString}exist`); - mainPage - .getCell("Country => City", 1) - .click() - .find("button.mdi-arrow-expand") - .should(`${vString}exist`); + // check if add/ expand options available for 'has many' column type + mainPage + .getCell("Country => City", 1) + .click() + .find("button.mdi-plus") + .should(`${vString}exist`); + mainPage + .getCell("Country => City", 1) + .click() + .find("button.mdi-arrow-expand") + .should(`${vString}exist`); - // update row option (right click) - should not be available for Lock view - mainPage.getCell("Country => City", 1).rightclick(); - cy.get(".menuable__content__active").should(`${vString}be.visible`); - }); - }; + // update row option (right click) - should not be available for Lock view + mainPage.getCell("Country => City", 1).rightclick(); + cy.get(".menuable__content__active").should( + `${vString}be.visible` + ); + }); + }; - // Locked view - lockViewTest(true); + // Locked view + lockViewTest(true); - // collaboration view - lockViewTest(false); - }); + // collaboration view + lockViewTest(false); + }); }; /** diff --git a/scripts/cypress/integration/common/6f_attachments.js b/scripts/cypress/integration/common/6f_attachments.js index 9fc8e48285..03b9f9ee69 100644 --- a/scripts/cypress/integration/common/6f_attachments.js +++ b/scripts/cypress/integration/common/6f_attachments.js @@ -3,122 +3,134 @@ import { loginPage } from "../../support/page_objects/navigation"; 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()} Columns of type attachment`, () => { - before(() => { - loginPage.loginAndOpenProject(apiType, dbType); - cy.openTableTab("Country", 25); - }); + describe(`${apiType.toUpperCase()} Columns of type attachment`, () => { + before(() => { + loginPage.loginAndOpenProject(apiType, dbType); + cy.openTableTab("Country", 25); + }); - after(() => { - mainPage.deleteColumn("testAttach"); + after(() => { + mainPage.deleteColumn("testAttach"); - // clean up newly added rows into Country table operations - // this auto verifies successfull addition of rows to table as well - mainPage.getPagination(5).click(); - // wait for page rendering to complete - cy.get(".nc-grid-row").should("have.length", 10); - mainPage - .getRow(10) - .find(".mdi-checkbox-blank-outline") - .click({ force: true }); + // clean up newly added rows into Country table operations + // this auto verifies successfull addition of rows to table as well + mainPage.getPagination(5).click(); + // wait for page rendering to complete + cy.get(".nc-grid-row").should("have.length", 10); + mainPage + .getRow(10) + .find(".mdi-checkbox-blank-outline") + .click({ force: true }); - mainPage.getCell("Country", 10).rightclick(); - cy.getActiveMenu().contains("Delete Selected Row").click(); + mainPage.getCell("Country", 10).rightclick(); + cy.getActiveMenu().contains("Delete Selected Row").click(); - cy.closeTableTab("Country"); - }); + cy.closeTableTab("Country"); + }); - it(`Add column of type attachments`, () => { - mainPage.addColumnWithType("testAttach", "Attachment", "Country"); - - for (let i = 1; i <= 2; i++) { - let filepath = `sampleFiles/${i}.json`; - mainPage - .getCell("testAttach", i) - .click() - .find('input[type="file"]') - .attachFile(filepath); - mainPage.getCell("testAttach", i).find(".mdi-file").should("exist"); - } - }); + it(`Add column of type attachments`, () => { + mainPage.addColumnWithType("testAttach", "Attachment", "Country"); + + for (let i = 1; i <= 2; i++) { + let filepath = `sampleFiles/${i}.json`; + mainPage + .getCell("testAttach", i) + .click() + .find('input[type="file"]') + .attachFile(filepath); + mainPage + .getCell("testAttach", i) + .find(".mdi-file") + .should("exist"); + } + }); - it(`Form view with Attachment field- Submit & verify`, () => { - // create form-view - cy.get(`.nc-create-form-view`).click(); - cy.getActiveModal().find("button:contains(Submit)").click(); - - cy.toastWait("View created successfully"); - - cy.get(`.nc-view-item.nc-form-view-item`).contains("Country1").click(); - - // cy.get(".v-navigation-drawer__content > .container") - // .should("exist") - // .find(".v-list > .v-list-item") - // .contains("Share View") - // .click(); - mainPage.shareView().click(); - - // copy link text, visit URL - cy.getActiveModal() - .find(".share-link-box") - .contains("/nc/form/", { timeout: 10000 }) - .then(($obj) => { - let linkText = $obj.text().trim(); - cy.log(linkText); - cy.visit(linkText, { - baseUrl: null, - }); - - // wait for share view page to load! - - cy.get("#data-table-form-Country").should("exist").type("_abc"); - cy.get("#data-table-form-LastUpdate").click(); - cy.getActiveModal().find("button").contains("19").click(); - cy.getActiveModal().find("button").contains("OK").click(); - - cy.get(".nc-field-editables") - .last() - .find('input[type="file"]') - .attachFile(`sampleFiles/1.json`); - - // submit button & validate - cy.get(".nc-form").find("button").contains("Submit").click(); - cy.toastWait("Saved successfully"); + it(`Form view with Attachment field- Submit & verify`, () => { + // create form-view + cy.get(`.nc-create-form-view`).click(); + cy.getActiveModal().find("button:contains(Submit)").click(); + + cy.toastWait("View created successfully"); + + cy.get(`.nc-view-item.nc-form-view-item`) + .contains("Country1") + .click(); + + // cy.get(".v-navigation-drawer__content > .container") + // .should("exist") + // .find(".v-list > .v-list-item") + // .contains("Share View") + // .click(); + mainPage.shareView().click(); + + // copy link text, visit URL + cy.getActiveModal() + .find(".share-link-box") + .contains("/nc/form/", { timeout: 10000 }) + .then(($obj) => { + let linkText = $obj.text().trim(); + cy.log(linkText); + cy.visit(linkText, { + baseUrl: null, + }); + + // wait for share view page to load! + + cy.get("#data-table-form-Country") + .should("exist") + .type("_abc"); + cy.get("#data-table-form-LastUpdate").click(); + cy.getActiveModal().find("button").contains("19").click(); + cy.getActiveModal().find("button").contains("OK").click(); + + cy.get(".nc-field-editables") + .last() + .find('input[type="file"]') + .attachFile(`sampleFiles/1.json`); + + // submit button & validate + cy.get(".nc-form") + .find("button") + .contains("Submit") + .click(); + cy.toastWait("Saved successfully"); + }); }); - }); - it(`Filter column which contain only attachments, download CSV`, () => { - // come back to main window - loginPage.loginAndOpenProject(apiType, dbType); - cy.openTableTab("Country", 25); - - mainPage.filterField("testAttach", "is not null", null); - mainPage.hideField("LastUpdate"); - - const verifyCsv = (retrievedRecords) => { - let storedRecords = [ - `Country,Country => City,testAttach`, - `Afghanistan,Kabul,1.json(http://localhost:8080/dl/externalrest_5agd/db/country/testAttach_VWk3fz_1.json)`, - ]; - - expect(retrievedRecords[0]).to.be.equal(storedRecords[0]); - for (let i = 1; i < storedRecords.length; i++) { - const columns = retrievedRecords[i].split(","); - expect(columns[2]).to.contain(".json(http://localhost:8080/dl/"); - } - - cy.log(retrievedRecords[109]); - cy.log(retrievedRecords[110]); - cy.log(retrievedRecords[111]); - }; - - mainPage.downloadAndVerifyCsv(`Country_exported_1.csv`, verifyCsv); - mainPage.unhideField("LastUpdate"); - mainPage.filterReset(); + it(`Filter column which contain only attachments, download CSV`, () => { + // come back to main window + loginPage.loginAndOpenProject(apiType, dbType); + cy.openTableTab("Country", 25); + + mainPage.filterField("testAttach", "is not null", null); + mainPage.hideField("LastUpdate"); + + const verifyCsv = (retrievedRecords) => { + let storedRecords = [ + `Country,Country => City,testAttach`, + `Afghanistan,Kabul,1.json(http://localhost:8080/dl/externalrest_5agd/db/country/testAttach_VWk3fz_1.json)`, + ]; + + expect(retrievedRecords[0]).to.be.equal(storedRecords[0]); + for (let i = 1; i < storedRecords.length; i++) { + const columns = retrievedRecords[i].split(","); + expect(columns[2]).to.contain( + ".json(http://localhost:8080/dl/" + ); + } + + cy.log(retrievedRecords[109]); + cy.log(retrievedRecords[110]); + cy.log(retrievedRecords[111]); + }; + + mainPage.downloadAndVerifyCsv(`Country_exported_1.csv`, verifyCsv); + mainPage.unhideField("LastUpdate"); + mainPage.filterReset(); + }); }); - }); }; /** diff --git a/scripts/cypress/integration/spec/roleValidation.spec.js b/scripts/cypress/integration/spec/roleValidation.spec.js index 696243c714..449f2d48aa 100644 --- a/scripts/cypress/integration/spec/roleValidation.spec.js +++ b/scripts/cypress/integration/spec/roleValidation.spec.js @@ -7,115 +7,129 @@ import { roles } from "../../support/page_objects/projectConstants"; // 3. Preview mode menu // export function _advSettings(roleType, previewMode) { - let validationString = - true == roles[roleType].validations.advSettings ? "exist" : "not.exist"; - - // audit/advance settings menu visible only for owner/ creator - mainPage.navigationDraw(mainPage.AUDIT).should(validationString); - mainPage.navigationDraw(mainPage.APPSTORE).should(validationString); - mainPage.navigationDraw(mainPage.TEAM_N_AUTH).should(validationString); - mainPage.navigationDraw(mainPage.PROJ_METADATA).should(validationString); - - // option to add new user conditionally visible only to owner/ creator - cy.get('button:contains("New User")').should(validationString); - - if (true == previewMode) { - // preview mode, role toggle menubar is visible - mainPage.navigationDraw(mainPage.ROLE_VIEW_EDITOR).should("exist"); - mainPage.navigationDraw(mainPage.ROLE_VIEW_COMMENTER).should("exist"); - mainPage.navigationDraw(mainPage.ROLE_VIEW_VIEWER).should("exist"); - mainPage.navigationDraw(mainPage.ROLE_VIEW_RESET).should("exist"); - } else { - // normal mode, role toggle menubar is visible only for owner/ creator - mainPage.navigationDraw(mainPage.ROLE_VIEW_EDITOR).should(validationString); - mainPage - .navigationDraw(mainPage.ROLE_VIEW_COMMENTER) - .should(validationString); - mainPage.navigationDraw(mainPage.ROLE_VIEW_VIEWER).should(validationString); - } + let validationString = + true == roles[roleType].validations.advSettings ? "exist" : "not.exist"; + + // audit/advance settings menu visible only for owner/ creator + mainPage.navigationDraw(mainPage.AUDIT).should(validationString); + mainPage.navigationDraw(mainPage.APPSTORE).should(validationString); + mainPage.navigationDraw(mainPage.TEAM_N_AUTH).should(validationString); + mainPage.navigationDraw(mainPage.PROJ_METADATA).should(validationString); + + // option to add new user conditionally visible only to owner/ creator + cy.get('button:contains("New User")').should(validationString); + + if (true == previewMode) { + // preview mode, role toggle menubar is visible + mainPage.navigationDraw(mainPage.ROLE_VIEW_EDITOR).should("exist"); + mainPage.navigationDraw(mainPage.ROLE_VIEW_COMMENTER).should("exist"); + mainPage.navigationDraw(mainPage.ROLE_VIEW_VIEWER).should("exist"); + mainPage.navigationDraw(mainPage.ROLE_VIEW_RESET).should("exist"); + } else { + // normal mode, role toggle menubar is visible only for owner/ creator + mainPage + .navigationDraw(mainPage.ROLE_VIEW_EDITOR) + .should(validationString); + mainPage + .navigationDraw(mainPage.ROLE_VIEW_COMMENTER) + .should(validationString); + mainPage + .navigationDraw(mainPage.ROLE_VIEW_VIEWER) + .should(validationString); + } } export function _editSchema(roleType, previewMode) { - let columnName = "City"; - let validationString = - true == roles[roleType].validations.editSchema ? "exist" : "not.exist"; + let columnName = "City"; + let validationString = + true == roles[roleType].validations.editSchema ? "exist" : "not.exist"; - if (false == previewMode) { - cy.openTableTab(columnName, 25); - } - - // create table options - // - cy.get(".add-btn").should(validationString); - cy.get(".v-tabs-bar") - .eq(0) - .find("button.mdi-plus-box") - .should(validationString); - - // delete table option - // - cy.get(".nc-table-delete-btn").should(validationString); - - // add new column option - // - cy.get(".new-column-header").should(validationString); - - // update column (edit/ delete menu) - // - cy.get(`th:contains(${columnName}) .mdi-menu-down`).should(validationString); -} + if (false == previewMode) { + cy.openTableTab(columnName, 25); + } -export function _editData(roleType, previewMode) { - let columnName = "City"; - let validationString = - true == roles[roleType].validations.editData ? "exist" : "not.exist"; + // create table options + // + cy.get(".add-btn").should(validationString); + cy.get(".v-tabs-bar") + .eq(0) + .find("button.mdi-plus-box") + .should(validationString); - cy.openTableTab(columnName, 25); + // delete table option + // + cy.get(".nc-table-delete-btn").should(validationString); - // add new row option (from menu header) - // - cy.get(".nc-add-new-row-btn").should(validationString); + // add new column option + // + cy.get(".new-column-header").should(validationString); - // update row option (right click) - // - cy.get(`tbody > :nth-child(4) > [data-col="City"]`).rightclick(); - cy.get(".menuable__content__active").should(validationString); + // update column (edit/ delete menu) + // + cy.get(`th:contains(${columnName}) .mdi-menu-down`).should( + validationString + ); +} - if (validationString == "exist") { - // right click options will exist (only for 'exist' case) +export function _editData(roleType, previewMode) { + let columnName = "City"; + let validationString = + true == roles[roleType].validations.editData ? "exist" : "not.exist"; + + cy.openTableTab(columnName, 25); + + // add new row option (from menu header) // - cy.getActiveMenu().contains("Insert New Row").should(validationString); - cy.getActiveMenu().contains("Delete Row").should(validationString); - cy.getActiveMenu() - .contains("Delete Selected Rows") - .should(validationString); - cy.get("body").type("{esc}"); + cy.get(".nc-add-new-row-btn").should(validationString); - // update cell contents option using row expander should be enabled + // update row option (right click) // - //cy.get('.nc-row-expand-icon').eq(4).click({ force: true }) - cy.get(".v-input.row-checkbox").eq(4).next().next().click({ force: true }); - cy.getActiveModal().find("button").contains("Save row").should("exist"); - cy.get("body").type("{esc}"); - } else { - // update cell contents option using row expander should be disabled + cy.get(`tbody > :nth-child(4) > [data-col="City"]`).rightclick(); + cy.get(".menuable__content__active").should(validationString); + + if (validationString == "exist") { + // right click options will exist (only for 'exist' case) + // + cy.getActiveMenu().contains("Insert New Row").should(validationString); + cy.getActiveMenu().contains("Delete Row").should(validationString); + cy.getActiveMenu() + .contains("Delete Selected Rows") + .should(validationString); + cy.get("body").type("{esc}"); + + // update cell contents option using row expander should be enabled + // + //cy.get('.nc-row-expand-icon').eq(4).click({ force: true }) + cy.get(".v-input.row-checkbox") + .eq(4) + .next() + .next() + .click({ force: true }); + cy.getActiveModal().find("button").contains("Save row").should("exist"); + cy.get("body").type("{esc}"); + } else { + // update cell contents option using row expander should be disabled + // + //cy.get('.nc-row-expand-icon').eq(4).click({ force: true }) + cy.get(".v-input.row-checkbox") + .eq(4) + .next() + .next() + .click({ force: true }); + cy.getActiveModal() + .find("button:disabled") + .contains("Save row") + .should("exist"); + cy.getActiveModal().find("button").contains("Cancel").click(); + cy.get("body").type("{esc}"); + } + + // double click cell entries to edit // - //cy.get('.nc-row-expand-icon').eq(4).click({ force: true }) - cy.get(".v-input.row-checkbox").eq(4).next().next().click({ force: true }); - cy.getActiveModal() - .find("button:disabled") - .contains("Save row") - .should("exist"); - cy.getActiveModal().find("button").contains("Cancel").click(); - cy.get("body").type("{esc}"); - } - - // double click cell entries to edit - // - cy.get(`tbody > :nth-child(4) > [data-col="City"]`) - .dblclick() - .find("input") - .should(validationString); + cy.get(`tbody > :nth-child(4) > [data-col="City"]`) + .dblclick() + .find("input") + .should(validationString); } // read &/ update comment @@ -123,146 +137,152 @@ export function _editData(roleType, previewMode) { // Everyone else: read &/ update // export function _editComment(roleType, previewMode) { - 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); - // click on comment icon & type comment - // + // click on comment icon & type comment + // - cy.get(".v-input.row-checkbox").eq(4).next().next().click({ force: true }); + cy.get(".v-input.row-checkbox").eq(4).next().next().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 + // + + if ("viewer" == roleType) { + cy.getActiveModal() + .find(".mdi-comment-multiple-outline") + .should("not.exist"); + } else { + cy.getActiveModal() + .find(".mdi-comment-multiple-outline") + .should("exist") + .click(); + cy.getActiveModal().find(".comment-box").type("Comment-1{enter}"); + // cy.toastWait('Comment added successfully') + cy.getActiveModal().find(".mdi-door-open").click(); + + cy.get("body") + .contains(validationString, { timeout: 2000 }) + .should("exist"); + } - if ("viewer" == roleType) { - cy.getActiveModal() - .find(".mdi-comment-multiple-outline") - .should("not.exist"); - } else { cy.getActiveModal() - .find(".mdi-comment-multiple-outline") - .should("exist") - .click(); - cy.getActiveModal().find(".comment-box").type("Comment-1{enter}"); - // cy.toastWait('Comment added successfully') - cy.getActiveModal().find(".mdi-door-open").click(); - - cy.get("body") - .contains(validationString, { timeout: 2000 }) - .should("exist"); - } - - cy.getActiveModal().find("button").contains("Cancel").should("exist").click(); - cy.get("body").type("{esc}"); + .find("button") + .contains("Cancel") + .should("exist") + .click(); + cy.get("body").type("{esc}"); } // right navigation menu bar // Editor/Viewer/Commenter : can only view 'existing' views // Rest: can create/edit export function _viewMenu(roleType, previewMode) { - let columnName = "City"; - let navDrawListCnt = 2; - let actionsMenuItemsCnt = 1; - - cy.openTableTab(columnName, 25); - - let validationString = - true == roles[roleType].validations.shareView ? "exist" : "not.exist"; - - // validate if Share button is visible at header tool bar - cy.get("header.v-toolbar") - .eq(0) - .find('button:contains("Share")') - .should(validationString); - - // Owner, Creator will have two navigation drawer (on each side of center panel) - if (roleType == "owner" || roleType == "creator") { - navDrawListCnt = 3; - actionsMenuItemsCnt = 4; - } - - cy.get(".v-navigation-drawer__content") - .eq(1) - .find('[role="list"]') - .should("have.length", navDrawListCnt); - - // 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-gallery-view`).should(validationString); - cy.get(`.nc-create-grid-view`).should(validationString); - cy.get(`.nc-create-form-view`).should(validationString); - - // share view & automations, exists only for owner/creator - // cy.get(`.nc-share-view`).should(validationString); - // cy.get(`.nc-automations`).should(validationString); - // mainPage.shareView().should(validationString); - // mainPage.automations().should(validationString); - - // share view permissions are role specific - cy.get('.nc-btn-share-view').should(validationString); - - // actions menu (more), only download csv should be visible for non-previlaged users - cy.get('.nc-actions-menu-btn').click(); - cy.getActiveMenu().find('[role="menuitem"]').should("have.length", actionsMenuItemsCnt); + let columnName = "City"; + let navDrawListCnt = 2; + let actionsMenuItemsCnt = 1; + + cy.openTableTab(columnName, 25); + + let validationString = + true == roles[roleType].validations.shareView ? "exist" : "not.exist"; + + // validate if Share button is visible at header tool bar + cy.get("header.v-toolbar") + .eq(0) + .find('button:contains("Share")') + .should(validationString); + + // Owner, Creator will have two navigation drawer (on each side of center panel) + if (roleType == "owner" || roleType == "creator") { + navDrawListCnt = 3; + actionsMenuItemsCnt = 4; + } + + cy.get(".v-navigation-drawer__content") + .eq(1) + .find('[role="list"]') + .should("have.length", navDrawListCnt); + + // 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-gallery-view`).should(validationString); + cy.get(`.nc-create-grid-view`).should(validationString); + cy.get(`.nc-create-form-view`).should(validationString); + + // share view & automations, exists only for owner/creator + // cy.get(`.nc-share-view`).should(validationString); + // cy.get(`.nc-automations`).should(validationString); + // mainPage.shareView().should(validationString); + // mainPage.automations().should(validationString); + + // share view permissions are role specific + cy.get(".nc-btn-share-view").should(validationString); + + // actions menu (more), only download csv should be visible for non-previlaged users + cy.get(".nc-actions-menu-btn").click(); + cy.getActiveMenu() + .find('[role="menuitem"]') + .should("have.length", actionsMenuItemsCnt); } export function _topRightMenu(roleType, previewMode) { - let validationString = - true == roles[roleType].validations.shareView ? "exist" : "not.exist"; - cy.get(".nc-topright-menu").find(".nc-menu-share").should(validationString); - - // cy.get(".nc-topright-menu").find(".nc-menu-theme").should("exist"); - // cy.get(".nc-topright-menu").find(".nc-menu-dark-theme").should("exist"); - cy.get(".nc-topright-menu").find(".nc-menu-translate").should("exist"); - cy.get(".nc-topright-menu").find(".nc-menu-account").should("exist"); - cy.get(".nc-topright-menu").find(".nc-menu-alert").should("exist"); + let validationString = + true == roles[roleType].validations.shareView ? "exist" : "not.exist"; + cy.get(".nc-topright-menu").find(".nc-menu-share").should(validationString); + + // cy.get(".nc-topright-menu").find(".nc-menu-theme").should("exist"); + // cy.get(".nc-topright-menu").find(".nc-menu-dark-theme").should("exist"); + cy.get(".nc-topright-menu").find(".nc-menu-translate").should("exist"); + cy.get(".nc-topright-menu").find(".nc-menu-account").should("exist"); + cy.get(".nc-topright-menu").find(".nc-menu-alert").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"); - cy.get(".nc-acl-save").next().click({ force: true }); - cy.toastWait("Updated UI ACL for tables successfully"); + 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"); + cy.get(".nc-acl-save").next().click({ force: true }); + cy.toastWait("Updated UI ACL for tables successfully"); } 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"); - cy.get(".nc-acl-save").next().click({ force: true }); - cy.toastWait("Updated UI ACL for tables successfully"); + 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"); + cy.get(".nc-acl-save").next().click({ force: true }); + cy.toastWait("Updated UI ACL for tables successfully"); } export function _accessControl(roleType, previewMode) { - let validationString = roleType == "creator" ? "exist" : "not.exist"; - cy.get(".nc-project-tree") - .find(".v-list-item__title:contains(Tables)", { timeout: 10000 }) - .should("exist") - .first() - .click({ force: true }); - - cy.get(".nc-project-tree") - .contains("Language", { timeout: 6000 }) - .should(validationString); - - cy.get(".nc-project-tree") - .contains("CustomerList", { timeout: 6000 }) - .should(validationString); - - cy.get(".nc-project-tree") - .find(".v-list-item__title:contains(Tables)", { timeout: 10000 }) - .first() - .click({ force: true }); + let validationString = roleType == "creator" ? "exist" : "not.exist"; + cy.get(".nc-project-tree") + .find(".v-list-item__title:contains(Tables)", { timeout: 10000 }) + .should("exist") + .first() + .click({ force: true }); + + cy.get(".nc-project-tree") + .contains("Language", { timeout: 6000 }) + .should(validationString); + + cy.get(".nc-project-tree") + .contains("CustomerList", { timeout: 6000 }) + .should(validationString); + + cy.get(".nc-project-tree") + .find(".v-list-item__title:contains(Tables)", { timeout: 10000 }) + .first() + .click({ force: true }); } diff --git a/scripts/cypress/integration/test/gqlRoles.js b/scripts/cypress/integration/test/gqlRoles.js index 0bae85e8ca..e1dd1e8c96 100644 --- a/scripts/cypress/integration/test/gqlRoles.js +++ b/scripts/cypress/integration/test/gqlRoles.js @@ -3,7 +3,7 @@ let t01 = require("../common/00_pre_configurations"); let t5a = require("../common/5a_user_role"); let t5b = require("../common/5b_preview_role"); const { - setCurrentMode, + setCurrentMode, } = require("../../support/page_objects/projectConstants"); // use 0 as mode to execute individual files (debug mode, skip pre-configs) @@ -11,15 +11,15 @@ const { const executionMode = 1; const nocoTestSuite = (apiType, dbType) => { - setCurrentMode(apiType, dbType); - if (0 == executionMode) { - t0.genTest(apiType, dbType); - } else { - t01.genTest(apiType, dbType); - } + setCurrentMode(apiType, dbType); + if (0 == executionMode) { + t0.genTest(apiType, dbType); + } else { + t01.genTest(apiType, dbType); + } - t5a.genTest(apiType, dbType); - t5b.genTest(apiType, dbType); + t5a.genTest(apiType, dbType); + t5b.genTest(apiType, dbType); }; nocoTestSuite("graphql", "mysql"); diff --git a/scripts/cypress/integration/test/gqlTableOps.js b/scripts/cypress/integration/test/gqlTableOps.js index 9fc51bf759..4bf3c30a23 100644 --- a/scripts/cypress/integration/test/gqlTableOps.js +++ b/scripts/cypress/integration/test/gqlTableOps.js @@ -12,7 +12,7 @@ let t3b = require("../common/3b_formula_column"); let t3c = require("../common/3c_lookup_column"); let t3d = require("../common/3d_rollup_column"); const { - setCurrentMode, + setCurrentMode, } = require("../../support/page_objects/projectConstants"); // use 0 as mode to execute individual files (debug mode, skip pre-configs) @@ -20,24 +20,24 @@ const { const executionMode = 1; const nocoTestSuite = (apiType, dbType) => { - if (0 == executionMode) { - setCurrentMode(apiType, dbType); - t0.genTest(apiType, dbType); - } else { - t01.genTest(apiType, dbType); - } + if (0 == executionMode) { + setCurrentMode(apiType, dbType); + t0.genTest(apiType, dbType); + } else { + t01.genTest(apiType, dbType); + } - t1a.genTest(apiType, dbType); - t1b.genTest(apiType, dbType); - t1c.genTest(apiType, dbType); - 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); + t1a.genTest(apiType, dbType); + t1b.genTest(apiType, dbType); + t1c.genTest(apiType, dbType); + 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); }; nocoTestSuite("graphql", "mysql"); diff --git a/scripts/cypress/integration/test/gqlViews.js b/scripts/cypress/integration/test/gqlViews.js index 5cca1d2a00..6005036e0a 100644 --- a/scripts/cypress/integration/test/gqlViews.js +++ b/scripts/cypress/integration/test/gqlViews.js @@ -7,7 +7,7 @@ let t4d = require("../common/4d_table_view_grid_locked"); let t4e = require("../common/4e_form_view_share"); let t4f = require("../common/4f_grid_view_share"); const { - setCurrentMode, + setCurrentMode, } = require("../../support/page_objects/projectConstants"); // use 0 as mode to execute individual files (debug mode, skip pre-configs) @@ -15,19 +15,19 @@ const { const executionMode = 1; const nocoTestSuite = (apiType, dbType) => { - setCurrentMode(apiType, dbType); - if (0 == executionMode) { - t0.genTest(apiType, dbType); - } else { - t01.genTest(apiType, dbType); - } + setCurrentMode(apiType, dbType); + if (0 == executionMode) { + t0.genTest(apiType, dbType); + } else { + t01.genTest(apiType, dbType); + } - t4a.genTest(apiType, dbType); - t4b.genTest(apiType, dbType); - t4c.genTest(apiType, dbType); - t4d.genTest(apiType, dbType); - t4e.genTest(apiType, dbType); - t4f.genTest(apiType, dbType); + t4a.genTest(apiType, dbType); + t4b.genTest(apiType, dbType); + t4c.genTest(apiType, dbType); + t4d.genTest(apiType, dbType); + t4e.genTest(apiType, dbType); + t4f.genTest(apiType, dbType); }; nocoTestSuite("graphql", "mysql"); diff --git a/scripts/cypress/integration/test/restRoles.js b/scripts/cypress/integration/test/restRoles.js index 769476b911..4124bcba6a 100644 --- a/scripts/cypress/integration/test/restRoles.js +++ b/scripts/cypress/integration/test/restRoles.js @@ -3,7 +3,7 @@ let t01 = require("../common/00_pre_configurations"); let t5a = require("../common/5a_user_role"); let t5b = require("../common/5b_preview_role"); const { - setCurrentMode, + setCurrentMode, } = require("../../support/page_objects/projectConstants"); // use 0 as mode to execute individual files (debug mode, skip pre-configs) @@ -11,15 +11,15 @@ const { const executionMode = 1; const nocoTestSuite = (apiType, dbType) => { - setCurrentMode(apiType, dbType); - if (0 == executionMode) { - t0.genTest(apiType, dbType); - } else { - t01.genTest(apiType, dbType); - } + setCurrentMode(apiType, dbType); + if (0 == executionMode) { + t0.genTest(apiType, dbType); + } else { + t01.genTest(apiType, dbType); + } - t5a.genTest(apiType, dbType); - t5b.genTest(apiType, dbType); + t5a.genTest(apiType, dbType); + t5b.genTest(apiType, dbType); }; nocoTestSuite("rest", "mysql"); diff --git a/scripts/cypress/integration/test/restTableOps.js b/scripts/cypress/integration/test/restTableOps.js index fe243d382d..750cf629f1 100644 --- a/scripts/cypress/integration/test/restTableOps.js +++ b/scripts/cypress/integration/test/restTableOps.js @@ -12,7 +12,7 @@ let t3b = require("../common/3b_formula_column"); let t3c = require("../common/3c_lookup_column"); let t3d = require("../common/3d_rollup_column"); const { - setCurrentMode, + setCurrentMode, } = require("../../support/page_objects/projectConstants"); // use 0 as mode to execute individual files (debug mode, skip pre-configs) @@ -20,24 +20,24 @@ const { const executionMode = 1; const nocoTestSuite = (apiType, dbType) => { - setCurrentMode(apiType, dbType); - if (0 == executionMode) { - t0.genTest(apiType, dbType); - } else { - t01.genTest(apiType, dbType); - } + setCurrentMode(apiType, dbType); + if (0 == executionMode) { + t0.genTest(apiType, dbType); + } else { + t01.genTest(apiType, dbType); + } - t1a.genTest(apiType, dbType); - t1b.genTest(apiType, dbType); - t1c.genTest(apiType, dbType); - 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); + t1a.genTest(apiType, dbType); + t1b.genTest(apiType, dbType); + t1c.genTest(apiType, dbType); + 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); }; nocoTestSuite("rest", "mysql"); diff --git a/scripts/cypress/integration/test/restViews.js b/scripts/cypress/integration/test/restViews.js index 7920dd74fb..d413dc2866 100644 --- a/scripts/cypress/integration/test/restViews.js +++ b/scripts/cypress/integration/test/restViews.js @@ -7,7 +7,7 @@ let t4d = require("../common/4d_table_view_grid_locked"); let t4e = require("../common/4e_form_view_share"); let t4f = require("../common/4f_grid_view_share"); const { - setCurrentMode, + setCurrentMode, } = require("../../support/page_objects/projectConstants"); // use 0 as mode to execute individual files (debug mode, skip pre-configs) @@ -15,19 +15,19 @@ const { const executionMode = 1; const nocoTestSuite = (apiType, dbType) => { - setCurrentMode(apiType, dbType); - if (0 == executionMode) { - t0.genTest(apiType, dbType); - } else { - t01.genTest(apiType, dbType); - } + setCurrentMode(apiType, dbType); + if (0 == executionMode) { + t0.genTest(apiType, dbType); + } else { + t01.genTest(apiType, dbType); + } - t4a.genTest(apiType, dbType); - t4b.genTest(apiType, dbType); - t4c.genTest(apiType, dbType); - t4d.genTest(apiType, dbType); - t4e.genTest(apiType, dbType); - t4f.genTest(apiType, dbType); + t4a.genTest(apiType, dbType); + t4b.genTest(apiType, dbType); + t4c.genTest(apiType, dbType); + t4d.genTest(apiType, dbType); + t4e.genTest(apiType, dbType); + t4f.genTest(apiType, dbType); }; nocoTestSuite("rest", "mysql"); diff --git a/scripts/cypress/integration/test/xcdb-gqlRoles.js b/scripts/cypress/integration/test/xcdb-gqlRoles.js index 2747267b81..ef418410b5 100644 --- a/scripts/cypress/integration/test/xcdb-gqlRoles.js +++ b/scripts/cypress/integration/test/xcdb-gqlRoles.js @@ -3,7 +3,7 @@ let t01 = require("../common/00_pre_configurations"); let t5a = require("../common/5a_user_role"); let t5b = require("../common/5b_preview_role"); const { - setCurrentMode, + setCurrentMode, } = require("../../support/page_objects/projectConstants"); // use 0 as mode to execute individual files (debug mode, skip pre-configs) @@ -11,15 +11,15 @@ const { const executionMode = 1; const nocoTestSuite = (apiType, dbType) => { - setCurrentMode(apiType, dbType); - if (0 == executionMode) { - t0.genTest(apiType, dbType); - } else { - t01.genTest(apiType, dbType); - } + setCurrentMode(apiType, dbType); + if (0 == executionMode) { + t0.genTest(apiType, dbType); + } else { + t01.genTest(apiType, dbType); + } - t5a.genTest(apiType, dbType); - t5b.genTest(apiType, dbType); + t5a.genTest(apiType, dbType); + t5b.genTest(apiType, dbType); }; nocoTestSuite("graphql", "xcdb"); diff --git a/scripts/cypress/integration/test/xcdb-gqlTableOps.js b/scripts/cypress/integration/test/xcdb-gqlTableOps.js index 3a8969de40..7b8c2bed1d 100644 --- a/scripts/cypress/integration/test/xcdb-gqlTableOps.js +++ b/scripts/cypress/integration/test/xcdb-gqlTableOps.js @@ -12,7 +12,7 @@ let t3b = require("../common/3b_formula_column"); let t3c = require("../common/3c_lookup_column"); let t3d = require("../common/3d_rollup_column"); const { - setCurrentMode, + setCurrentMode, } = require("../../support/page_objects/projectConstants"); // use 0 as mode to execute individual files (debug mode, skip pre-configs) @@ -20,24 +20,24 @@ const { const executionMode = 1; const nocoTestSuite = (apiType, dbType) => { - setCurrentMode(apiType, dbType); - if (0 == executionMode) { - t0.genTest(apiType, dbType); - } else { - t01.genTest(apiType, dbType); - } + setCurrentMode(apiType, dbType); + if (0 == executionMode) { + t0.genTest(apiType, dbType); + } else { + t01.genTest(apiType, dbType); + } - t1a.genTest(apiType, dbType); - t1b.genTest(apiType, dbType); - t1c.genTest(apiType, dbType); - 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); + t1a.genTest(apiType, dbType); + t1b.genTest(apiType, dbType); + t1c.genTest(apiType, dbType); + 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); }; nocoTestSuite("graphql", "xcdb"); diff --git a/scripts/cypress/integration/test/xcdb-gqlViews.js b/scripts/cypress/integration/test/xcdb-gqlViews.js index 295c1160ea..0459053cf1 100644 --- a/scripts/cypress/integration/test/xcdb-gqlViews.js +++ b/scripts/cypress/integration/test/xcdb-gqlViews.js @@ -7,7 +7,7 @@ let t4d = require("../common/4d_table_view_grid_locked"); let t4e = require("../common/4e_form_view_share"); let t4f = require("../common/4f_grid_view_share"); const { - setCurrentMode, + setCurrentMode, } = require("../../support/page_objects/projectConstants"); // use 0 as mode to execute individual files (debug mode, skip pre-configs) @@ -15,19 +15,19 @@ const { const executionMode = 1; const nocoTestSuite = (apiType, dbType) => { - setCurrentMode(apiType, dbType); - if (0 == executionMode) { - t0.genTest(apiType, dbType); - } else { - t01.genTest(apiType, dbType); - } + setCurrentMode(apiType, dbType); + if (0 == executionMode) { + t0.genTest(apiType, dbType); + } else { + t01.genTest(apiType, dbType); + } - t4a.genTest(apiType, dbType); - t4b.genTest(apiType, dbType); - t4c.genTest(apiType, dbType); - t4d.genTest(apiType, dbType); - t4e.genTest(apiType, dbType); - t4f.genTest(apiType, dbType); + t4a.genTest(apiType, dbType); + t4b.genTest(apiType, dbType); + t4c.genTest(apiType, dbType); + t4d.genTest(apiType, dbType); + t4e.genTest(apiType, dbType); + t4f.genTest(apiType, dbType); }; nocoTestSuite("graphql", "xcdb"); diff --git a/scripts/cypress/integration/test/xcdb-restRoles.js b/scripts/cypress/integration/test/xcdb-restRoles.js index 0b1a93a70c..2857ac18dc 100644 --- a/scripts/cypress/integration/test/xcdb-restRoles.js +++ b/scripts/cypress/integration/test/xcdb-restRoles.js @@ -3,7 +3,7 @@ let t01 = require("../common/00_pre_configurations"); let t5a = require("../common/5a_user_role"); let t5b = require("../common/5b_preview_role"); const { - setCurrentMode, + setCurrentMode, } = require("../../support/page_objects/projectConstants"); // use 0 as mode to execute individual files (debug mode, skip pre-configs) @@ -11,15 +11,15 @@ const { const executionMode = 1; const nocoTestSuite = (apiType, dbType) => { - setCurrentMode(apiType, dbType); - if (0 == executionMode) { - t0.genTest(apiType, dbType); - } else { - t01.genTest(apiType, dbType); - } + setCurrentMode(apiType, dbType); + if (0 == executionMode) { + t0.genTest(apiType, dbType); + } else { + t01.genTest(apiType, dbType); + } - t5a.genTest(apiType, dbType); - t5b.genTest(apiType, dbType); + t5a.genTest(apiType, dbType); + t5b.genTest(apiType, dbType); }; nocoTestSuite("rest", "xcdb"); diff --git a/scripts/cypress/integration/test/xcdb-restTableOps.js b/scripts/cypress/integration/test/xcdb-restTableOps.js index 9f9c64342e..89a9121c1e 100644 --- a/scripts/cypress/integration/test/xcdb-restTableOps.js +++ b/scripts/cypress/integration/test/xcdb-restTableOps.js @@ -12,7 +12,7 @@ let t3b = require("../common/3b_formula_column"); let t3c = require("../common/3c_lookup_column"); let t3d = require("../common/3d_rollup_column"); const { - setCurrentMode, + setCurrentMode, } = require("../../support/page_objects/projectConstants"); // use 0 as mode to execute individual files (debug mode, skip pre-configs) @@ -20,24 +20,24 @@ const { const executionMode = 1; const nocoTestSuite = (apiType, dbType) => { - setCurrentMode(apiType, dbType); - if (0 == executionMode) { - t0.genTest(apiType, dbType); - } else { - t01.genTest(apiType, dbType); - } + setCurrentMode(apiType, dbType); + if (0 == executionMode) { + t0.genTest(apiType, dbType); + } else { + t01.genTest(apiType, dbType); + } - t1a.genTest(apiType, dbType); - t1b.genTest(apiType, dbType); - t1c.genTest(apiType, dbType); - 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); + t1a.genTest(apiType, dbType); + t1b.genTest(apiType, dbType); + t1c.genTest(apiType, dbType); + 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); }; nocoTestSuite("rest", "xcdb"); diff --git a/scripts/cypress/support/index.js b/scripts/cypress/support/index.js index 87f8976576..3e3773f432 100644 --- a/scripts/cypress/support/index.js +++ b/scripts/cypress/support/index.js @@ -23,10 +23,10 @@ import "cypress-iframe"; // require('./commands') Cypress.on("uncaught:exception", (err, runnable) => { - // returning false here prevents Cypress from - // failing the test - console.log("uncaught:exception"); - console.log(err); - console.log(runnable); - return false; + // returning false here prevents Cypress from + // failing the test + console.log("uncaught:exception"); + console.log(err); + console.log(runnable); + return false; }); diff --git a/scripts/cypress/support/page_objects/mainPage.js b/scripts/cypress/support/page_objects/mainPage.js index e182165a58..8a783a55b4 100644 --- a/scripts/cypress/support/page_objects/mainPage.js +++ b/scripts/cypress/support/page_objects/mainPage.js @@ -89,9 +89,9 @@ export class _mainPage { // click on New User button, feed details cy.get('button:contains("New User")').first().click(); - + cy.snip("NewUser"); - + cy.get('label:contains("E-mail")') .next("input") .type(userCred.username)