From 377345a8280156744e0236dedcb832ff01f17b21 Mon Sep 17 00:00:00 2001 From: Mitch-Budibase Date: Thu, 14 Apr 2022 17:15:34 +0100 Subject: [PATCH] Smoke Build Changes Datasource (MySQL, PostgreSQL) - Test should now pass for smoke build Table Tests - Removed pagination tests - no pagination in the smoke build test run --- .../cypress/integration/createTable.spec.js | 4 +- .../integration/datasources/mySql.spec.js | 37 ++++++++++--------- .../datasources/postgreSql.spec.js | 35 +++++++----------- packages/builder/cypress/support/commands.js | 2 +- 4 files changed, 35 insertions(+), 43 deletions(-) diff --git a/packages/builder/cypress/integration/createTable.spec.js b/packages/builder/cypress/integration/createTable.spec.js index 9f2bc3653f..4600807cbc 100644 --- a/packages/builder/cypress/integration/createTable.spec.js +++ b/packages/builder/cypress/integration/createTable.spec.js @@ -55,7 +55,7 @@ filterTests(["smoke", "all"], () => { if (Cypress.env("TEST_ENV")) { // No Pagination in CI - Test env only for the next two tests - it("Adds 15 rows and checks pagination", () => { + xit("Adds 15 rows and checks pagination", () => { // 10 rows per page, 15 rows should create 2 pages within table const totalRows = 16 for (let i = 1; i < totalRows; i++) { @@ -71,7 +71,7 @@ filterTests(["smoke", "all"], () => { }) }) - it("Deletes rows and checks pagination", () => { + xit("Deletes rows and checks pagination", () => { // Delete rows, removing second page from table cy.get(".spectrum-Checkbox-input").check({ force: true }) cy.get(".popovers").within(() => { diff --git a/packages/builder/cypress/integration/datasources/mySql.spec.js b/packages/builder/cypress/integration/datasources/mySql.spec.js index 01c39c742a..ddb9ecb939 100644 --- a/packages/builder/cypress/integration/datasources/mySql.spec.js +++ b/packages/builder/cypress/integration/datasources/mySql.spec.js @@ -74,10 +74,13 @@ filterTests(["all"], () => { cy.get(".spectrum-Popover").contains("COUNTRIES").click() cy.get(".spectrum-Picker").eq(4).click() cy.get(".spectrum-Popover").contains("REGION_ID").click() - // Save relationship & reload page - cy.get(".spectrum-Button").contains("Save").click({ force: true }) - cy.reload() }) + // Save relationship & reload page + cy.get(".spectrum-ButtonGroup").within(() => { + cy.get(".spectrum-Button").contains("Save").click({ force: true }) + }) + cy.reload() + // Confirm table length & column name cy.get(".spectrum-Table") .eq(1) @@ -201,23 +204,21 @@ filterTests(["all"], () => { }) it("should delete a query", () => { - // Get last nav item - The query - for (let i = 0; i < 2; i++) { - cy.get(".nav-item") - .last() - .within(() => { - cy.get(".icon").eq(1).click({ force: true }) - }) - // Select Delete - cy.get(".spectrum-Menu").contains("Delete").click() - cy.get(".spectrum-Button") - .contains("Delete Query") - .click({ force: true }) - cy.wait(1000) - } + // Get query nav item - QueryName + cy.get(".nav-item") + .contains(queryName) + .parent() + .within(() => { + cy.get(".spectrum-Icon").eq(1).click({ force: true }) + }) + // Select Delete + cy.get(".spectrum-Menu").contains("Delete").click() + cy.get(".spectrum-Button") + .contains("Delete Query") + .click({ force: true }) + cy.wait(1000) // Confirm deletion cy.get(".nav-item").should("not.contain", queryName) - cy.get(".nav-item").should("not.contain", queryRename) }) } }) diff --git a/packages/builder/cypress/integration/datasources/postgreSql.spec.js b/packages/builder/cypress/integration/datasources/postgreSql.spec.js index d6ea2ff4c8..c7413bb7d1 100644 --- a/packages/builder/cypress/integration/datasources/postgreSql.spec.js +++ b/packages/builder/cypress/integration/datasources/postgreSql.spec.js @@ -21,13 +21,6 @@ filterTests(["all"], () => { .click({ force: true }) // Intercept Request after button click & apply assertions cy.wait("@datasource") - cy.get("@datasource") - .its("response.body") - .should( - "have.property", - "message", - "connect ECONNREFUSED 127.0.0.1:5432" - ) cy.get("@datasource") .its("response.body") .should("have.property", "status", 500) @@ -242,23 +235,21 @@ filterTests(["all"], () => { }) it("should delete a query", () => { - // Get last nav item - The query - for (let i = 0; i < 2; i++) { - cy.get(".nav-item") - .last() - .within(() => { - cy.get(".icon").eq(1).click({ force: true }) - }) - // Select Delete - cy.get(".spectrum-Menu").contains("Delete").click() - cy.get(".spectrum-Button") - .contains("Delete Query") - .click({ force: true }) - cy.wait(1000) - } + // Get query nav item - QueryName + cy.get(".nav-item") + .contains(queryName) + .parent() + .within(() => { + cy.get(".spectrum-Icon").eq(1).click({ force: true }) + }) + // Select Delete + cy.get(".spectrum-Menu").contains("Delete").click() + cy.get(".spectrum-Button") + .contains("Delete Query") + .click({ force: true }) + cy.wait(1000) // Confirm deletion cy.get(".nav-item").should("not.contain", queryName) - cy.get(".nav-item").should("not.contain", queryRename) }) const switchSchema = schema => { diff --git a/packages/builder/cypress/support/commands.js b/packages/builder/cypress/support/commands.js index c400384186..672e9dfc00 100644 --- a/packages/builder/cypress/support/commands.js +++ b/packages/builder/cypress/support/commands.js @@ -417,7 +417,7 @@ Cypress.Commands.add("addDatasourceConfig", (datasource, skipFetch) => { } else { cy.get("input") .clear({ force: true }) - .type(Cypress.env("HOST_IP"), { force: true }) + .type(Cypress.env("mysql").HOST, { force: true }) } }) })