From 4b69f5ec9c84ceed9da7545288f06b5d3d153016 Mon Sep 17 00:00:00 2001 From: MihailHadzhiev2022 Date: Mon, 23 May 2022 11:36:54 +0300 Subject: [PATCH] adding interact locators for APP_Publish_WORK_FLOW --- .../integration/appPublishWorkflow.spec.js | 33 ++++++++++--------- packages/builder/cypress/support/interact.js | 10 ++++++ 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/packages/builder/cypress/integration/appPublishWorkflow.spec.js b/packages/builder/cypress/integration/appPublishWorkflow.spec.js index d18233e0e7..bb5cbee0d5 100644 --- a/packages/builder/cypress/integration/appPublishWorkflow.spec.js +++ b/packages/builder/cypress/integration/appPublishWorkflow.spec.js @@ -1,4 +1,5 @@ import filterTests from "../support/filterTests" +const interact = require('../support/interact') filterTests(['all'], () => { context("Publish Application Workflow", () => { @@ -11,29 +12,29 @@ filterTests(['all'], () => { cy.visit(`${Cypress.config().baseUrl}/builder`) cy.wait(1000) - cy.get(".appTable .app-status").eq(0) + cy.get(interact.APP_TABLE_STATUS).eq(0) .within(() => { cy.contains("Unpublished") cy.get("svg[aria-label='GlobeStrike']").should("exist") }) - cy.get(".appTable .app-row-actions").eq(0) + cy.get(interact.APP_TABLE_ROW_ACTION).eq(0) .within(() => { - cy.get(".spectrum-Button").contains("Preview") - cy.get(".spectrum-Button").contains("Edit").click({ force: true }) + cy.get(interact.SPECTRUM_BUTTON_TEMPLATE).contains("Preview") + cy.get(interact.SPECTRUM_BUTTON_TEMPLATE).contains("Edit").click({ force: true }) }) - cy.get(".deployment-top-nav svg[aria-label='GlobeStrike']").should("exist") - cy.get(".deployment-top-nav svg[aria-label='Globe']").should("not.exist") + cy.get(interact.DEPLOYMENT_TOP_NAV_GLOBESTRIKE).should("exist") + cy.get(interact.DEPLOYMENT_TOP_GLOBE).should("not.exist") }) 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.get(".toprightnav button.spectrum-Button").contains("Publish").click({ force : true }) + cy.get(interact.TOPRIGHTNAV_BUTTON_SPECTRUM).contains("Publish").click({ force : true }) cy.get(".spectrum-Modal [data-cy='deploy-app-modal']").should("be.visible") .within(() => { - cy.get(".spectrum-Button").contains("Publish").click({ force : true }) + cy.get(interact.SPECTRUM_BUTTON_TEMPLATE).contains("Publish").click({ force : true }) cy.wait(1000) }); @@ -43,7 +44,7 @@ filterTests(['all'], () => { .within(() => { let appUrl = Cypress.config().baseUrl + '/app/cypress-tests' cy.get("[data-cy='deployed-app-url'] input").should('have.value', appUrl) - cy.get(".spectrum-Button").contains("Done").click({ force: true }) + cy.get(interact.SPECTRUM_BUTTON_TEMPLATE).contains("Done").click({ force: true }) }) cy.visit(`${Cypress.config().baseUrl}/builder`) @@ -61,13 +62,13 @@ filterTests(['all'], () => { cy.get(".spectrum-Button").contains("Edit").click({ force: true }) }) - cy.get(".deployment-top-nav svg[aria-label='Globe']").should("exist").click({ force: true }) + cy.get(interact.DEPLOYMENT_TOP_GLOBE).should("exist").click({ force: true }) - cy.get("[data-cy='publish-popover-menu']").should("be.visible") + cy.get(interact.PUBLISH_POPOVER_MENU).should("be.visible") .within(() => { - cy.get("[data-cy='publish-popover-action']").should("exist") + cy.get(interact.PUBLISH_POPOVER_ACTION).should("exist") cy.get("button").contains("View app").should("exist") - cy.get(".publish-popover-message").should("have.text", "Last published a few seconds ago") + cy.get(interact.PUBLISH_POPOVER_MESSAGE).should("have.text", "Last published a few seconds ago") }) }) @@ -76,7 +77,7 @@ filterTests(['all'], () => { cy.visit(`${Cypress.config().baseUrl}/builder`) - cy.get(".appTable .app-status").eq(0) + cy.get(interact.APP_TABLE_STATUS).eq(0) .within(() => { cy.contains("Published") cy.get("svg[aria-label='Globe']").should("exist") @@ -84,8 +85,8 @@ filterTests(['all'], () => { cy.get(".appTable .app-row-actions").eq(0) .within(() => { - cy.get(".spectrum-Button").contains("View app") - cy.get(".spectrum-Button").contains("Edit").click({ force: true }) + cy.get(interact.SPECTRUM_BUTTON).contains("View app") + cy.get(interact.SPECTRUM_BUTTON).contains("Edit").click({ force: true }) }) //The published status diff --git a/packages/builder/cypress/support/interact.js b/packages/builder/cypress/support/interact.js index 11794d940d..691c98db73 100644 --- a/packages/builder/cypress/support/interact.js +++ b/packages/builder/cypress/support/interact.js @@ -24,3 +24,13 @@ export const OPTION_TYPE_PROP_CONTROL = '[data-cy="optionsType-prop-control' //AddRadioButtons export const SPECTRUM_POPOVER = ".spectrum-Popover" export const OPTION_SOURCE_PROP_CONROL = '[data-cy="optionsSource-prop-control' +export const APP_TABLE_STATUS = ".appTable .app-status" +export const APP_TABLE_ROW_ACTION = ".appTable .app-row-actions" +export const DEPLOYMENT_TOP_NAV_GLOBESTRIKE = + ".deployment-top-nav svg[aria-label=GlobeStrike]" +export const DEPLOYMENT_TOP_GLOBE = ".deployment-top-nav svg[aria-label=Globe]" +export const PUBLISH_POPOVER_MENU = '[data-cy="publish-popover-menu"]' +export const PUBLISH_POPOVER_ACTION = '[data-cy="publish-popover-action"]' +export const PUBLISH_POPOVER_MESSAGE = ".publish-popover-message" +export const SPECTRUM_BUTTON = ".spectrum-Button" +export const TOPRIGHTNAV_BUTTON_SPECTRUM = ".toprightnav button.spectrum-Button"