2022-04-21 12:59:59 +02:00
|
|
|
import filterTests from "../support/filterTests"
|
2022-06-03 00:41:16 +02:00
|
|
|
import { APP_TABLE_APP_NAME, DEPLOY_SUCCESS_MODAL } from "../support/interact";
|
2022-05-23 10:36:54 +02:00
|
|
|
const interact = require('../support/interact')
|
2022-04-21 12:59:59 +02:00
|
|
|
|
|
|
|
filterTests(['all'], () => {
|
|
|
|
context("Publish Application Workflow", () => {
|
|
|
|
before(() => {
|
|
|
|
cy.login()
|
2022-07-06 18:32:27 +02:00
|
|
|
cy.deleteAllApps()
|
|
|
|
cy.createApp("Cypress Tests", false)
|
2022-04-21 12:59:59 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it("Should reflect the unpublished status correctly", () => {
|
2022-07-06 22:10:34 +02:00
|
|
|
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 })
|
2022-04-21 12:59:59 +02:00
|
|
|
|
2022-06-29 19:28:32 +02:00
|
|
|
cy.get(interact.APP_TABLE_STATUS, { timeout: 3000 }).eq(0)
|
2022-04-21 15:01:25 +02:00
|
|
|
.within(() => {
|
|
|
|
cy.contains("Unpublished")
|
2022-06-01 09:23:15 +02:00
|
|
|
cy.get(interact.GLOBESTRIKE).should("exist")
|
2022-04-21 15:01:25 +02:00
|
|
|
})
|
|
|
|
|
2022-05-23 10:36:54 +02:00
|
|
|
cy.get(interact.APP_TABLE_ROW_ACTION).eq(0)
|
2022-04-21 15:01:25 +02:00
|
|
|
.within(() => {
|
2022-05-23 10:36:54 +02:00
|
|
|
cy.get(interact.SPECTRUM_BUTTON_TEMPLATE).contains("Edit").click({ force: true })
|
2022-04-21 15:01:25 +02:00
|
|
|
})
|
2022-06-03 00:41:16 +02:00
|
|
|
|
2022-05-23 10:36:54 +02:00
|
|
|
cy.get(interact.DEPLOYMENT_TOP_NAV_GLOBESTRIKE).should("exist")
|
|
|
|
cy.get(interact.DEPLOYMENT_TOP_GLOBE).should("not.exist")
|
2022-04-21 12:59:59 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it("Should publish an application and correctly reflect that", () => {
|
|
|
|
//Assuming the previous test was run and the unpublished app is open in edit mode.
|
2022-07-06 22:10:34 +02:00
|
|
|
cy.closeModal()
|
2022-05-23 10:36:54 +02:00
|
|
|
cy.get(interact.TOPRIGHTNAV_BUTTON_SPECTRUM).contains("Publish").click({ force : true })
|
2022-04-21 12:59:59 +02:00
|
|
|
|
2022-06-01 09:23:15 +02:00
|
|
|
cy.get(interact.DEPLOY_APP_MODAL).should("be.visible")
|
2022-04-21 15:01:25 +02:00
|
|
|
.within(() => {
|
2022-06-01 09:23:15 +02:00
|
|
|
cy.get(interact.SPECTRUM_BUTTON).contains("Publish").click({ force : true })
|
2022-04-21 12:59:59 +02:00
|
|
|
});
|
|
|
|
|
2022-04-21 15:01:25 +02:00
|
|
|
//Verify that the app url is presented correctly to the user
|
2022-06-17 18:41:07 +02:00
|
|
|
cy.get(interact.DEPLOY_SUCCESS_MODAL, { timeout: 1000 })
|
2022-04-21 15:01:25 +02:00
|
|
|
.should("be.visible")
|
|
|
|
.within(() => {
|
|
|
|
let appUrl = Cypress.config().baseUrl + '/app/cypress-tests'
|
2022-06-01 09:23:15 +02:00
|
|
|
cy.get(interact.DEPLOY_APP_URL_INPUT).should('have.value', appUrl)
|
|
|
|
cy.get(interact.SPECTRUM_BUTTON).contains("Done").click({ force: true })
|
2022-04-21 15:01:25 +02:00
|
|
|
})
|
2022-04-21 12:59:59 +02:00
|
|
|
|
|
|
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
|
|
|
|
2022-06-29 19:28:32 +02:00
|
|
|
cy.get(interact.APP_TABLE_STATUS, { timeout: 3000 }).eq(0)
|
2022-04-21 15:01:25 +02:00
|
|
|
.within(() => {
|
|
|
|
cy.contains("Published")
|
2022-06-01 09:23:15 +02:00
|
|
|
cy.get(interact.GLOBE).should("exist")
|
2022-04-21 15:01:25 +02:00
|
|
|
})
|
2022-04-21 12:59:59 +02:00
|
|
|
|
2022-06-01 09:23:15 +02:00
|
|
|
cy.get(interact.APP_TABLE_ROW_ACTION).eq(0)
|
2022-04-21 15:01:25 +02:00
|
|
|
.within(() => {
|
2022-06-29 19:28:32 +02:00
|
|
|
cy.get(interact.SPECTRUM_BUTTON).contains("Manage")
|
2022-06-01 09:23:15 +02:00
|
|
|
cy.get(interact.SPECTRUM_BUTTON).contains("Edit").click({ force: true })
|
2022-04-21 15:01:25 +02:00
|
|
|
})
|
2022-04-21 12:59:59 +02:00
|
|
|
|
2022-05-23 10:36:54 +02:00
|
|
|
cy.get(interact.DEPLOYMENT_TOP_GLOBE).should("exist").click({ force: true })
|
2022-06-03 00:41:16 +02:00
|
|
|
|
2022-05-23 10:36:54 +02:00
|
|
|
cy.get(interact.PUBLISH_POPOVER_MENU).should("be.visible")
|
2022-04-21 15:01:25 +02:00
|
|
|
.within(() => {
|
2022-05-23 10:36:54 +02:00
|
|
|
cy.get(interact.PUBLISH_POPOVER_ACTION).should("exist")
|
2022-04-26 13:04:07 +02:00
|
|
|
cy.get("button").contains("View app").should("exist")
|
2022-05-23 10:36:54 +02:00
|
|
|
cy.get(interact.PUBLISH_POPOVER_MESSAGE).should("have.text", "Last published a few seconds ago")
|
2022-04-21 15:01:25 +02:00
|
|
|
})
|
2022-04-21 12:59:59 +02:00
|
|
|
})
|
|
|
|
|
2022-06-03 00:41:16 +02:00
|
|
|
it("Should unpublish an application using the link and reflect the status change", () => {
|
2022-04-21 12:59:59 +02:00
|
|
|
//Assuming the previous test app exists and is published
|
2022-06-03 00:41:16 +02:00
|
|
|
|
2022-07-06 22:10:34 +02:00
|
|
|
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 })
|
2022-04-21 12:59:59 +02:00
|
|
|
|
2022-05-23 10:36:54 +02:00
|
|
|
cy.get(interact.APP_TABLE_STATUS).eq(0)
|
2022-04-21 15:01:25 +02:00
|
|
|
.within(() => {
|
|
|
|
cy.contains("Published")
|
|
|
|
cy.get("svg[aria-label='Globe']").should("exist")
|
|
|
|
})
|
2022-04-21 12:59:59 +02:00
|
|
|
|
2022-06-08 18:33:56 +02:00
|
|
|
cy.get(interact.APP_TABLE).eq(0)
|
2022-04-21 15:01:25 +02:00
|
|
|
.within(() => {
|
2022-06-03 00:41:16 +02:00
|
|
|
cy.get(interact.APP_TABLE_APP_NAME).click({ force: true })
|
2022-04-21 15:01:25 +02:00
|
|
|
})
|
2022-04-21 12:59:59 +02:00
|
|
|
|
2022-07-06 22:10:34 +02:00
|
|
|
cy.closeModal()
|
2022-07-03 22:13:15 +02:00
|
|
|
cy.get(interact.DEPLOYMENT_TOP_GLOBE).should("exist").click({ force: true })
|
|
|
|
|
|
|
|
cy.get("[data-cy='publish-popover-menu']")
|
|
|
|
.within(() => {
|
|
|
|
cy.get(interact.PUBLISH_POPOVER_ACTION).click({ force: true })
|
|
|
|
})
|
2022-04-21 12:59:59 +02:00
|
|
|
|
2022-06-01 09:23:15 +02:00
|
|
|
cy.get(interact.UNPUBLISH_MODAL).should("be.visible")
|
2022-04-21 15:01:25 +02:00
|
|
|
.within(() => {
|
2022-06-01 09:23:15 +02:00
|
|
|
cy.get(interact.CONFIRM_WRAP_BUTTON).click({ force: true }
|
2022-04-21 15:01:25 +02:00
|
|
|
)})
|
2022-04-21 12:59:59 +02:00
|
|
|
|
2022-07-06 22:10:34 +02:00
|
|
|
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 6000 })
|
|
|
|
cy.wait(500)
|
2022-06-08 18:33:56 +02:00
|
|
|
cy.get(interact.APP_TABLE_STATUS, { timeout: 1000 }).eq(0).contains("Unpublished")
|
2022-04-21 12:59:59 +02:00
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|