2022-01-21 13:43:27 +01:00
|
|
|
import filterTests from "../support/filterTests"
|
|
|
|
|
|
|
|
filterTests(['smoke', 'all'], () => {
|
2022-02-17 15:06:17 +01:00
|
|
|
context("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
|
|
|
|
cy.get(".toprightnav").within(() => {
|
2022-04-26 13:04:07 +02:00
|
|
|
cy.get("[aria-label='Revert']").click({ force: true })
|
2022-01-21 13:43:27 +01:00
|
|
|
})
|
2022-04-26 15:41:27 +02:00
|
|
|
cy.get(".spectrum-Modal").within(() => {
|
2022-01-21 13:43:27 +01:00
|
|
|
// Enter app name before revert
|
|
|
|
cy.get("input").type("Cypress Tests")
|
|
|
|
cy.intercept('**/revert').as('revertApp')
|
|
|
|
// Click Revert
|
|
|
|
cy.get(".spectrum-Button").contains("Revert").click({ force: true })
|
|
|
|
// 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
|
|
|
|
cy.addComponent("Elements", "Paragraph")
|
|
|
|
// Publish app
|
2021-12-24 11:38:03 +01:00
|
|
|
cy.get(".spectrum-Button").contains("Publish").click({ force: true })
|
2022-01-21 13:43:27 +01:00
|
|
|
cy.get(".spectrum-ButtonGroup").within(() => {
|
|
|
|
cy.get(".spectrum-Button").contains("Publish").click({ force: true })
|
|
|
|
})
|
2022-06-17 18:41:07 +02:00
|
|
|
cy.get(".spectrum-ButtonGroup", { timeout: 1000 }).within(() => {
|
2022-04-20 10:17:01 +02:00
|
|
|
cy.get(".spectrum-Button").contains("Done").click({ force: true })
|
|
|
|
})
|
2022-05-10 23:40:27 +02:00
|
|
|
|
2022-01-21 13:43:27 +01:00
|
|
|
// Add second component - Button
|
|
|
|
cy.addComponent("Elements", "Button")
|
2021-12-24 11:38:03 +01:00
|
|
|
// Click Revert
|
2022-01-21 13:43:27 +01:00
|
|
|
cy.get(".toprightnav").within(() => {
|
2022-04-26 13:04:07 +02:00
|
|
|
cy.get("[aria-label='Revert']").click({ force: true })
|
2022-01-21 13:43:27 +01:00
|
|
|
})
|
|
|
|
cy.get(".spectrum-Dialog-grid").within(() => {
|
|
|
|
// Click Revert
|
|
|
|
cy.get(".spectrum-Button").contains("Revert").click({ force: true })
|
|
|
|
})
|
|
|
|
// Confirm Paragraph component is still visible
|
2022-06-17 18:41:07 +02:00
|
|
|
cy.get(".root", { timeout: 1000 }).contains("New Paragraph")
|
2022-01-21 13:43:27 +01:00
|
|
|
// Confirm Button component is not visible
|
|
|
|
cy.get(".root").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:41:07 +02:00
|
|
|
cy.get(".toprightnav", { timeout: 1000 }).within(() => {
|
2022-04-26 13:04:07 +02:00
|
|
|
cy.get("[aria-label='Revert']").click({ force: true })
|
2022-01-21 13:43:27 +01:00
|
|
|
})
|
|
|
|
// Enter incorrect app name
|
|
|
|
cy.get(".spectrum-Dialog-grid").within(() => {
|
|
|
|
cy.get("input").type("Cypress Tests")
|
|
|
|
// Revert button within modal should be disabled
|
|
|
|
cy.get(".spectrum-Button").eq(1).should('be.disabled')
|
|
|
|
})
|
2021-12-24 11:38:03 +01:00
|
|
|
})
|
|
|
|
})
|
2021-12-24 11:40:57 +01:00
|
|
|
})
|