Browse Source

test: cy wait cleanup

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/3807/head
Raju Udava 2 years ago
parent
commit
9b1d2c8fbd
  1. 5
      scripts/cypress/integration/common/00_pre_configurations.js
  2. 6
      scripts/cypress/integration/common/1a_table_operations.js
  3. 1
      scripts/cypress/integration/common/1b_table_column_operations.js
  4. 2
      scripts/cypress/integration/common/2b_table_with_m2m_column.js
  5. 11
      scripts/cypress/integration/common/3a_filter_sort_fields_operations.js
  6. 3
      scripts/cypress/integration/common/3c_lookup_column.js
  7. 4
      scripts/cypress/integration/common/3d_rollup_column.js
  8. 2
      scripts/cypress/integration/common/4a_table_view_grid_gallery_form.js
  9. 6
      scripts/cypress/integration/common/4c_form_view_detailed.js
  10. 11
      scripts/cypress/support/commands.js
  11. 19
      scripts/cypress/support/page_objects/mainPage.js
  12. 10
      scripts/cypress/support/page_objects/navigation.js

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

@ -241,10 +241,11 @@ export const genTest = (apiType, dbType) => {
} }
// kludge: wait for page load to finish // kludge: wait for page load to finish
cy.wait(2000); // cy.wait(2000);
// 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.get("button.ant-tabs-tab-remove").should("not.exist");
// cy.wait(1000);
// first instance of updating local storage information // first instance of updating local storage information
cy.saveLocalStorage(); cy.saveLocalStorage();

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

