2022-01-21 13:43:27 +01:00
|
|
|
import filterTests from "../support/filterTests"
|
2022-06-08 16:29:12 +02:00
|
|
|
const interact = require('../support/interact')
|
2022-01-21 13:43:27 +01:00
|
|
|
|
|
|
|
filterTests(['smoke', 'all'], () => {
|
2022-11-16 12:33:30 +01:00
|
|
|
xcontext("Revert apps", () => {
|
2022-01-21 13:43:27 +01:00
|
|
|
before(() => {
|
|
|
|
cy.login()
|
|
|
|
cy.createTestApp()
|
2021-12-24 11:38:03 +01:00
|
|
|
})
|
2022-01-21 13:43:27 +01:00
|
|
|
|
|
|
|
it("should try to revert an unpublished app", () => {
|
|
|
|
// Click revert icon
|
2022-06-08 16:29:12 +02:00
|
|
|
cy.get(interact.TOP_RIGHT_NAV).within(() => {
|
2022-06-13 12:10:11 +02:00
|
|
|
cy.get(interact.AREA_LABEL_REVERT).click({ force: true })
|
2022-01-21 13:43:27 +01:00
|
|
|
})
|
2022-06-08 16:29:12 +02:00
|
|
|
cy.get(interact.SPECTRUM_MODAL).within(() => {
|
2022-01-21 13:43:27 +01:00
|
|
|
// Enter app name before revert
|
2022-07-26 15:43:06 +02:00
|
|
|
cy.get(interact.SPECTRUM_TEXTFIELD_INPUT).type("Cypress Tests")
|
2022-01-21 13:43:27 +01:00
|
|
|
cy.intercept('**/revert').as('revertApp')
|
|
|
|
// Click Revert
|
2022-06-08 16:29:12 +02:00
|
|
|
cy.get(interact.SPECTRUM_BUTTON).contains("Revert").click({ force: true })
|
2022-01-21 13:43:27 +01:00
|
|
|
// Intercept Request after button click & apply assertions
|
|
|
|
cy.wait("@revertApp")
|
|
|
|
cy.get("@revertApp").its('response.body').should('have.property', 'message', "App has not yet been deployed")
|
|
|
|
cy.get("@revertApp").its('response.body').should('have.property', 'status', 400)
|
|
|
|
})
|
2021-12-24 11:38:03 +01:00
|
|
|
})
|
2022-01-21 13:43:27 +01:00
|
|
|
|
|
|
|
it("should revert a published app", () => {
|
2022-05-10 23:40:27 +02:00
|
|
|
cy.navigateToFrontend()
|
|
|
|
|
2022-01-21 13:43:27 +01:00
|
|
|
// Add initial component - Paragraph
|
2022-07-22 17:33:00 +02:00
|
|
|
cy.searchAndAddComponent("Paragraph")
|
2022-01-21 13:43:27 +01:00
|
|
|
// Publish app
|
2022-06-08 16:29:12 +02:00
|
|
|
cy.get(interact.SPECTRUM_BUTTON).contains("Publish").click({ force: true })
|
|
|
|
cy.get(interact.SPECTRUM_BUTTON_GROUP).within(() => {
|
|
|
|
cy.get(interact.SPECTRUM_BUTTON).contains("Publish").click({ force: true })
|
2022-01-21 13:43:27 +01:00
|
|
|
})
|
2022-06-29 19:28:32 +02:00
|
|
|
cy.wait(1000) // Wait for next modal to finish loading
|
2022-06-17 18:45:43 +02:00
|
|
|
cy.get(interact.SPECTRUM_BUTTON_GROUP, { timeout: 1000 }).within(() => {
|
2022-06-08 16:29:12 +02:00
|
|
|
cy.get(interact.SPECTRUM_BUTTON).contains("Done").click({ force: true })
|
2022-04-20 10:17:01 +02:00
|
|
|
})
|
2022-05-10 23:40:27 +02:00
|
|
|
|
2022-01-21 13:43:27 +01:00
|
|
|
// Add second component - Button
|
2022-07-22 17:33:00 +02:00
|
|
|
cy.searchAndAddComponent("Button")
|
2021-12-24 11:38:03 +01:00
|
|
|
// Click Revert
|
2022-06-08 16:29:12 +02:00
|
|
|
cy.get(interact.TOP_RIGHT_NAV).within(() => {
|
2022-06-13 12:10:11 +02:00
|
|
|
cy.get(interact.AREA_LABEL_REVERT).click({ force: true })
|
2022-01-21 13:43:27 +01:00
|
|
|
})
|
2022-06-08 16:29:12 +02:00
|
|
|
cy.get(interact.SPECTRUM_DIALOG_GRID).within(() => {
|
2022-08-25 19:52:36 +02:00
|
|
|
cy.get("input").type("Cypress Tests")
|
2022-01-21 13:43:27 +01:00
|
|
|
// Click Revert
|
2022-06-08 16:29:12 +02:00
|
|
|
cy.get(interact.SPECTRUM_BUTTON).contains("Revert").click({ force: true })
|
2022-06-29 19:28:32 +02:00
|
|
|
cy.wait(2000) // Wait for app to finish reverting
|
2022-01-21 13:43:27 +01:00
|
|
|
})
|
|
|
|
// Confirm Paragraph component is still visible
|
2022-06-17 18:45:43 +02:00
|
|
|
cy.get(interact.ROOT, { timeout: 1000 }).contains("New Paragraph")
|
2022-01-21 13:43:27 +01:00
|
|
|
// Confirm Button component is not visible
|
2022-06-17 18:45:43 +02:00
|
|
|
cy.get(interact.ROOT, { timeout: 1000 }).should("not.have.text", "New Button")
|
2021-12-24 11:38:03 +01:00
|
|
|
})
|
2022-01-21 13:43:27 +01:00
|
|
|
|
|
|
|
it("should enter incorrect app name when reverting", () => {
|
|
|
|
// Click Revert
|
2022-06-17 18:45:43 +02:00
|
|
|
cy.get(interact.TOP_RIGHT_NAV, { timeout: 1000 }).within(() => {
|
2022-06-13 12:10:11 +02:00
|
|
|
cy.get(interact.AREA_LABEL_REVERT).click({ force: true })
|
2022-01-21 13:43:27 +01:00
|
|
|
})
|
|
|
|
// Enter incorrect app name
|
2022-06-08 16:29:12 +02:00
|
|
|
cy.get(interact.SPECTRUM_DIALOG_GRID).within(() => {
|
2022-01-21 13:43:27 +01:00
|
|
|
cy.get("input").type("Cypress Tests")
|
|
|
|
// Revert button within modal should be disabled
|
2022-06-08 16:29:12 +02:00
|
|
|
cy.get(interact.SPECTRUM_BUTTON).eq(1).should('be.disabled')
|
2022-01-21 13:43:27 +01:00
|
|
|
})
|
2021-12-24 11:38:03 +01:00
|
|
|
})
|
|
|
|
})
|
2021-12-24 11:40:57 +01:00
|
|
|
})
|