Browse Source

Merge pull request #3667 from nocodb/test/cy-stability-2

test: cy views suite local storage & tab handling corrections
pull/3675/head
Raju Udava 2 years ago committed by GitHub
parent
commit
39cd55b43b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      scripts/cypress/integration/common/00_pre_configurations.js
  2. 21
      scripts/cypress/integration/common/1a_table_operations.js
  3. 27
      scripts/cypress/integration/common/1b_table_column_operations.js
  4. 18
      scripts/cypress/integration/common/1c_sql_view.js
  5. 13
      scripts/cypress/integration/common/1e_meta_sync.js
  6. 31
      scripts/cypress/integration/common/2a_table_with_belongs_to_colulmn.js
  7. 32
      scripts/cypress/integration/common/2b_table_with_m2m_column.js
  8. 361
      scripts/cypress/integration/common/3a_filter_sort_fields_operations.js
  9. 25
      scripts/cypress/integration/common/3b_formula_column.js
  10. 44
      scripts/cypress/integration/common/3c_lookup_column.js
  11. 46
      scripts/cypress/integration/common/3d_rollup_column.js
  12. 19
      scripts/cypress/integration/common/3f_link_to_another_record.js
  13. 22
      scripts/cypress/integration/common/4a_table_view_grid_gallery_form.js
  14. 38
      scripts/cypress/integration/common/4b_table_view_share.js
  15. 47
      scripts/cypress/integration/common/4c_form_view_detailed.js
  16. 13
      scripts/cypress/integration/common/4d_table_view_grid_locked.js
  17. 31
      scripts/cypress/integration/common/4e_form_view_share.js
  18. 96
      scripts/cypress/integration/common/4f_grid_view_share.js
  19. 29
      scripts/cypress/integration/common/5a_user_role.js
  20. 29
      scripts/cypress/integration/common/6b_downloadCsv.js
  21. 13
      scripts/cypress/integration/common/6d_language_validation.js
  22. 11
      scripts/cypress/integration/common/6e_project_operations.js
  23. 28
      scripts/cypress/integration/common/6f_attachments.js
  24. 26
      scripts/cypress/integration/common/6g_base_share.js
  25. 28
      scripts/cypress/integration/common/7a_create_project_from_excel.js
  26. 11
      scripts/cypress/integration/common/7b_import_from_airtable.js
  27. 9
      scripts/cypress/integration/common/8a_webhook.js
  28. 27
      scripts/cypress/integration/common/9a_QuickTest.js
  29. 7
      scripts/cypress/integration/spec/roleValidation.spec.js
  30. 20
      scripts/cypress/support/commands.js

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

@ -164,7 +164,6 @@ export const genTest = (apiType, dbType) => {
it("Admin SignUp", () => { it("Admin SignUp", () => {
cy.task("log", "This will be output to the terminal"); cy.task("log", "This will be output to the terminal");
cy.saveLocalStorage();
loginPage.signUp(roles.owner.credentials); loginPage.signUp(roles.owner.credentials);
}); });
@ -250,6 +249,15 @@ export const genTest = (apiType, dbType) => {
else { else {
cy_createProjectBlock(proj, apiType, dbType); cy_createProjectBlock(proj, apiType, dbType);
} }
// kludge: wait for page load to finish
cy.wait(2000);
// close team & auth tab
cy.get('button.ant-tabs-tab-remove').should('exist').click();
cy.wait(1000);
// first instance of updating local storage information
cy.saveLocalStorage();
}); });
}; };

21
scripts/cypress/integration/common/1a_table_operations.js

@ -7,18 +7,25 @@ export const genTest = (apiType, dbType) => {
describe(`${ describe(`${
dbType === "xcdb" ? "Meta - " : "" dbType === "xcdb" ? "Meta - " : ""
}${apiType.toUpperCase()} api - Table`, () => { }${apiType.toUpperCase()} api - Table`, () => {
before(() => { // before(() => {
cy.saveLocalStorage(); // // standalone test
cy.wait(1000); // // loginPage.loginAndOpenProject(apiType, dbType);
}); //
// // open a table to work on views
// //
// // cy.restoreLocalStorage();
// });
beforeEach(() => { beforeEach(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(1000);
}); });
after(() => { afterEach(() => {
}); cy.saveLocalStorage();
})
// after(() => {
// });
const name = "tablex"; const name = "tablex";

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

@ -34,22 +34,26 @@ export const genTest = (apiType, dbType) => {
const randVal = "Test@1234.com"; const randVal = "Test@1234.com";
const updatedRandVal = "Updated@1234.com"; const updatedRandVal = "Updated@1234.com";
before(() => { // before(() => {
cy.fileHook(); // cy.restoreLocalStorage();
mainPage.tabReset(); // cy.createTable(name);
cy.createTable(name); // })
});
beforeEach(() => { beforeEach(() => {
cy.fileHook(); cy.restoreLocalStorage();
}) })
// delete table afterEach(() => {
after(() => { cy.saveLocalStorage();
cy.deleteTable(name, dbType); })
});
// // delete table
// after(() => {
// cy.deleteTable(name, dbType);
// });
it("Create Table Column", () => { it("Create Table Column", () => {
cy.createTable(name);
mainPage.addColumn(colName, name); mainPage.addColumn(colName, name);
}); });
@ -167,6 +171,9 @@ export const genTest = (apiType, dbType) => {
// verify if everything is wiped off // verify if everything is wiped off
mainPage.getCell("Title", 1).contains("a1").should("not.exist"); mainPage.getCell("Title", 1).contains("a1").should("not.exist");
// clean-up
cy.deleteTable(name, dbType);
}); });
}); });
}; };

18
scripts/cypress/integration/common/1c_sql_view.js

@ -10,13 +10,17 @@ export const genTest = (apiType, dbType) => {
describe(`${apiType.toUpperCase()} SQL Views`, () => { describe(`${apiType.toUpperCase()} SQL Views`, () => {
// Run once before test- create project (rest/graphql) // Run once before test- create project (rest/graphql)
// //
before(() => { // before(() => {
cy.fileHook(); // cy.fileHook();
mainPage.tabReset(); // mainPage.tabReset();
}); // });
beforeEach(() => { beforeEach(() => {
cy.fileHook(); cy.restoreLocalStorage();
})
afterEach(() => {
cy.saveLocalStorage();
}) })
it(`XCDB: SQL View Column operations`, () => { it(`XCDB: SQL View Column operations`, () => {
@ -168,10 +172,6 @@ export const genTest = (apiType, dbType) => {
cy.closeViewsTab("StaffList"); cy.closeViewsTab("StaffList");
} }
}); });
after(() => {
// void
});
}); });
}; };

13
scripts/cypress/integration/common/1e_meta_sync.js