@ -44,13 +44,17 @@ export const genTest = (apiType, dbType) => {
}; };
it("Open Audit tab", () => { it("Open Audit tab", () => {
// http://localhost:8080/api/v1/db/meta/projects/p_bxp57hmks0n5o2/audits?offset=0&limit=25
cy.intercept("/**/audits?offset=*&limit=*").as("waitForPageLoad");
// mainPage.navigationDraw(mainPage.AUDIT).click(); // mainPage.navigationDraw(mainPage.AUDIT).click();
settingsPage.openMenu(settingsPage.AUDIT); settingsPage.openMenu(settingsPage.AUDIT);
// wait for column headers to appear // wait for column headers to appear
// //
cy.get("thead > tr > th.ant-table-cell").should("have.length", 5); cy.get("thead > tr > th.ant-table-cell").should("have.length", 5);
cy.wait(3000); // cy.wait(1000);
cy.wait("@waitForPageLoad");
// Audit table entries // Audit table entries
// [Header] Operation Type, Operation Sub Type, Description, User, Created // [Header] Operation Type, Operation Sub Type, Description, User, Created

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

@ -73,6 +73,7 @@ export const genTest = (apiType, dbType) => {
.click(); .click();
// fix me! wait till the modal rendering (input highlight) is completed // fix me! wait till the modal rendering (input highlight) is completed
// focus shifts back to the input field to select text after the dropdown is rendered
cy.wait(500); cy.wait(500);
// change column type and verify // change column type and verify

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

@ -108,7 +108,7 @@ export const genTest = (apiType, dbType) => {
.click() .click()
.then(() => { .then(() => {
// wait to ensure pop up appears before we proceed further // wait to ensure pop up appears before we proceed further
cy.wait(1000); // cy.wait(1000);
// Link card validation // Link card validation
cy.getActiveDrawer(".nc-drawer-expanded-form") cy.getActiveDrawer(".nc-drawer-expanded-form")
.find(".text-lg") .find(".text-lg")

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

@ -46,9 +46,14 @@ export const genTest = (apiType, dbType) => {
// create new row using + button in header // create new row using + button in header
// //
it("Add row using tool header button", () => { it("Add row using tool header button", () => {
// http://localhost:8080/api/v1/db/meta/audits/comments/count?ids[]=101&ids[]=102&ids[]=103&ids[]=104&ids[]=105&ids[]=106&ids[]=107&ids[]=108&ids[]=109&fk_model_id=md_zfkb9v3mzky958
cy.intercept("/api/v1/db/meta/audits/comments/count").as(
"waitForPageLoad"
);
// add a row to end of Country table // add a row to end of Country table
cy.get(".nc-add-new-row-btn").click(); cy.get(".nc-add-new-row-btn").click();
cy.wait(1000); // cy.wait(1000);
cy.get(".nc-expand-col-Country") cy.get(".nc-expand-col-Country")
.find(".nc-cell > input") .find(".nc-cell > input")
.first() .first()
@ -74,7 +79,9 @@ export const genTest = (apiType, dbType) => {
// verify // verify
mainPage.getPagination(5).click(); mainPage.getPagination(5).click();
// kludge: flicker on load // kludge: flicker on load
cy.wait(3000); // cy.wait(3000);
cy.wait("@waitForPageLoad");
mainPage.getCell("Country", 10).contains("Test Country").should("exist"); mainPage.getCell("Country", 10).contains("Test Country").should("exist");
}); });

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

@ -63,7 +63,8 @@ export const genTest = (apiType, dbType) => {
.contains("Lookup") .contains("Lookup")
.click(); .click();
// wait for re-rendering & title selection to re-appear // fix me! wait till the modal rendering (input highlight) is completed
// focus shifts back to the input field to select text after the dropdown is rendered
cy.wait(500); cy.wait(500);
// Configure Child table & column names // Configure Child table & column names

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

@ -9,7 +9,6 @@ export const genTest = (apiType, dbType) => {
// //
const fetchParentFromLabel = (label) => { const fetchParentFromLabel = (label) => {
cy.get("label").contains(label).parents(".ant-row").click(); cy.get("label").contains(label).parents(".ant-row").click();
cy.wait(500);
}; };
// Run once before test- create project (rest/graphql) // Run once before test- create project (rest/graphql)
@ -69,7 +68,8 @@ export const genTest = (apiType, dbType) => {
.contains("Rollup") .contains("Rollup")
.click(); .click();
// wait for re-rendering & title selection to re-appear // fix me! wait till the modal rendering (input highlight) is completed
// focus shifts back to the input field to select text after the dropdown is rendered
cy.wait(500); cy.wait(500);
// Configure Child table & column names // Configure Child table & column names

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

@ -77,7 +77,7 @@ export const genTest = (apiType, dbType) => {
// 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(300); // cy.wait(300);
cy.getActiveModal(".nc-modal-view-delete") cy.getActiveModal(".nc-modal-view-delete")
.find(".ant-btn-dangerous") .find(".ant-btn-dangerous")
.click(); .click();

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

@ -324,7 +324,7 @@ export const genTest = (apiType, dbType) => {
// open form view & enable "email me" option // open form view & enable "email me" option
cy.openTableTab("Country", 25); cy.openTableTab("Country", 25);
cy.wait(1000); // cy.wait(1000);
cy.get(`.nc-view-item.nc-${viewType}-view-item`) cy.get(`.nc-view-item.nc-${viewType}-view-item`)
.contains("Form-1") .contains("Form-1")
@ -338,7 +338,7 @@ export const genTest = (apiType, dbType) => {
settingsPage.openMenu(settingsPage.APPSTORE); settingsPage.openMenu(settingsPage.APPSTORE);
mainPage.resetSMTP(); mainPage.resetSMTP();
cy.wait(300); // cy.wait(300);
cy.openTableTab("Country", 25); cy.openTableTab("Country", 25);
}); });
@ -383,7 +383,7 @@ export const genTest = (apiType, dbType) => {
// 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.wait(1000);
cy.getActiveModal(".nc-modal-view-delete") cy.getActiveModal(".nc-modal-view-delete")
.find(".ant-btn-dangerous") .find(".ant-btn-dangerous")
.click(); .click();

11
scripts/cypress/support/commands.js

@ -288,9 +288,7 @@ Cypress.Commands.add("getActivePicker", (dropdownSelector) => {
Cypress.Commands.add("createTable", (name) => { Cypress.Commands.add("createTable", (name) => {
cy.task("log", `[createTableTab] ${name}`); cy.task("log", `[createTableTab] ${name}`);
cy.wait(1000);
cy.get(".nc-add-new-table").should("exist").click(); cy.get(".nc-add-new-table").should("exist").click();
cy.wait(1000);
cy.getActiveModal(".nc-modal-table-create") cy.getActiveModal(".nc-modal-table-create")
.find(`input[type="text"]:visible`) .find(`input[type="text"]:visible`)
.click() .click()
@ -300,12 +298,9 @@ Cypress.Commands.add("createTable", (name) => {
cy.getActiveModal(".nc-modal-table-create") cy.getActiveModal(".nc-modal-table-create")
.find("button.ant-btn-primary:visible") .find("button.ant-btn-primary:visible")
.click(); .click();
cy.wait(1000);
cy.get(".xc-row-table.nc-grid").should("exist"); cy.get(".xc-row-table.nc-grid").should("exist");
// cy.get('.ant-tabs-tab-active > .ant-tabs-tab-btn').contains(name).should("exist");
cy.url().should("contain", `table/${name}`); cy.url().should("contain", `table/${name}`);
cy.get(`.nc-project-tree-tbl-${name}`).should("exist"); cy.get(`.nc-project-tree-tbl-${name}`).should("exist");
cy.wait(1000);
}); });
Cypress.Commands.add("deleteTable", (name, dbType) => { Cypress.Commands.add("deleteTable", (name, dbType) => {
@ -426,7 +421,7 @@ Cypress.Commands.add("snip", (filename) => {
) { ) {
let storeName = `${screenShotDb.length}_${filename}`; let storeName = `${screenShotDb.length}_${filename}`;
screenShotDb.push(filename); screenShotDb.push(filename);
cy.wait(1000); // cy.wait(1000);
cy.screenshot(storeName, { overwrite: true }); cy.screenshot(storeName, { overwrite: true });
} }
}); });
@ -439,7 +434,7 @@ Cypress.Commands.add("snipActiveModal", (filename) => {
) { ) {
let storeName = `${screenShotDb.length}_${filename}`; let storeName = `${screenShotDb.length}_${filename}`;
screenShotDb.push(filename); screenShotDb.push(filename);
cy.wait(1000); // cy.wait(1000);
// cy.getActiveModal().screenshot(filename, { // cy.getActiveModal().screenshot(filename, {
// padding: 0, // padding: 0,
// overwrite: true, // overwrite: true,
@ -456,7 +451,7 @@ Cypress.Commands.add("snipActiveMenu", (filename) => {
) { ) {
let storeName = `${screenShotDb.length}_${filename}`; let storeName = `${screenShotDb.length}_${filename}`;
screenShotDb.push(filename); screenShotDb.push(filename);
cy.wait(1000); // cy.wait(1000);
// cy.getActiveMenu().screenshot(filename, { // cy.getActiveMenu().screenshot(filename, {
// padding: 0, // padding: 0,
// overwrite: true, // overwrite: true,

19
scripts/cypress/support/page_objects/mainPage.js

@ -126,10 +126,9 @@ export class _mainPage {
cy.getActiveModal(".nc-modal-invite-user-and-share-base") cy.getActiveModal(".nc-modal-invite-user-and-share-base")
.find('input[placeholder="E-mail"]') .find('input[placeholder="E-mail"]')
.should("exist"); .should("exist");
cy.wait(1000); // cy.wait(1000);
cy.get('input[placeholder="E-mail"]').type(userCred.username);
cy.get('input[placeholder="E-mail"]:visible').type(userCred.username);
cy.get(".ant-select.nc-user-roles").click(); cy.get(".ant-select.nc-user-roles").click();
// opt-in requested role & submit // opt-in requested role & submit
@ -518,9 +517,8 @@ export class _mainPage {
.find(".nc-project-menu-item") .find(".nc-project-menu-item")
.contains("Download") .contains("Download")
.click(); .click();
cy.wait(1000); // cy.wait(1000);
cy.get(".nc-project-menu-item") cy.get(".nc-project-menu-item:contains('Download as CSV')")
.contains("Download as CSV")
.should("exist") .should("exist")
.click(); .click();
} }
@ -593,9 +591,14 @@ export class _mainPage {
} }
metaSyncValidate(tbl, msg) { metaSyncValidate(tbl, msg) {
// http://localhost:8080/api/v1/db/meta/projects/p_bxp57hmks0n5o2/meta-diff
cy.intercept("GET", "/api/v1/db/meta/projects/*").as("metaSync");
cy.get(".nc-btn-metasync-reload").should("exist").click(); cy.get(".nc-btn-metasync-reload").should("exist").click();
cy.wait(2000); // cy.wait(2000);
cy.get(`.nc-metasync-row-${tbl}`).contains(msg).should("exist"); cy.wait("@metaSync");
cy.get(`.nc-metasync-row-${tbl}:contains(${msg})`).should("exist");
cy.get(".nc-btn-metasync-sync-now") cy.get(".nc-btn-metasync-sync-now")
.should("exist") .should("exist")
.click() .click()

10
scripts/cypress/support/page_objects/navigation.js

@ -114,7 +114,8 @@ export class _projectsPage {
// 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.get("button.ant-tabs-tab-remove").should("not.exist");
// cy.wait(1000);
} }
// Open existing project // Open existing project
@ -155,6 +156,8 @@ export class _projectsPage {
cy.get(".nc-metadb-project-name").should("exist"); cy.get(".nc-metadb-project-name").should("exist");
cy.contains("button", "Create").should("exist"); cy.contains("button", "Create").should("exist");
// fix me! wait till the modal rendering (input highlight) is completed
// focus shifts back to the input field to select text after the dropdown is rendered
cy.wait(1000); cy.wait(1000);
// feed project name // feed project name
@ -185,7 +188,8 @@ export class _projectsPage {
cy.get(".nc-extdb-proj-name").should("exist"); cy.get(".nc-extdb-proj-name").should("exist");
cy.get(".nc-extdb-btn-test-connection").should("exist"); cy.get(".nc-extdb-btn-test-connection").should("exist");
// CY goes too fast at times, so wait for the page to load // fix me! wait till the modal rendering (input highlight) is completed
// focus shifts back to the input field to select text after the dropdown is rendered
cy.wait(1000); cy.wait(1000);
cy.get(".nc-extdb-proj-name").clear().type(projectName); cy.get(".nc-extdb-proj-name").clear().type(projectName);
@ -208,7 +212,7 @@ export class _projectsPage {
// Create project // Create project
cy.contains("Ok & Save Project", { timeout: 20000 }).click(); cy.contains("Ok & Save Project", { timeout: 20000 }).click();
cy.wait(5000); // cy.wait(5000);
// takes a while to load project // takes a while to load project
this.waitHomePageLoad(); this.waitHomePageLoad();

Loading…
Cancel
Save