From 8df7d8423c7ae1f568294c88c168161c21377282 Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Fri, 21 Oct 2022 13:29:19 +0200 Subject: [PATCH] tests: reduce test flakiness --- .../integration/common/1a_table_operations.js | 58 ++++++++++--------- .../common/1b_table_column_operations.js | 15 +---- 2 files changed, 34 insertions(+), 39 deletions(-) diff --git a/scripts/cypress/integration/common/1a_table_operations.js b/scripts/cypress/integration/common/1a_table_operations.js index 962e206eec..3891da4841 100644 --- a/scripts/cypress/integration/common/1a_table_operations.js +++ b/scripts/cypress/integration/common/1a_table_operations.js @@ -43,33 +43,37 @@ export const genTest = (apiType, dbType) => { return cy.get("tbody > tr").eq(row).find("td.ant-table-cell").eq(col); }; - 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(); - settingsPage.openMenu(settingsPage.AUDIT); - // wait for column headers to appear - // - cy.get("thead > tr > th.ant-table-cell").should("have.length", 5); - - cy.wait("@waitForPageLoad"); - - // Audit table entries - // [Header] Operation Type, Operation Sub Type, Description, User, Created - // [0] TABLE, DELETED, delete table table-x, user@nocodb.com, ... - // [1] TABLE, Created, created table table-x, user@nocodb.com, ... - - getAuditCell(0, 0).contains("TABLE").should("exist"); - getAuditCell(0, 1).contains("DELETED").should("exist"); - getAuditCell(0, 3).contains("user@nocodb.com").should("exist"); - - getAuditCell(1, 0).contains("TABLE").should("exist"); - getAuditCell(1, 1).contains("CREATED").should("exist"); - getAuditCell(1, 3).contains("user@nocodb.com").should("exist"); - - settingsPage.closeMenu(); - }); + describe("Check Audit Tab Cells", () => { + 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(); + settingsPage.openMenu(settingsPage.AUDIT); + // wait for column headers to appear + // + cy.get("thead > tr > th.ant-table-cell").should("have.length", 5); + + cy.wait("@waitForPageLoad"); + + // Audit table entries + // [Header] Operation Type, Operation Sub Type, Description, User, Created + // [0] TABLE, DELETED, delete table table-x, user@nocodb.com, ... + // [1] TABLE, Created, created table table-x, user@nocodb.com, ... + + getAuditCell(0, 0).contains("TABLE").should("exist"); + getAuditCell(0, 1).contains("DELETED").should("exist"); + getAuditCell(0, 3).contains("user@nocodb.com").should("exist"); + + getAuditCell(1, 0).contains("TABLE").should("exist"); + getAuditCell(1, 1).contains("CREATED").should("exist"); + getAuditCell(1, 3).contains("user@nocodb.com").should("exist"); + }); + + after(() => { + settingsPage.closeMenu(); + }) + }) it("Table Rename operation", () => { cy.get(".nc-project-tree-tbl-City").should("exist").click(); diff --git a/scripts/cypress/integration/common/1b_table_column_operations.js b/scripts/cypress/integration/common/1b_table_column_operations.js index 5c0bab0826..0e6bdc78f6 100644 --- a/scripts/cypress/integration/common/1b_table_column_operations.js +++ b/scripts/cypress/integration/common/1b_table_column_operations.js @@ -36,11 +36,6 @@ export const genTest = (apiType, dbType) => { const randVal = "Test@1234.com"; const updatedRandVal = "Updated@1234.com"; - // before(() => { - // cy.restoreLocalStorage(); - // cy.createTable(name); - // }) - beforeEach(() => { cy.restoreLocalStorage(); }); @@ -49,11 +44,6 @@ export const genTest = (apiType, dbType) => { cy.saveLocalStorage(); }); - // // delete table - // after(() => { - // cy.deleteTable(name, dbType); - // }); - it("Create Table Column", () => { cy.createTable(name); mainPage.addColumn(colName, name); @@ -138,8 +128,9 @@ export const genTest = (apiType, dbType) => { .find(".nc-row-no") .should("exist") .eq(0) - .trigger("mouseover", { force: true }); - cy.get(".nc-row-expand").click({ force: true }); + .trigger("mouseover", { force: true }) + .get(".nc-row-expand") + .click({ force: true }); // wait for page render to complete cy.get('button:contains("Save row"):visible').should("exist");