@ -18,22 +18,23 @@ export const genTest = (apiType, dbType) => {
// Run once before test- create project (rest/graphql) // Run once before test- create project (rest/graphql)
// //
before(() => { before(() => {
cy.restoreLocalStorage();
if (isXcdb()) { if (isXcdb()) {
cy.log(getProjectString()); cy.log(getProjectString());
projPrefix = `${getProjectString()}`; projPrefix = `${getProjectString()}`;
dbCmd = `sqliteExec`; dbCmd = `sqliteExec`;
tblDisplayPrefix = `${getProjectString()}`; tblDisplayPrefix = `${getProjectString()}`;
} }
mainPage.tabReset();
mainPage.openMetaTab(); mainPage.openMetaTab();
}); })
beforeEach(() => { beforeEach(() => {
}); cy.restoreLocalStorage();
})
after(() => { afterEach(() => {
// mainPage.closeMetaTab(); cy.saveLocalStorage();
}); })
it(`Create table`, () => { it(`Create table`, () => {
// Create Table // Create Table

31
scripts/cypress/integration/common/2a_table_with_belongs_to_colulmn.js

@ -5,28 +5,25 @@ export const genTest = (apiType, dbType) => {
if (!isTestSuiteActive(apiType, dbType)) return; if (!isTestSuiteActive(apiType, dbType)) return;
describe(`${apiType.toUpperCase()} api - Table: belongs to, link record`, () => { describe(`${apiType.toUpperCase()} api - Table: belongs to, link record`, () => {
before(() => { // before(() => {
cy.fileHook(); // cy.restoreLocalStorage();
mainPage.tabReset(); // cy.openTableTab("Country", 25);
// // });
// // 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.openTableTab("Country", 25);
});
beforeEach(() => { beforeEach(() => {
cy.fileHook(); cy.restoreLocalStorage();
}); });
after(() => { afterEach(() => {
cy.closeTableTab("City"); cy.saveLocalStorage();
}); })
// after(() => {
// cy.closeTableTab("City");
// });
it("URL validation", () => { it("URL validation", () => {
cy.openTableTab("Country", 25);
// column name validation // column name validation
// cy.get(`.project-tab:contains(Country):visible`).should("exist"); // cy.get(`.project-tab:contains(Country):visible`).should("exist");
// URL validation // URL validation
@ -103,6 +100,8 @@ export const genTest = (apiType, dbType) => {
.find('.nc-virtual-cell > .chips-wrapper > .chips > .group > .name') .find('.nc-virtual-cell > .chips-wrapper > .chips > .group > .name')
.contains("Saudi Arabia") .contains("Saudi Arabia")
.should('exist'); .should('exist');
cy.closeTableTab("City");
}) })
}); });
}; };

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

@ -5,28 +5,24 @@ export const genTest = (apiType, dbType) => {
if (!isTestSuiteActive(apiType, dbType)) return; if (!isTestSuiteActive(apiType, dbType)) return;
describe(`${apiType.toUpperCase()} api - M2M Column validation`, () => { describe(`${apiType.toUpperCase()} api - M2M Column validation`, () => {
before(() => { // before(() => {
cy.fileHook(); // cy.openTableTab("Actor", 25);
mainPage.tabReset(); // });
// // kludge: wait for page load to finish
// cy.wait(1000);
// // close team & auth tab
// cy.get('button.ant-tabs-tab-remove').should('exist').click();
// cy.wait(1000);
cy.openTableTab("Actor", 25);
});
beforeEach(() => { beforeEach(() => {
cy.fileHook(); cy.restoreLocalStorage();
}); })
after(() => { afterEach(() => {
cy.closeTableTab("Actor"); cy.saveLocalStorage();
}); })
// after(() => {
// cy.closeTableTab("Actor");
// });
it("Table column header, URL validation", () => { it("Table column header, URL validation", () => {
cy.openTableTab("Actor", 25);
// column name validation // column name validation
// cy.get(`.project-tab:contains(Actor):visible`).should("exist"); // cy.get(`.project-tab:contains(Actor):visible`).should("exist");
// URL validation // URL validation
@ -117,6 +113,8 @@ export const genTest = (apiType, dbType) => {
.click(); .click();
cy.getActiveModal().find("button.ant-modal-close").click(); cy.getActiveModal().find("button.ant-modal-close").click();
}); });
cy.closeTableTab("Actor");
}); });
}); });
}; };

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

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

25
scripts/cypress/integration/common/3b_formula_column.js

@ -11,17 +11,22 @@ export const genTest = (apiType, dbType) => {
describe(`${apiType.toUpperCase()} api - FORMULA`, () => { describe(`${apiType.toUpperCase()} api - FORMULA`, () => {
// Run once before test- create project (rest/graphql) // Run once before test- create project (rest/graphql)
// //
before(() => { // before(() => {
// loginPage.loginAndOpenProject(apiType, dbType) // // loginPage.loginAndOpenProject(apiType, dbType)
cy.openTableTab("City", 25); // cy.openTableTab("City", 25);
}); // });
beforeEach(() => { beforeEach(() => {
}); cy.restoreLocalStorage();
})
after(() => { afterEach(() => {
cy.closeTableTab("City"); cy.saveLocalStorage();
}); })
// after(() => {
// cy.closeTableTab("City");
// });
// Given rowname & expected result for first 10 entries, validate // Given rowname & expected result for first 10 entries, validate
// NOTE: Scroll issue with Cypress automation, to fix // NOTE: Scroll issue with Cypress automation, to fix
@ -157,6 +162,8 @@ export const genTest = (apiType, dbType) => {
} }
it("Formula: ADD, AVG, LEN", () => { it("Formula: ADD, AVG, LEN", () => {
cy.openTableTab("City", 25);
addFormulaBasedColumn( addFormulaBasedColumn(
"NC_MATH_0", "NC_MATH_0",
"ADD({CityId}, {CountryId}) + AVG({CityId}, {CountryId}) + LEN({City})" "ADD({CityId}, {CountryId}) + AVG({CityId}, {CountryId}) + LEN({City})"
@ -217,6 +224,8 @@ export const genTest = (apiType, dbType) => {
if (dbType === 'mysql') editColumnByName("NC_MATH_2", "NC_NOW", `NOW()`); if (dbType === 'mysql') editColumnByName("NC_MATH_2", "NC_NOW", `NOW()`);
else editColumnByName("NC_MATH_1", "NC_NOW", `NOW()`); else editColumnByName("NC_MATH_1", "NC_NOW", `NOW()`);
deleteColumnByName("NC_NOW"); deleteColumnByName("NC_NOW");
cy.closeTableTab("City");
}); });
}); });
}; };

44
scripts/cypress/integration/common/3c_lookup_column.js

@ -13,28 +13,32 @@ 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(); // cy.fileHook();
mainPage.tabReset(); // mainPage.tabReset();
// open a table to work on views // // open a table to work on views
// // //
//
// // kludge: wait for page load to finish // // // kludge: wait for page load to finish
// cy.wait(1000); // // cy.wait(1000);
// // close team & auth tab // // // close team & auth tab
// cy.get('button.ant-tabs-tab-remove').should('exist').click(); // // cy.get('button.ant-tabs-tab-remove').should('exist').click();
// cy.wait(1000); // // cy.wait(1000);
//
cy.openTableTab("City", 25); // cy.openTableTab("City", 25);
}); // });
beforeEach(() => { beforeEach(() => {
cy.fileHook(); cy.restoreLocalStorage();
}); });
after(() => { afterEach(() => {
cy.closeTableTab("City"); cy.saveLocalStorage();
}); })
// after(() => {
// cy.closeTableTab("City");
// });
// Routine to create a new look up column // Routine to create a new look up column
// //
@ -74,6 +78,8 @@ export const genTest = (apiType, dbType) => {
// Test case // Test case
it("Add Lookup column (Address, PostalCode) & Delete", () => { it("Add Lookup column (Address, PostalCode) & Delete", () => {
cy.openTableTab("City", 25);
addLookUpColumn("Address", "PostalCode"); addLookUpColumn("Address", "PostalCode");
// Verify first entry, will be displayed as alias here 'childColumn (from childTable)' // Verify first entry, will be displayed as alias here 'childColumn (from childTable)'
@ -82,6 +88,8 @@ export const genTest = (apiType, dbType) => {
.should("exist"); .should("exist");
deleteColumnByName("PostalCode"); deleteColumnByName("PostalCode");
cy.closeTableTab("City");
}); });
it.skip("Add Lookup column (Country, CountryId) & Delete", () => { it.skip("Add Lookup column (Country, CountryId) & Delete", () => {

46
scripts/cypress/integration/common/3d_rollup_column.js

@ -14,28 +14,32 @@ 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(); // cy.fileHook();
mainPage.tabReset(); // mainPage.tabReset();
//
// // kludge: wait for page load to finish // // // kludge: wait for page load to finish
// cy.wait(1000); // // cy.wait(1000);
// // close team & auth tab // // // close team & auth tab
// cy.get('button.ant-tabs-tab-remove').should('exist').click(); // // cy.get('button.ant-tabs-tab-remove').should('exist').click();
// cy.wait(1000); // // 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(); cy.restoreLocalStorage();
}); })
after(() => { afterEach(() => {
cy.closeTableTab("Country"); cy.saveLocalStorage();
}); })
// after(() => {
// cy.closeTableTab("Country");
// });
// Routine to create a new look up column // Routine to create a new look up column
// //
@ -106,6 +110,8 @@ export const genTest = (apiType, dbType) => {
// Test case // Test case
it("Add Rollup column (City, City, count) & Delete", () => { it("Add Rollup column (City, City, count) & Delete", () => {
cy.openTableTab("Country", 25);
addRollUpColumn("RollUpCol", "City", "City", "count"); addRollUpColumn("RollUpCol", "City", "City", "count");
// Verify first entry, will be displayed as alias here 'childColumn (from childTable)' // Verify first entry, will be displayed as alias here 'childColumn (from childTable)'
@ -116,6 +122,8 @@ export const genTest = (apiType, dbType) => {
// editColumnByName("RollUpCol_2", "RollUpCol_New"); // editColumnByName("RollUpCol_2", "RollUpCol_New");
deleteColumnByName("RollUpCol"); deleteColumnByName("RollUpCol");
cy.closeTableTab("Country");
}); });
it.skip("Add Rollup column (City, CountryId, count) & Delete", () => { it.skip("Add Rollup column (City, CountryId, count) & Delete", () => {

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

@ -103,15 +103,14 @@ export const genTest = (apiType, dbType) => {
cy.wait(1000); cy.wait(1000);
} }
before(() => { // before(() => {
// required for standalone test // // required for standalone test
// loginPage.loginAndOpenProject(apiType, dbType); // // loginPage.loginAndOpenProject(apiType, dbType);
// });
cy.createTable("Sheet1");
cy.createTable("Sheet2");
afterEach(() => {
cy.saveLocalStorage(); cy.saveLocalStorage();
}); })
beforeEach(() => { beforeEach(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
@ -120,6 +119,8 @@ export const genTest = (apiType, dbType) => {
after(() => { after(() => {
// Cleanup // Cleanup
// //
cy.restoreLocalStorage();
cy.openTableTab("Sheet1", 0); cy.openTableTab("Sheet1", 0);
mainPage.deleteColumn("Link1-2hm"); mainPage.deleteColumn("Link1-2hm");
mainPage.deleteColumn("Link1-2mm"); mainPage.deleteColumn("Link1-2mm");
@ -127,12 +128,16 @@ export const genTest = (apiType, dbType) => {
cy.deleteTable("Sheet1"); cy.deleteTable("Sheet1");
cy.deleteTable("Sheet2"); cy.deleteTable("Sheet2");
cy.saveLocalStorage();
}); });
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
// Test case // Test case
it("Create Link columns", () => { it("Create Link columns", () => {
cy.createTable("Sheet1");
cy.createTable("Sheet2");
cy.openTableTab("Sheet1", 0); cy.openTableTab("Sheet1", 0);
addRow(1, "1a"); addRow(1, "1a");
addRow(2, "1b"); addRow(2, "1b");

22
scripts/cypress/integration/common/4a_table_view_grid_gallery_form.js

@ -15,25 +15,24 @@ export const genTest = (apiType, dbType) => {
// //
before(() => { before(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(1000);
mainPage.tabReset();
// open a table to work on views // open a table to work on views
// //
cy.openTableTab("Country", 25); cy.openTableTab("Country", 25);
// toggle right navbar (open)
// cy.get('.nc-toggle-right-navbar').should('exist').click();
}); });
beforeEach(() => { beforeEach(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(1000); });
afterEach(() => {
cy.saveLocalStorage();
}); });
after(() => { after(() => {
cy.restoreLocalStorage();
cy.closeTableTab("Country"); cy.closeTableTab("Country");
cy.saveLocalStorage();
}); });
// Common routine to create/edit/delete GRID & GALLERY view // Common routine to create/edit/delete GRID & GALLERY view
@ -48,9 +47,6 @@ export const genTest = (apiType, dbType) => {
cy.getActiveModal(".nc-modal-view-create").find(".ant-btn-primary").click(); cy.getActiveModal(".nc-modal-view-create").find(".ant-btn-primary").click();
cy.toastWait("View created successfully"); cy.toastWait("View created successfully");
// kludge: right navbar closes abruptly. force it open again
// window.localStorage.setItem('nc-right-sidebar', '{"isOpen":true,"hasSidebar":true}')
// validate if view was created && contains default name 'Country1' // validate if view was created && contains default name 'Country1'
cy.get(`.nc-${viewType}-view-item`) cy.get(`.nc-${viewType}-view-item`)
.contains(`${capitalizeFirstLetter(viewType)}-1`) .contains(`${capitalizeFirstLetter(viewType)}-1`)
@ -67,9 +63,6 @@ export const genTest = (apiType, dbType) => {
.type(`${viewType}View-1{enter}`); .type(`${viewType}View-1{enter}`);
cy.toastWait("View renamed successfully"); cy.toastWait("View renamed successfully");
// kludge: right navbar closes abruptly. force it open again
// window.localStorage.setItem('nc-right-sidebar', '{"isOpen":true,"hasSidebar":true}')
// validate // validate
cy.get(`.nc-${viewType}-view-item`) cy.get(`.nc-${viewType}-view-item`)
.contains(`${viewType}View-1`) .contains(`${viewType}View-1`)
@ -86,9 +79,6 @@ export const genTest = (apiType, dbType) => {
cy.getActiveModal(".nc-modal-view-delete").find('.ant-btn-dangerous').click(); cy.getActiveModal(".nc-modal-view-delete").find('.ant-btn-dangerous').click();
cy.toastWait("View deleted successfully"); cy.toastWait("View deleted successfully");
// kludge: right navbar closes abruptly. force it open again
// window.localStorage.setItem('nc-right-sidebar', '{"isOpen":true,"hasSidebar":true}')
// confirm if the number of veiw entries is reduced by 1 // confirm if the number of veiw entries is reduced by 1
cy.get(".nc-view-item").its("length").should("eq", 1); cy.get(".nc-view-item").its("length").should("eq", 1);
}); });

38
scripts/cypress/integration/common/4b_table_view_share.js

@ -37,11 +37,24 @@ export const genTest = (apiType, dbType) => {
// //
before(() => { before(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(1000);
mainPage.tabReset();
cy.openTableTab("City", 25); cy.openTableTab("City", 25);
});
beforeEach(() => {
cy.restoreLocalStorage();
});
afterEach(() => {
cy.saveLocalStorage();
});
after(() => {
cy.restoreLocalStorage();
cy.closeTableTab("City");
cy.saveLocalStorage();
});
it("Generate link with password", () => {
// 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;
@ -51,12 +64,6 @@ export const genTest = (apiType, dbType) => {
cy.signOut(); cy.signOut();
}); });
beforeEach(() => {
});
afterEach(() => {
});
it("Share view with incorrect password", () => { it("Share view with incorrect password", () => {
cy.visit(linkText, { cy.visit(linkText, {
baseUrl: null, baseUrl: null,
@ -99,24 +106,11 @@ export const genTest = (apiType, dbType) => {
it("Delete view", () => { it("Delete view", () => {
loginPage.loginAndOpenProject(apiType, dbType); loginPage.loginAndOpenProject(apiType, dbType);
cy.openTableTab("City", 25); cy.openTableTab("City", 25);
cy.wait(500);
mainPage.toggleRightSidebar();
cy.wait(500);
cy.saveLocalStorage();
cy.wait(1000);
// wait for page load to complete // wait for page load to complete
cy.get(".nc-grid-row").should("have.length", 25); cy.get(".nc-grid-row").should("have.length", 25);
mainPage.deleteCreatedViews(); mainPage.deleteCreatedViews();
}); });
after(() => {
cy.restoreLocalStorage();
cy.wait(500);
cy.closeTableTab("City");
});
}); });
}; };

47
scripts/cypress/integration/common/4c_form_view_detailed.js

@ -58,37 +58,27 @@ export const genTest = (apiType, dbType) => {
// Run once before test- create project (rest/graphql) // Run once before test- create project (rest/graphql)
// //
before(() => { before(() => {
mainPage.tabReset(); // standalone test
// loginPage.loginAndOpenProject(apiType, dbType); // loginPage.loginAndOpenProject(apiType, dbType);
// kludge: wait for page load to finish
cy.wait(2000);
// 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.restoreLocalStorage();
cy.openTableTab("Country", 25); cy.openTableTab("Country", 25);
mainPage.toggleRightSidebar();
cy.saveLocalStorage();
cy.wait(500);
}); });
beforeEach(() => { beforeEach(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(500);
// fix me!
window.localStorage.setItem('nc-right-sidebar', '{"isOpen":true,"hasSidebar":true}')
}); });
afterEach(() => { afterEach(() => {
cy.saveLocalStorage();
}); });
after(() => { after(() => {
cy.restoreLocalStorage();
cy.closeTableTab("Country"); cy.closeTableTab("Country");
cy.saveLocalStorage();
}); });
// Common routine to create/edit/delete GRID & GALLERY view // Common routine to create/edit/delete GRID & GALLERY view
@ -96,6 +86,7 @@ export const genTest = (apiType, dbType) => {
// //
const viewTest = (viewType) => { const viewTest = (viewType) => {
it(`Create ${viewType} view`, () => { it(`Create ${viewType} view`, () => {
// click on 'Grid/Gallery' button on Views bar // click on 'Grid/Gallery' button on Views bar
cy.get(`.nc-create-${viewType}-view`).click(); cy.get(`.nc-create-${viewType}-view`).click();
@ -385,35 +376,9 @@ export const genTest = (apiType, dbType) => {
// validate if form has appeared again // validate if form has appeared again
validateFormHeader(); validateFormHeader();
// // verify URL & copy it for subsequent test
// cy.url().should("contain", `Country/Form-1`);
// cy.url().then((url) => {
// cy.log(url);
// formViewURL = url;
// });
//
// cy.wait(300);
}); });
// it.skip(`Validate ${viewType}: URL validation after re-access`, () => {
// // visit URL
// cy.log(formViewURL);
//
// cy.visit(formViewURL, {
// baseUrl: null,
// });
//
// // New form appeared? Header & description should exist
// validateFormHeader();
// });
it(`Delete ${viewType} view`, () => { it(`Delete ${viewType} view`, () => {
// cy.visit("/");
// cy.wait(5000);
// projectsPage.openConfiguredProject(apiType, dbType);
// cy.openTableTab("Country", 25);
// 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);

13
scripts/cypress/integration/common/4d_table_view_grid_locked.js

@ -9,24 +9,21 @@ export const genTest = (apiType, dbType) => {
// //
before(() => { before(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(500);
mainPage.tabReset();
// open a table to work on views
//
cy.openTableTab("Country", 25); cy.openTableTab("Country", 25);
}); });
beforeEach(() => { beforeEach(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(500); });
afterEach(() => {
cy.saveLocalStorage();
}); });
after(() => { after(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(500)
cy.closeTableTab("Country"); cy.closeTableTab("Country");
cy.saveLocalStorage();
}); });
const lockViewTest = (enabled) => { const lockViewTest = (enabled) => {

31
scripts/cypress/integration/common/4e_form_view_share.js

@ -14,30 +14,22 @@ export const genTest = (apiType, dbType) => {
// //
before(() => { before(() => {
// loginPage.loginAndOpenProject(apiType, dbType); // loginPage.loginAndOpenProject(apiType, dbType);
// cy.openTableTab("City", 25);
// cy.wait(500);
// mainPage.toggleRightSidebar();
// cy.wait(500);
// cy.saveLocalStorage();
// cy.wait(500);
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(500);
mainPage.tabReset();
// open a table to work on views
//
cy.openTableTab("City", 25); cy.openTableTab("City", 25);
}); });
beforeEach(() => { beforeEach(() => {
cy.restoreLocalStorage();
});
afterEach(() => {
cy.saveLocalStorage();
}); });
after(() => { after(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(500);
cy.closeTableTab("City"); cy.closeTableTab("City");
cy.saveLocalStorage();
}); });
// Common routine to create/edit/delete GRID & GALLERY view // Common routine to create/edit/delete GRID & GALLERY view
@ -46,9 +38,6 @@ export const genTest = (apiType, dbType) => {
const viewTest = (viewType) => { const viewTest = (viewType) => {
it(`Create ${viewType} view`, () => {0 it(`Create ${viewType} view`, () => {0
cy.restoreLocalStorage();
cy.wait(500);
// click on create grid view button // click on create grid view button
cy.get(`.nc-create-${viewType}-view`).click(); cy.get(`.nc-create-${viewType}-view`).click();
@ -97,9 +86,6 @@ export const genTest = (apiType, dbType) => {
it(`Share form view`, () => { it(`Share form view`, () => {
cy.restoreLocalStorage();
cy.wait(500);
cy.get(`.nc-view-item.nc-${viewType}-view-item`) cy.get(`.nc-view-item.nc-${viewType}-view-item`)
.contains("Form-1") .contains("Form-1")
.click(); .click();
@ -198,11 +184,6 @@ export const genTest = (apiType, dbType) => {
// go back to base page // go back to base page
loginPage.loginAndOpenProject(apiType, dbType); loginPage.loginAndOpenProject(apiType, dbType);
cy.openTableTab("City", 25); cy.openTableTab("City", 25);
cy.wait(500);
mainPage.toggleRightSidebar();
cy.wait(500);
cy.saveLocalStorage();
cy.wait(500);
// 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);

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

@ -42,33 +42,23 @@ export const genTest = (apiType, dbType) => {
// //
before(() => { before(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(500);
mainPage.tabReset();
cy.openTableTab("Address", 25); cy.openTableTab("Address", 25);
// loginPage.loginAndOpenProject(apiType, dbType);
//
// // open a table to work on views
// //
// cy.openTableTab("Address", 25);
// mainPage.toggleRightSidebar();
// //
// cy.saveLocalStorage();
}); });
beforeEach(() => { beforeEach(() => {
cy.restoreLocalStorage();
}); });
afterEach(() => { afterEach(() => {
cy.saveLocalStorage();
}); });
after(() => { after(() => {
// close table // close table
// mainPage.deleteCreatedViews() // mainPage.deleteCreatedViews()
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(500);
cy.closeTableTab("Address"); cy.closeTableTab("Address");
cy.saveLocalStorage();
}); });
// Common routine to create/edit/delete GRID & GALLERY view // Common routine to create/edit/delete GRID & GALLERY view
@ -77,9 +67,6 @@ export const genTest = (apiType, dbType) => {
const viewTest = (viewType) => { const viewTest = (viewType) => {
it(`Create ${viewType.toUpperCase()} view`, () => { it(`Create ${viewType.toUpperCase()} view`, () => {
cy.restoreLocalStorage();
cy.wait(500);
// create a normal public view // create a normal public view
cy.get(`.nc-create-${viewType}-view`).click(); cy.get(`.nc-create-${viewType}-view`).click();
cy.getActiveModal(".nc-modal-view-create").find("button:contains(Submit)").click(); cy.getActiveModal(".nc-modal-view-create").find("button:contains(Submit)").click();
@ -93,9 +80,6 @@ export const genTest = (apiType, dbType) => {
it(`Share ${viewType.toUpperCase()} hide, sort, filter & verify`, () => { it(`Share ${viewType.toUpperCase()} hide, sort, filter & verify`, () => {
cy.restoreLocalStorage();
cy.wait(500);
cy.get(`.nc-view-item.nc-${viewType}-view-item`) cy.get(`.nc-view-item.nc-${viewType}-view-item`)
.contains("Grid-1") .contains("Grid-1")
.click(); .click();
@ -108,9 +92,6 @@ export const genTest = (apiType, dbType) => {
it(`Share GRID view : ensure we have only one link even if shared multiple times`, () => { it(`Share GRID view : ensure we have only one link even if shared multiple times`, () => {
cy.restoreLocalStorage();
cy.wait(500);
// generate view link multiple times // generate view link multiple times
generateViewLink("combined"); generateViewLink("combined");
generateViewLink("combined"); generateViewLink("combined");
@ -364,11 +345,6 @@ export const genTest = (apiType, dbType) => {
loginPage.loginAndOpenProject(apiType, dbType); loginPage.loginAndOpenProject(apiType, dbType);
cy.openTableTab("Address", 25); cy.openTableTab("Address", 25);
mainPage.toggleRightSidebar();
cy.wait(500);
cy.saveLocalStorage();
cy.wait(500);
// 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);
@ -387,9 +363,7 @@ 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.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(500);
// 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);
@ -401,47 +375,21 @@ export const genTest = (apiType, dbType) => {
}); });
}); });
after(() => { beforeEach(() => {
// close table cy.restoreLocalStorage();
// cy.visit(storedURL, { });
// baseUrl: null,
// });
// cy.wait(5000);
loginPage.loginAndOpenProject(apiType, dbType); afterEach(() => {
cy.openTableTab("Country", 25)
cy.wait(500);
mainPage.toggleRightSidebar();
cy.wait(500);
cy.saveLocalStorage(); cy.saveLocalStorage();
cy.wait(500); });
// delete row
mainPage.getPagination(5).click();
// kludge: flicker on load
cy.wait(3000)
// wait for page rendering to complete
cy.get(".nc-grid-row").should("have.length", 10);
mainPage.getCell("Country", 10).rightclick();
cy.getActiveMenu(".nc-dropdown-grid-context-menu")
.find('.ant-dropdown-menu-item:contains("Delete Row")')
.first()
.click();
// delete column
mainPage.deleteColumn("dummy");
mainPage.deleteCreatedViews();
// close table after(() => {
cy.restoreLocalStorage();
cy.closeTableTab("Country"); cy.closeTableTab("Country");
cy.saveLocalStorage();
}); });
it(`Generate default Shared GRID view URL`, () => { it(`Generate default Shared GRID view URL`, () => {
cy.restoreLocalStorage();
cy.wait(500);
// add row // add row
cy.get(".nc-add-new-row-btn").click(); cy.get(".nc-add-new-row-btn").click();
cy.get(".nc-expand-col-Country").find(".nc-cell > input") cy.get(".nc-expand-col-Country").find(".nc-cell > input")
@ -488,6 +436,28 @@ export const genTest = (apiType, dbType) => {
// verify column headers // verify column headers
cy.get('[data-title="dummy"]').should("exist"); cy.get('[data-title="dummy"]').should("exist");
}); });
it(`Clean up`, () => {
loginPage.loginAndOpenProject(apiType, dbType);
cy.openTableTab("Country", 25)
// delete row
mainPage.getPagination(5).click();
// kludge: flicker on load
cy.wait(3000)
// wait for page rendering to complete
cy.get(".nc-grid-row").should("have.length", 10);
mainPage.getCell("Country", 10).rightclick();
cy.getActiveMenu(".nc-dropdown-grid-context-menu")
.find('.ant-dropdown-menu-item:contains("Delete Row")')
.first()
.click();
// delete column
mainPage.deleteColumn("dummy");
mainPage.deleteCreatedViews();
});
}); });
}; };

29
scripts/cypress/integration/common/5a_user_role.js

@ -23,25 +23,27 @@ export const genTest = (apiType, dbType) => {
describe("Static user creations (different roles)", () => { describe("Static user creations (different roles)", () => {
before(() => { before(() => {
mainPage.tabReset(); // standalone test
// loginPage.loginAndOpenProject(apiType, dbType);
// kludge: wait for page load to finish
cy.wait(4000);
// close team & auth tab
cy.get('button.ant-tabs-tab-remove').should('exist').click();
cy.wait(1000);
// open a table to work on views
//
cy.restoreLocalStorage();
settingsPage.openMenu(settingsPage.TEAM_N_AUTH) settingsPage.openMenu(settingsPage.TEAM_N_AUTH)
cy.saveLocalStorage();
}); });
beforeEach(() => { beforeEach(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
}); });
afterEach(() => {
cy.saveLocalStorage();
})
after(() => { after(() => {
cy.restoreLocalStorage();
cy.signOut(); cy.signOut();
cy.saveLocalStorage();
}); });
const addUser = (user) => { const addUser = (user) => {
@ -116,7 +118,7 @@ export const genTest = (apiType, dbType) => {
describe(`User role validation`, () => { describe(`User role validation`, () => {
before(() => { before(() => {
// cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.visit(mainPage.roleURL[roleType]) cy.visit(mainPage.roleURL[roleType])
cy.wait(5000); cy.wait(5000);
@ -175,9 +177,14 @@ export const genTest = (apiType, dbType) => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
}); });
afterEach(() => {
cy.saveLocalStorage();
})
after(() => { after(() => {
// sign out cy.restoreLocalStorage();
cy.signOut(); cy.signOut();
cy.saveLocalStorage();
}); });
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////

29
scripts/cypress/integration/common/6b_downloadCsv.js

@ -9,33 +9,22 @@ export const genTest = (apiType, dbType) => {
if (!isTestSuiteActive(apiType, dbType)) return; if (!isTestSuiteActive(apiType, dbType)) return;
describe(`${apiType.toUpperCase()} Upload/ Download CSV`, () => { describe(`${apiType.toUpperCase()} Upload/ Download CSV`, () => {
before(() => { // before(() => {
// // standalone test
// kludge: wait for page load to finish // // loginPage.loginAndOpenProject(apiType, dbType);
cy.wait(2000); // });
// close team & auth tab
cy.get('button.ant-tabs-tab-remove').should('exist').click();
cy.wait(1000);
cy.openTableTab("Country", 25);
cy.wait(1000);
cy.saveLocalStorage();
cy.wait(1000);
});
beforeEach(() => { beforeEach(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(1000);
}); });
after(() => { afterEach(() => {
cy.closeTableTab("Country");
cy.saveLocalStorage(); cy.saveLocalStorage();
cy.wait(1000); })
});
it("Download verification- base view, default columns", () => { it("Download verification- base view, default columns", () => {
cy.openTableTab("Country", 25);
mainPage.hideField("LastUpdate"); mainPage.hideField("LastUpdate");
const verifyCsv = (retrievedRecords) => { const verifyCsv = (retrievedRecords) => {
// expected output, statically configured // expected output, statically configured
@ -78,6 +67,8 @@ export const genTest = (apiType, dbType) => {
// download & verify // download & verify
mainPage.downloadAndVerifyCsv(`Country_exported_1.csv`, verifyCsv); mainPage.downloadAndVerifyCsv(`Country_exported_1.csv`, verifyCsv);
mainPage.unhideField("LastUpdate"); mainPage.unhideField("LastUpdate");
cy.closeTableTab("Country");
}); });
}); });
}; };

13
scripts/cypress/integration/common/6d_language_validation.js

@ -8,26 +8,27 @@ export const genTest = (apiType, dbType) => {
describe(`Language support`, () => { describe(`Language support`, () => {
before(() => { before(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(1000);
cy.visit("/") cy.visit("/")
cy.wait(5000); cy.wait(5000);
cy.saveLocalStorage();
cy.wait(1000);
}); });
beforeEach(() => { beforeEach(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(1000); })
});
afterEach(() => {
cy.saveLocalStorage();
})
after(() => { after(() => {
cy.restoreLocalStorage();
cy.get('.nc-menu-accounts').should('exist').click(); cy.get('.nc-menu-accounts').should('exist').click();
cy.getActiveMenu('.nc-dropdown-user-accounts-menu').find('.ant-dropdown-menu-item').eq(1).click(); cy.getActiveMenu('.nc-dropdown-user-accounts-menu').find('.ant-dropdown-menu-item').eq(1).click();
cy.wait(5000); cy.wait(5000);
cy.get('button:contains("SIGN")').should('exist') cy.get('button:contains("SIGN")').should('exist')
cy.saveLocalStorage();
}) })
const langVerification = (idx, lang) => { const langVerification = (idx, lang) => {

11
scripts/cypress/integration/common/6e_project_operations.js

@ -8,13 +8,18 @@ export const genTest = (apiType, dbType) => {
before(() => { before(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(1000);
// loginPage.signIn(roles.owner.credentials);
cy.visit("/"); cy.visit("/");
cy.wait(4000); cy.wait(4000);
}); });
beforeEach(() => {
cy.restoreLocalStorage();
})
afterEach(() => {
cy.saveLocalStorage();
})
it("Delete Project", () => { it("Delete Project", () => {
cy.get(`.nc-action-btn`) cy.get(`.nc-action-btn`)

28
scripts/cypress/integration/common/6f_attachments.js

@ -9,20 +9,19 @@ export const genTest = (apiType, dbType) => {
before(() => { before(() => {
loginPage.loginAndOpenProject(apiType, dbType); loginPage.loginAndOpenProject(apiType, dbType);
cy.openTableTab("Country", 25); cy.openTableTab("Country", 25);
cy.wait(1000);
cy.saveLocalStorage(); cy.saveLocalStorage();
cy.wait(1000);
}); });
beforeEach(() => { beforeEach(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(1000); })
});
afterEach(() => {
cy.saveLocalStorage();
})
after(() => { after(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(1000);
// clean up // clean up
mainPage.deleteColumn("testAttach"); mainPage.deleteColumn("testAttach");
@ -44,6 +43,7 @@ export const genTest = (apiType, dbType) => {
cy.getActiveMenu(".nc-dropdown-grid-context-menu").contains("Delete Row").click(); cy.getActiveMenu(".nc-dropdown-grid-context-menu").contains("Delete Row").click();
cy.closeTableTab("Country"); cy.closeTableTab("Country");
cy.saveLocalStorage();
}); });
it(`Add column of type attachments`, () => { it(`Add column of type attachments`, () => {
@ -62,9 +62,8 @@ export const genTest = (apiType, dbType) => {
}); });
it(`Form view with Attachment field- Submit & verify`, () => { it(`Form view with Attachment field- Submit & verify`, () => {
// // open right navbar
// open right navbar // cy.get('.nc-toggle-right-navbar').should('exist').click();
cy.get('.nc-toggle-right-navbar').should('exist').click();
// create form-view // create form-view
cy.get(`.nc-create-form-view`).click(); cy.get(`.nc-create-form-view`).click();
@ -85,6 +84,8 @@ export const genTest = (apiType, dbType) => {
let linkText = $obj.text().trim(); let linkText = $obj.text().trim();
cy.log(linkText); cy.log(linkText);
cy.signOut();
cy.visit(linkText, { cy.visit(linkText, {
baseUrl: null, baseUrl: null,
}); });
@ -101,7 +102,6 @@ export const genTest = (apiType, dbType) => {
cy.get('.ant-picker-dropdown').find(".ant-picker-now-btn").click(); cy.get('.ant-picker-dropdown').find(".ant-picker-now-btn").click();
cy.get('.ant-picker-dropdown').find("button.ant-btn-primary").click(); cy.get('.ant-picker-dropdown').find("button.ant-btn-primary").click();
cy.get('.nc-attachment-cell') cy.get('.nc-attachment-cell')
.attachFile(`sampleFiles/1.json`, { subjectType: 'drag-n-drop' }); .attachFile(`sampleFiles/1.json`, { subjectType: 'drag-n-drop' });
@ -117,11 +117,11 @@ export const genTest = (apiType, dbType) => {
it(`Filter column which contain only attachments, download CSV`, () => { it(`Filter column which contain only attachments, download CSV`, () => {
// come back to main window // come back to main window
// loginPage.loginAndOpenProject(apiType, dbType); loginPage.loginAndOpenProject(apiType, dbType);
cy.visit('/') // cy.visit('/')
cy.wait(5000) // cy.wait(5000)
// projectsPage.openConfiguredProject(apiType, dbType);
projectsPage.openConfiguredProject(apiType, dbType);
cy.openTableTab("Country", 25); cy.openTableTab("Country", 25);
cy.wait(1000); cy.wait(1000);

26
scripts/cypress/integration/common/6g_base_share.js

@ -57,20 +57,21 @@ export const genTest = (apiType, dbType) => {
describe(`${apiType.toUpperCase()} Base VIEW share`, () => { describe(`${apiType.toUpperCase()} Base VIEW share`, () => {
before(() => { before(() => {
loginPage.loginAndOpenProject(apiType, dbType); // loginPage.loginAndOpenProject(apiType, dbType);
cy.restoreLocalStorage();
cy.openTableTab("Country", 25); cy.openTableTab("Country", 25);
cy.wait(1000);
cy.saveLocalStorage(); cy.saveLocalStorage();
cy.wait(1000);
}); });
it(`Generate base share URL`, () => { beforeEach(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(1000); })
afterEach(() => {
cy.saveLocalStorage();
})
it(`Generate base share URL`, () => {
// click SHARE // click SHARE
cy.get(".nc-share-base:visible").should('exist').click(); cy.get(".nc-share-base:visible").should('exist').click();
@ -121,10 +122,6 @@ style="background: transparent; "></iframe>
cy.log(linkText); cy.log(linkText);
cy.signOut(); cy.signOut();
cy.deleteLocalStorage();
cy.wait(1000);
cy.printLocalStorage();
}); });
permissionValidation("viewer"); permissionValidation("viewer");
@ -143,10 +140,6 @@ style="background: transparent; "></iframe>
.click(); .click();
cy.signOut(); cy.signOut();
cy.deleteLocalStorage();
cy.wait(1000);
cy.printLocalStorage();
}); });
permissionValidation("editor"); permissionValidation("editor");
@ -178,7 +171,6 @@ style="background: transparent; "></iframe>
// validate data (row-1) // validate data (row-1)
cy.iframe().find(`.nc-grid-cell`).eq(1).contains("PENELOPE").should("exist"); cy.iframe().find(`.nc-grid-cell`).eq(1).contains("PENELOPE").should("exist");
cy.iframe().find(`.nc-grid-cell`).eq(2).contains("GUINESS").should("exist"); cy.iframe().find(`.nc-grid-cell`).eq(2).contains("GUINESS").should("exist");
}); });
}) })
} }

28
scripts/cypress/integration/common/7a_create_project_from_excel.js

@ -68,11 +68,9 @@ export const genTest = (apiType, dbType) => {
describe(`Import from excel`, () => { describe(`Import from excel`, () => {
before(() => { before(() => {
// loginPage.signIn(roles.owner.credentials); // loginPage.signIn(roles.owner.credentials);
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(1000);
cy.task("readSheetList", { cy.task("readSheetList", {
file: `./scripts/cypress/fixtures/${filepath}`, file: `./scripts/cypress/fixtures/${filepath}`,
@ -89,19 +87,21 @@ export const genTest = (apiType, dbType) => {
sheetData = rows; sheetData = rows;
}); });
// loginPage.signIn(roles.owner.credentials); cy.visit("/")
projectsPage.createProject({ dbType: "none", apiType: "REST", name: "importSample" }, {}) projectsPage.createProject({ dbType: "none", apiType: "REST", name: "importSample" }, {})
cy.wait(4000); cy.wait(4000);
cy.saveLocalStorage(); cy.saveLocalStorage();
cy.wait(1000);
}); });
beforeEach(() => { beforeEach(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(1000);
}); });
afterEach(() => {
cy.saveLocalStorage();
})
it("File Upload: Upload excel as template", () => { it("File Upload: Upload excel as template", () => {
cy.get('.nc-add-new-table').should('exist').trigger('mouseover') cy.get('.nc-add-new-table').should('exist').trigger('mouseover')
@ -265,24 +265,6 @@ export const genTest = (apiType, dbType) => {
} }
cy.closeTableTab("Sheet1"); cy.closeTableTab("Sheet1");
}); });
after(() => {
// delete project once all operations are completed
// mainPage.toolBarTopLeft(mainPage.HOME).click();
// projectsPage.deleteProject("importSample");
// cy.get('.nc-noco-brand-icon').click();
//
// cy.get(`.nc-action-btn`)
// .should("exist")
// .last()
// .click();
//
// cy.getActiveModal()
// .find(".ant-btn-dangerous")
// .should("exist")
// .click();
});
}); });
}; };

11
scripts/cypress/integration/common/7b_import_from_airtable.js

@ -18,12 +18,21 @@ export const genTest = (apiType, dbType) => {
loginPage.signIn(roles.owner.credentials); loginPage.signIn(roles.owner.credentials);
projectsPage.createProject({ dbType: "none", apiType: "REST", name: "importSample" }, {}) projectsPage.createProject({ dbType: "none", apiType: "REST", name: "importSample" }, {})
cy.saveLocalStorage();
});
beforeEach(() => {
cy.restoreLocalStorage();
}); });
after(() => { afterEach(() => {
cy.saveLocalStorage(); cy.saveLocalStorage();
}); });
// after(() => {
// cy.saveLocalStorage();
// });
it("Import", () => { it("Import", () => {
cy.log(apiKey, sharedBase); cy.log(apiKey, sharedBase);

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

@ -228,20 +228,21 @@ export const genTest = (apiType, dbType) => {
before(() => { before(() => {
loginPage.loginAndOpenProject(apiType, dbType); loginPage.loginAndOpenProject(apiType, dbType);
cy.createTable("Temp"); cy.createTable("Temp");
cy.wait(1000);
cy.saveLocalStorage(); cy.saveLocalStorage();
}); });
beforeEach(() => { beforeEach(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
cy.wait(1000);
}); });
afterEach(() => {
cy.saveLocalStorage();
})
after(() => { after(() => {
cy.restoreLocalStorage();
cy.deleteTable("Temp"); cy.deleteTable("Temp");
cy.saveLocalStorage(); cy.saveLocalStorage();
cy.wait(1000);
}); });
it("Create: 'After Insert' event", () => { it("Create: 'After Insert' event", () => {

27
scripts/cypress/integration/common/9a_QuickTest.js

@ -81,8 +81,6 @@ export const genTest = (apiType, dbType, testMode) => {
} }
before(() => { before(() => {
cy.restoreLocalStorage();
if( testMode === 'CY_QUICK') { if( testMode === 'CY_QUICK') {
// cy.task("copyFile") // cy.task("copyFile")
loginPage.signIn(roles.owner.credentials); loginPage.signIn(roles.owner.credentials);
@ -93,28 +91,31 @@ export const genTest = (apiType, dbType, testMode) => {
// close team & auth tab // close team & auth tab
cy.get('button.ant-tabs-tab-remove').should('exist').click(); cy.get('button.ant-tabs-tab-remove').should('exist').click();
cy.wait(1000); cy.wait(1000);
cy.saveLocalStorage();
} }
else {
cy.restoreLocalStorage();
}
cy.openTableTab("Film", 3)
cy.saveLocalStorage();
}); });
beforeEach(() => { beforeEach(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
}) })
// afterEach(() => { afterEach(() => {
// cy.saveLocalStorage(); cy.saveLocalStorage();
// }) })
after(() => { after(() => {
cy.restoreLocalStorage(); cy.restoreLocalStorage();
// sign out
cy.signOut(); cy.signOut();
cy.saveLocalStorage();
}); });
it("Verify Schema", () => { it("Verify Schema", () => {
cy.openTableTab("Film", 3)
// verify if all tables exist // verify if all tables exist
for(let i=0; i<tn.length; i++) { for(let i=0; i<tn.length; i++) {
@ -129,7 +130,6 @@ export const genTest = (apiType, dbType, testMode) => {
}); });
it("Verify Data types", () => { it("Verify Data types", () => {
cy.openTableTab("Film", 3);
// normal cells // normal cells
for (let [key, value] of Object.entries(records)) { for (let [key, value] of Object.entries(records)) {
@ -188,12 +188,9 @@ export const genTest = (apiType, dbType, testMode) => {
mainPage.getCell("Producer", cellIdx).find('.chip').eq(1).contains(records2.Producer[1]).should('exist') mainPage.getCell("Producer", cellIdx).find('.chip').eq(1).contains(records2.Producer[1]).should('exist')
} }
cy.closeTableTab("Film");
}); });
it("Verify Views & Shared base", () => { it("Verify Views & Shared base", () => {
cy.openTableTab("Film", 3);
mainPage.toggleRightSidebar();
cy.get('.nc-form-view-item:visible') cy.get('.nc-form-view-item:visible')
.should('exist') .should('exist')
.eq(0) .eq(0)
@ -333,7 +330,6 @@ export const genTest = (apiType, dbType, testMode) => {
it("Verify Fields, Filter & Sort", () => { it("Verify Fields, Filter & Sort", () => {
cy.openTableTab("Actor", 25); cy.openTableTab("Actor", 25);
mainPage.toggleRightSidebar();
cy.get(".nc-grid-view-item").eq(1).click() cy.get(".nc-grid-view-item").eq(1).click()
@ -387,7 +383,6 @@ export const genTest = (apiType, dbType, testMode) => {
if( testMode === 'CY_QUICK') { if( testMode === 'CY_QUICK') {
cy.openTableTab("Producer", 3) cy.openTableTab("Producer", 3)
mainPage.toggleRightSidebar();
cy.get('.nc-grid-view-item').should('have.length', 4) cy.get('.nc-grid-view-item').should('have.length', 4)
cy.get('.nc-form-view-item').should('have.length', 4) cy.get('.nc-form-view-item').should('have.length', 4)

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

@ -221,13 +221,6 @@ export function _viewMenu(roleType, mode) {
cy.openTableTab(columnName, 25); cy.openTableTab(columnName, 25);
cy.get('.nc-toggle-right-navbar').click();
cy.wait(1000);
// hard-wire
// window.localStorage.setItem('nc-right-sidebar', '{"isOpen":true,"hasSidebar":true}')
let validationString = let validationString =
true === roles[roleType].validations.shareView ? "exist" : "not.exist"; true === roles[roleType].validations.shareView ? "exist" : "not.exist";

20
scripts/cypress/support/commands.js

@ -235,39 +235,19 @@ let LOCAL_STORAGE_MEMORY = {};
let LOCAL_STORAGE_MEMORY_v2 = {}; let LOCAL_STORAGE_MEMORY_v2 = {};
Cypress.Commands.add('saveLocalStorage', (name) => { Cypress.Commands.add('saveLocalStorage', (name) => {
if (name) {
cy.task('log', `[saveLocalStorage] ${name}`);
LOCAL_STORAGE_MEMORY_v2[name] = {};
Object.keys(localStorage).forEach((key) => {
LOCAL_STORAGE_MEMORY_v2[name][key] = localStorage[key];
});
return;
}
LOCAL_STORAGE_MEMORY = {}; LOCAL_STORAGE_MEMORY = {};
Object.keys(localStorage).forEach((key) => { Object.keys(localStorage).forEach((key) => {
LOCAL_STORAGE_MEMORY[key] = localStorage[key]; LOCAL_STORAGE_MEMORY[key] = localStorage[key];
}); });
cy.printLocalStorage(); cy.printLocalStorage();
}); });
Cypress.Commands.add('restoreLocalStorage', (name) => { Cypress.Commands.add('restoreLocalStorage', (name) => {
if (name) {
cy.task('log', `[restoreLocalStorage] ${name}`);
Object.keys(LOCAL_STORAGE_MEMORY_v2[name]).forEach((key) => {
localStorage.setItem(key, LOCAL_STORAGE_MEMORY_v2[name][key]);
});
return;
}
cy.deleteLocalStorage().then(() => {
Object.keys(LOCAL_STORAGE_MEMORY).forEach((key) => { Object.keys(LOCAL_STORAGE_MEMORY).forEach((key) => {
localStorage.setItem(key, LOCAL_STORAGE_MEMORY[key]); localStorage.setItem(key, LOCAL_STORAGE_MEMORY[key]);
}); });
cy.printLocalStorage(); cy.printLocalStorage();
});
}); });
Cypress.Commands.add('deleteLocalStorage', () => { Cypress.Commands.add('deleteLocalStorage', () => {

Loading…
Cancel
Save