Browse Source

test: cypress updates for view/ phase2

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/3365/head
Raju Udava 2 years ago
parent
commit
33d28c5c50
  1. 8
      scripts/cypress-v2/integration/common/4d_table_view_grid_locked.js
  2. 12
      scripts/cypress-v2/integration/common/4e_form_view_share.js
  3. 142
      scripts/cypress-v2/integration/common/4f_grid_view_share.js
  4. 2
      scripts/cypress-v2/integration/test/restViews.js

8
scripts/cypress-v2/integration/common/4d_table_view_grid_locked.js

@ -8,22 +8,14 @@ export const genTest = (apiType, dbType) => {
// Run once before test- create project (rest/graphql) // Run once before test- create project (rest/graphql)
// //
before(() => { before(() => {
cy.fileHook();
mainPage.tabReset(); 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);
// open a table to work on views // open a table to work on views
// //
cy.openTableTab("Country", 25); cy.openTableTab("Country", 25);
}); });
beforeEach(() => { beforeEach(() => {
cy.fileHook();
}); });
after(() => { after(() => {

12
scripts/cypress-v2/integration/common/4e_form_view_share.js

@ -12,7 +12,6 @@ export const genTest = (apiType, dbType) => {
// Run once before test- create project (rest/graphql) // Run once before test- create project (rest/graphql)
// //
before(() => { before(() => {
cy.fileHook();
mainPage.tabReset(); mainPage.tabReset();
// open a table to work on views // open a table to work on views
// //
@ -29,7 +28,6 @@ export const genTest = (apiType, dbType) => {
}); });
beforeEach(() => { beforeEach(() => {
cy.fileHook();
cy.restoreLocalStorage(); cy.restoreLocalStorage();
}); });
@ -107,12 +105,12 @@ export const genTest = (apiType, dbType) => {
.contains("Form-1") .contains("Form-1")
.click(); .click();
mainPage.shareView().click({ force: true }); cy.wait(2000);
mainPage.shareView().click();
cy.wait(5000);
// copy link text, visit URL // copy link text, visit URL
cy.getActiveModal() cy.getActiveModal()
.should('exist')
.find(".share-link-box") .find(".share-link-box")
.contains("/nc/form/", { timeout: 10000 }) .contains("/nc/form/", { timeout: 10000 })
.should("exist") .should("exist")
@ -199,13 +197,15 @@ export const genTest = (apiType, dbType) => {
cy.visit(storedURL, { cy.visit(storedURL, {
baseUrl: null, baseUrl: null,
}); });
cy.wait(5000); cy.wait(2000);
// number of view entries should be 2 before we delete // number of view entries should be 2 before we delete
cy.get(".nc-view-item").its("length").should("eq", 2); cy.get(".nc-view-item").its("length").should("eq", 2);
// click on delete icon (becomes visible on hovering mouse) // click on delete icon (becomes visible on hovering mouse)
cy.get(".nc-view-delete-icon").click({ force: true }); cy.get(".nc-view-delete-icon").click({ force: true });
cy.wait(1000);
cy.getActiveModal().find('.ant-btn-dangerous').should('exist').click();
cy.toastWait("View deleted successfully"); cy.toastWait("View deleted successfully");
// confirm if the number of veiw entries is reduced by 1 // confirm if the number of veiw entries is reduced by 1

142
scripts/cypress-v2/integration/common/4f_grid_view_share.js

@ -15,11 +15,6 @@ export const genTest = (apiType, dbType) => {
if (!isTestSuiteActive(apiType, dbType)) return; if (!isTestSuiteActive(apiType, dbType)) return;
const generateViewLink = (viewName) => { const generateViewLink = (viewName) => {
// click on share view
// cy.get(".v-navigation-drawer__content > .container")
// .find(".v-list > .v-list-item")
// .contains("Share View")
// .click();
mainPage.shareView().click(); mainPage.shareView().click();
cy.wait(1000); cy.wait(1000);
@ -45,7 +40,6 @@ export const genTest = (apiType, dbType) => {
// Run once before test- create project (rest/graphql) // Run once before test- create project (rest/graphql)
// //
before(() => { before(() => {
cy.fileHook();
mainPage.tabReset(); mainPage.tabReset();
// // kludge: wait for page load to finish // // kludge: wait for page load to finish
@ -63,7 +57,6 @@ export const genTest = (apiType, dbType) => {
}); });
beforeEach(() => { beforeEach(() => {
cy.fileHook();
cy.restoreLocalStorage(); cy.restoreLocalStorage();
}); });
@ -90,6 +83,7 @@ export const genTest = (apiType, dbType) => {
// store base URL- to re-visit and delete form view later // store base URL- to re-visit and delete form view later
cy.url().then((url) => { cy.url().then((url) => {
storedURL = url; storedURL = url;
cy.saveLocalStorage();
}); });
}); });
@ -110,16 +104,8 @@ export const genTest = (apiType, dbType) => {
generateViewLink("combined"); generateViewLink("combined");
// verify if only one link exists in table // verify if only one link exists in table
// cy.get(".v-navigation-drawer__content > .container")
// .find(".v-list > .v-list-item")
// .contains("Share View")
// .parent()
// .find("button.mdi-dots-vertical")
// .click();
mainPage.shareViewList().click(); mainPage.shareViewList().click();
// cy.getActiveMenu().find(".v-list-item").contains("Views List").click();
cy.get('th:contains("View Link")').should("exist"); cy.get('th:contains("View Link")').should("exist");
cy.get('th:contains("View Link")') cy.get('th:contains("View Link")')
@ -131,9 +117,6 @@ export const genTest = (apiType, dbType) => {
.should("eq", 1) .should("eq", 1)
.then(() => { .then(() => {
cy.get('button.ant-modal-close:visible').click(); cy.get('button.ant-modal-close:visible').click();
// cy.get(".v-overlay--active > .v-overlay__scrim").click({
// force: true,
// });
}); });
}); });
@ -192,7 +175,6 @@ export const genTest = (apiType, dbType) => {
for (let j = 0; j < 4; j++) { for (let j = 0; j < 4; j++) {
expect(strCol[j]).to.be.equal(retCol[j]); expect(strCol[j]).to.be.equal(retCol[j]);
} }
// expect(retrievedRecords[i]).to.be.equal(storedRecords[i])
} }
}; };
@ -291,27 +273,27 @@ export const genTest = (apiType, dbType) => {
.find(".nc-icon.nc-action-icon.nc-plus") .find(".nc-icon.nc-action-icon.nc-plus")
.should("not.exist"); .should("not.exist");
// to be fixed mainPage
// mainPage .getCell("Customer List", 3)
// .getCell("Customer List", 3) .click()
// .click() .find(".nc-icon.nc-action-icon.nc-arrow-expand")
// .find(".nc-icon.nc-action-icon.nc-arrow-expand") .click({ force: true });
// .click();
// reload button
// cy.getActiveModal().find(".nc-icon.nc-reload").should("exist"); cy.getActiveModal().find(".nc-icon").should("exist");
// cy.getActiveModal() cy.getActiveModal()
// .find("button") .find("button")
// .contains("Link to") .contains("Link to")
// .should("not.exist"); .should("not.exist");
// cy.getActiveModal() cy.getActiveModal()
// .find(".ant-card") .find(".ant-card")
// .contains("2") .contains("2")
// .should("exist"); .should("exist");
// cy.getActiveModal() cy.getActiveModal()
// .find(".ant-card") .find(".ant-card")
// .find("button") .find("button")
// .should("not.exist"); .should("not.exist");
// cy.get('button.ant-modal-close').click(); cy.get('button.ant-modal-close').click();
}); });
it(`Share GRID view : Virtual column validation > belongs to`, () => { it(`Share GRID view : Virtual column validation > belongs to`, () => {
@ -322,17 +304,16 @@ export const genTest = (apiType, dbType) => {
.find(".nc-icon.nc-unlink-icon") .find(".nc-icon.nc-unlink-icon")
.should("not.exist"); .should("not.exist");
// to be fixed mainPage
// mainPage .getCell("City", 1)
// .getCell("City", 1) .click()
// .click() .find(".nc-icon.nc-action-icon.nc-arrow-expand")
// .find(".nc-icon.nc-action-icon.nc-arrow-expand") .should("not.exist");
// .should("not.exist"); mainPage
// mainPage .getCell("City", 1)
// .getCell("City", 1) .find(".chips")
// .find(".chips") .contains("Kanchrapara")
// .contains("Kanchrapara") .should("exist");
// .should("exist");
}); });
it(`Share GRID view : Virtual column validation > many to many`, () => { it(`Share GRID view : Virtual column validation > many to many`, () => {
@ -348,23 +329,24 @@ export const genTest = (apiType, dbType) => {
.find(".nc-icon.nc-action-icon.nc-plus") .find(".nc-icon.nc-action-icon.nc-plus")
.should("not.exist"); .should("not.exist");
// to be fixed mainPage
// mainPage .getCell("Staff List", 1)
// .getCell("Staff List", 1) .click()
// .click() .find(".nc-icon.nc-action-icon.nc-arrow-expand")
// .find(".nc-icon.nc-action-icon.nc-arrow-expand") .click({ force: true });
// .click();
// cy.getActiveModal().find(".nc-icon.nc-reload").should("exist"); // reload button
// cy.getActiveModal() cy.getActiveModal().find(".nc-icon").should("exist");
// .find("button") cy.getActiveModal()
// .contains("Link to") .find("button")
// .should("not.exist"); .contains("Link to")
// cy.get("body").type("{esc}"); .should("not.exist");
cy.get('button.ant-modal-close:visible').last().click();
}); });
it(`Delete ${viewType.toUpperCase()} view`, () => { it(`Delete ${viewType.toUpperCase()} view`, () => {
// go back to base page // go back to base page
cy.restoreLocalStorage();
cy.visit(storedURL, { cy.visit(storedURL, {
baseUrl: null, baseUrl: null,
}); });
@ -389,23 +371,15 @@ export const genTest = (apiType, dbType) => {
describe(`${apiType.toUpperCase()} api - Grid view/ row-column update verification`, () => { describe(`${apiType.toUpperCase()} api - Grid view/ row-column update verification`, () => {
before(() => { before(() => {
cy.fileHook();
// // 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.restoreLocalStorage();
// Address table has belongs to, has many & many-to-many // Address table has belongs to, has many & many-to-many
cy.openTableTab("Country", 25); cy.openTableTab("Country", 25);
mainPage.toggleRightSidebar();
cy.saveLocalStorage();
// store base URL- to re-visit and delete form view later // store base URL- to re-visit and delete form view later
cy.url().then((url) => { cy.url().then((url) => {
storedURL = url; storedURL = url;
cy.saveLocalStorage();
generateViewLink("rowColUpdate"); generateViewLink("rowColUpdate");
}); });
}); });
@ -425,13 +399,6 @@ export const genTest = (apiType, dbType) => {
// wait for page rendering to complete // wait for page rendering to complete
cy.get(".nc-grid-row").should("have.length", 10); 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(); mainPage.getCell("Country", 10).rightclick();
cy.getActiveMenu() cy.getActiveMenu()
.find('.ant-dropdown-menu-item:contains("Delete Row")') .find('.ant-dropdown-menu-item:contains("Delete Row")')
@ -440,14 +407,6 @@ export const genTest = (apiType, dbType) => {
// delete column // delete column
mainPage.deleteColumn("dummy"); mainPage.deleteColumn("dummy");
// cy.get(`th:contains('dummy') .nc-ui-dt-dropdown`)
// .trigger("mouseover")
// .click();
// cy.get(".nc-column-delete").click();
// cy.get("button:contains(Confirm)").click();
//
// cy.toastWait("Update table successful");
mainPage.deleteCreatedViews(); mainPage.deleteCreatedViews();
// close table // close table
@ -457,12 +416,6 @@ export const genTest = (apiType, dbType) => {
it(`Generate default Shared GRID view URL`, () => { it(`Generate default Shared GRID view URL`, () => {
// add row // add row
cy.get(".nc-add-new-row-btn").click(); cy.get(".nc-add-new-row-btn").click();
// cy.get("#data-table-form-Country > input")
// .first()
// .click()
// .type("a");
// cy.contains("Save row").filter("button").click({ force: true });
// cy.toastWait("updated successfully");
cy.get(".nc-expand-col-Country").find(".nc-cell > input") cy.get(".nc-expand-col-Country").find(".nc-cell > input")
.should("exist") .should("exist")
.first() .first()
@ -488,7 +441,6 @@ export const genTest = (apiType, dbType) => {
}); });
cy.wait(5000); cy.wait(5000);
//5
// wait for public view page to load! // wait for public view page to load!
// wait for page rendering to complete // wait for page rendering to complete
cy.get(".nc-grid-row").should("have.length", 25); cy.get(".nc-grid-row").should("have.length", 25);

2
scripts/cypress-v2/integration/test/restViews.js

@ -19,7 +19,7 @@ const nocoTestSuite = (apiType, dbType) => {
t4a.genTest(apiType, dbType); t4a.genTest(apiType, dbType);
t4b.genTest(apiType, dbType); t4b.genTest(apiType, dbType);
t4d.genTest(apiType, dbType); t4d.genTest(apiType, dbType);
t4e.genTest(apiType, dbType); // to be fixed t4e.genTest(apiType, dbType);
t4f.genTest(apiType, dbType); t4f.genTest(apiType, dbType);
}; };

Loading…
Cancel
Save