From 88cf737087cf5d6be5fb4279f98fbc9f0236f785 Mon Sep 17 00:00:00 2001 From: Mitch-Budibase Date: Wed, 23 Nov 2022 16:19:50 +0000 Subject: [PATCH] Cypress Build Update Few changes to assist with the nightly build appPublishWorkflow - Removing closeModal function calls (no longer needed) createBinding - Update to remove a component from some of the tests - New command for this also REST - Skipping these tests -> there are only 2 and will be replaced via API Commands - Additional changes to support the nightly build - mainly navigation based due to recent code changes to the product --- .../integration/appPublishWorkflow.spec.js | 4 +--- .../cypress/integration/createBinding.spec.js | 4 +++- .../integration/datasources/rest.spec.js | 2 +- packages/builder/cypress/support/commands.js | 19 +++++++++++++++++-- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/packages/builder/cypress/integration/appPublishWorkflow.spec.js b/packages/builder/cypress/integration/appPublishWorkflow.spec.js index 0e3fbb191b..ab799f40fe 100644 --- a/packages/builder/cypress/integration/appPublishWorkflow.spec.js +++ b/packages/builder/cypress/integration/appPublishWorkflow.spec.js @@ -30,7 +30,6 @@ filterTests(['all'], () => { it("Should publish an application and correctly reflect that", () => { //Assuming the previous test was run and the unpublished app is open in edit mode. - cy.closeModal() cy.get(interact.TOPRIGHTNAV_BUTTON_SPECTRUM).contains("Publish").click({ force : true }) cy.get(interact.DEPLOY_APP_MODAL).should("be.visible") @@ -86,8 +85,7 @@ filterTests(['all'], () => { .within(() => { cy.get(interact.APP_TABLE_APP_NAME).click({ force: true }) }) - - cy.closeModal() + cy.get(interact.DEPLOYMENT_TOP_GLOBE).should("exist").click({ force: true }) cy.get("[data-cy='publish-popover-menu']") diff --git a/packages/builder/cypress/integration/createBinding.spec.js b/packages/builder/cypress/integration/createBinding.spec.js index 0c1ddf1e7d..0722d29f1d 100644 --- a/packages/builder/cypress/integration/createBinding.spec.js +++ b/packages/builder/cypress/integration/createBinding.spec.js @@ -9,9 +9,10 @@ filterTests(['smoke', 'all'], () => { }) it("should add a current user binding", () => { - cy.searchAndAddComponent("Paragraph").then(() => { + cy.searchAndAddComponent("Paragraph").then(componentId => { addSettingBinding("text", ["Current User", "_id"], "Current User._id") }) + cy.deleteComponentByName("New Paragraph") }) it("should handle an invalid binding", () => { @@ -21,6 +22,7 @@ filterTests(['smoke', 'all'], () => { .type("{{}{{}{{} Current User._id {}}{}}") .blur() cy.getComponent(componentId).should("have.text", "{{{ [user].[_id] }}") + cy.deleteComponentByName("New Paragraph") }) }) diff --git a/packages/builder/cypress/integration/datasources/rest.spec.js b/packages/builder/cypress/integration/datasources/rest.spec.js index 7cfe1ce9bb..7f715ae50c 100644 --- a/packages/builder/cypress/integration/datasources/rest.spec.js +++ b/packages/builder/cypress/integration/datasources/rest.spec.js @@ -1,7 +1,7 @@ import filterTests from "../../support/filterTests" filterTests(["smoke", "all"], () => { - context("REST Datasource Testing", () => { + xcontext("REST Datasource Testing", () => { before(() => { cy.login() cy.createTestApp() diff --git a/packages/builder/cypress/support/commands.js b/packages/builder/cypress/support/commands.js index c8d977258c..278c6504f8 100644 --- a/packages/builder/cypress/support/commands.js +++ b/packages/builder/cypress/support/commands.js @@ -440,8 +440,8 @@ Cypress.Commands.add("createTable", (tableName, initialTable) => { // Creates an internal Budibase DB table if (!initialTable) { cy.navigateToDataSection() - cy.get(`[data-cy="new-datasource"]`, { timeout: 2000 }).click() } + cy.get(`[data-cy="new-datasource"]`, { timeout: 2000 }).click() cy.wait(2000) cy.get(".item", { timeout: 2000 }) .contains("Budibase DB") @@ -458,6 +458,9 @@ Cypress.Commands.add("createTable", (tableName, initialTable) => { }) // Ensure modal has closed and table is created cy.get(".spectrum-Modal", { timeout: 2000 }).should("not.exist") + cy.get(".nav-item", { timeout: 2000 }) + .contains("Budibase DB") + .click({ force: true }) cy.get(".spectrum-Tabs-content", { timeout: 2000 }).should( "contain", tableName @@ -525,7 +528,7 @@ Cypress.Commands.add("addRowMultiValue", values => { }) Cypress.Commands.add("selectTable", tableName => { - cy.expandBudibaseConnection() + cy.get(".nav-item").contains("Budibase DB").click() cy.contains(".nav-item", tableName).click() }) @@ -576,6 +579,18 @@ Cypress.Commands.add("searchAndAddComponent", component => { }) }) +Cypress.Commands.add("deleteComponentByName", componentName => { + cy.get(".body") + .eq(0) + .contains(componentName) + .siblings(".actions") + .within(() => { + cy.get(".spectrum-Icon").click({ force: true }) + }) + cy.get(".spectrum-Menu").contains("Delete").click() + cy.get(".spectrum-Dialog").contains("Delete Component").click() +}) + Cypress.Commands.add("addComponent", (category, component) => { if (category) { cy.get(`[data-cy="category-${category}"]`, { timeout: 3000 }).click({