From c5c3365c4374178bfaaf0a96957eaf27a33b6e28 Mon Sep 17 00:00:00 2001 From: Mitch-Budibase Date: Wed, 1 Jun 2022 18:36:29 +0100 Subject: [PATCH] Merge Icon Change Tests Deleting changeAppIconAndColour test file Merging that test within the appOverview test file - Updating commands also --- .../cypress/integration/appOverview.spec.js | 45 ++++++++++++------ .../changeAppIconAndColour.spec.js | 47 ------------------- packages/builder/cypress/support/commands.js | 21 --------- 3 files changed, 30 insertions(+), 83 deletions(-) delete mode 100644 packages/builder/cypress/integration/changeAppIconAndColour.spec.js diff --git a/packages/builder/cypress/integration/appOverview.spec.js b/packages/builder/cypress/integration/appOverview.spec.js index db093344b4..090e4e369b 100644 --- a/packages/builder/cypress/integration/appOverview.spec.js +++ b/packages/builder/cypress/integration/appOverview.spec.js @@ -132,22 +132,36 @@ filterTests(['all'], () => { }) }) - it("Should allow the editing of the application icon", () => { + it("Should allow the editing of the application icon and colour", () => { cy.visit(`${Cypress.config().baseUrl}/builder`) - - cy.get(".appTable .name").eq(0).click() - - cy.get(".app-logo .edit-hover").should("exist").invoke("show").click() - - cy.customiseAppIcon() - - cy.get(".app-logo") - .within(() => { - cy.get('[aria-label]').eq(0).children() - .should('have.attr', 'xlink:href').and('not.contain', '#spectrum-icon-18-Apps') - cy.get(".app-icon") - .should('have.attr', 'style').and('contains', 'color') + cy.get(".appTable", { timeout: 2000}) + .within(() => { + cy.get(".app-row-actions-icon").eq(0).click() + }) + cy.get(".spectrum-Menu").contains("Edit icon").click() + // Select random icon + cy.get(".grid").within(() => { + cy.get(".icon-item").eq(Math.floor(Math.random() * 23) + 1).click() }) + // Select random colour + cy.get(".fill").click() + cy.get(".colors").within(() => { + cy.get(".color").eq(Math.floor(Math.random() * 33) + 1).click() + }) + cy.intercept('**/applications/**').as('iconChange') + cy.get(".spectrum-Button").contains("Save").click({ force: true }) + cy.wait("@iconChange") + cy.get("@iconChange").its('response.statusCode') + .should('eq', 200) + // Confirm icon has changed from default + // Confirm colour has been applied + cy.get(".appTable", { timeout: 2000}) + .within(() => { + cy.get('[aria-label]').eq(0).children() + .should('have.attr', 'xlink:href').and('not.contain', '#spectrum-icon-18-Apps') + cy.get(".title").children().children() + .should('have.attr', 'style').and('contains', 'color') + }) }) it("Should reflect the last time the application was edited", () => { @@ -259,6 +273,7 @@ filterTests(['all'], () => { }); cy.visit(`${Cypress.config().baseUrl}/builder`) + cy.wait(1000) cy.get(".appTable .name").eq(0).click() cy.get(".spectrum-Tabs-item").contains("Settings").click() cy.get(".spectrum-Tabs-item.is-selected").contains("Settings") @@ -269,7 +284,7 @@ filterTests(['all'], () => { }) - it("Should allow copying of the published application Id", () => { + xit("Should allow copying of the published application Id", () => { cy.visit(`${Cypress.config().baseUrl}/builder`) cy.get(".appTable .app-row-actions").eq(0) .within(() => { diff --git a/packages/builder/cypress/integration/changeAppIconAndColour.spec.js b/packages/builder/cypress/integration/changeAppIconAndColour.spec.js deleted file mode 100644 index 23f9402fa3..0000000000 --- a/packages/builder/cypress/integration/changeAppIconAndColour.spec.js +++ /dev/null @@ -1,47 +0,0 @@ -import filterTests from "../support/filterTests" - -filterTests(['all'], () => { - context("Change Application Icon and Colour", () => { - before(() => { - cy.login() - cy.createTestApp() - }) - - it("should change the icon and colour for an application", () => { - // Search for test application - //cy.applicationInAppTable("Cypress Tests") - cy.visit(`${Cypress.config().baseUrl}/builder`) - cy.wait(2000) - cy.get(".appTable") - .within(() => { - cy.get(".app-row-actions-icon").eq(0).click() - }) - cy.get(".spectrum-Menu").contains("Edit icon").click() - // Select random icon - cy.get(".grid").within(() => { - cy.get(".icon-item").eq(Math.floor(Math.random() * 23) + 1).click() - }) - // Select random colour - cy.get(".fill").click() - cy.get(".colors").within(() => { - cy.get(".color").eq(Math.floor(Math.random() * 33) + 1).click() - }) - cy.intercept('**/applications/**').as('iconChange') - cy.get(".spectrum-Button").contains("Save").click({ force: true }) - cy.wait("@iconChange") - cy.get("@iconChange").its('response.statusCode') - .should('eq', 200) - cy.wait(1000) - // Confirm icon has changed from default - // Confirm colour has been applied - There is no default colour - cy.get(".appTable") - .within(() => { - cy.get('[aria-label]').eq(0).children() - .should('have.attr', 'xlink:href').and('not.contain', '#spectrum-icon-18-Apps') - cy.get(".title").children().children() - .should('have.attr', 'style').and('contains', 'color') - }) - cy.deleteAllApps() - }) - }) -}) diff --git a/packages/builder/cypress/support/commands.js b/packages/builder/cypress/support/commands.js index af5b9eb3d1..26337600f0 100644 --- a/packages/builder/cypress/support/commands.js +++ b/packages/builder/cypress/support/commands.js @@ -218,27 +218,6 @@ Cypress.Commands.add("deleteAllApps", () => { }) }) -Cypress.Commands.add("customiseAppIcon", () => { - // Select random icon - cy.get(".grid").within(() => { - cy.get(".icon-item") - .eq(Math.floor(Math.random() * 23) + 1) - .click() - }) - // Select random colour - cy.get(".fill").click() - cy.get(".colors").within(() => { - cy.get(".color") - .eq(Math.floor(Math.random() * 33) + 1) - .click() - }) - cy.intercept("**/applications/**").as("iconChange") - cy.get(".spectrum-Button").contains("Save").click({ force: true }) - cy.wait("@iconChange") - cy.get("@iconChange").its("response.statusCode").should("eq", 200) - cy.wait(1000) -}) - Cypress.Commands.add("alterAppVersion", (appId, version) => { return cy .request("put", `${Cypress.config().baseUrl}/api/applications/${appId}`, {