Refactored workflow tests to remove use of variables
This commit is contained in:
parent
16cccf5bb3
commit
2dc86fe2d3
|
@ -8,6 +8,7 @@
|
||||||
export let anchor
|
export let anchor
|
||||||
export let showTip = true
|
export let showTip = true
|
||||||
export let direction = "bottom"
|
export let direction = "bottom"
|
||||||
|
export let dataCy = null
|
||||||
|
|
||||||
let dropdown
|
let dropdown
|
||||||
let tipSvg =
|
let tipSvg =
|
||||||
|
@ -55,7 +56,7 @@
|
||||||
{@html tipSvg}
|
{@html tipSvg}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class="popover-container">
|
<div class="popover-container" data-cy={dataCy}>
|
||||||
<div class="popover-menu-wrap">
|
<div class="popover-menu-wrap">
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,13 +11,17 @@ filterTests(['all'], () => {
|
||||||
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||||
cy.wait(1000)
|
cy.wait(1000)
|
||||||
|
|
||||||
cy.get(".appTable")
|
cy.get(".appTable .app-status").eq(0)
|
||||||
let appStatusEle = cy.get(".app-status").eq(0)
|
.within(() => {
|
||||||
appStatusEle.contains("Unpublished")
|
cy.contains("Unpublished")
|
||||||
appStatusEle.get("svg[aria-label='GlobeStrike']").should("exist")
|
cy.get("svg[aria-label='GlobeStrike']").should("exist")
|
||||||
appStatusEle.get(".app-row-actions .spectrum-Button").contains("Preview")
|
})
|
||||||
|
|
||||||
appStatusEle.get(".app-row-actions .spectrum-Button").contains("Edit").click({ force: true })
|
cy.get(".appTable .app-row-actions").eq(0)
|
||||||
|
.within(() => {
|
||||||
|
cy.get(".spectrum-Button").contains("Preview")
|
||||||
|
cy.get(".spectrum-Button").contains("Edit").click({ force: true })
|
||||||
|
})
|
||||||
|
|
||||||
cy.get(".app-status-icon svg[aria-label='GlobeStrike']").should("exist")
|
cy.get(".app-status-icon svg[aria-label='GlobeStrike']").should("exist")
|
||||||
cy.get(".app-status-icon svg[aria-label='Globe']").should("not.exist")
|
cy.get(".app-status-icon svg[aria-label='Globe']").should("not.exist")
|
||||||
|
@ -25,47 +29,46 @@ filterTests(['all'], () => {
|
||||||
|
|
||||||
it("Should publish an application and correctly reflect that", () => {
|
it("Should publish an application and correctly reflect that", () => {
|
||||||
//Assuming the previous test was run and the unpublished app is open in edit mode.
|
//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(".toprightnav button.spectrum-Button").contains("Publish").click({ force : true })
|
||||||
|
|
||||||
let deployModal = cy.get(".spectrum-Modal [data-cy='deploy-app-modal']").should("be.visible")
|
cy.get(".spectrum-Modal [data-cy='deploy-app-modal']").should("be.visible")
|
||||||
deployModal.within(() => {
|
.within(() => {
|
||||||
cy.get(".spectrum-Button").contains("Publish").click({ force : true })
|
cy.get(".spectrum-Button").contains("Publish").click({ force : true })
|
||||||
cy.wait(1000)
|
cy.wait(1000)
|
||||||
});
|
});
|
||||||
|
|
||||||
let deployModalSuccess = cy.get(".spectrum-Modal [data-cy='deploy-app-success-modal']")
|
//Verify that the app url is presented correctly to the user
|
||||||
deployModalSuccess.should("be.visible")
|
cy.get(".spectrum-Modal [data-cy='deploy-app-success-modal']")
|
||||||
|
.should("be.visible")
|
||||||
deployModalSuccess.within(() => {
|
.within(() => {
|
||||||
cy.get("[data-cy='deployed-app-url'] input").should('have.value', Cypress.config().baseUrl + '/app/cypress-tests')
|
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(".spectrum-Button").contains("Done").click({ force: true })
|
||||||
});
|
})
|
||||||
|
|
||||||
deployModalSuccess.should("exist")
|
|
||||||
|
|
||||||
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||||
cy.wait(1000)
|
cy.wait(1000)
|
||||||
|
|
||||||
cy.get(".appTable")
|
cy.get(".appTable .app-status").eq(0)
|
||||||
let appStatusEle = cy.get(".app-status").eq(0)
|
.within(() => {
|
||||||
appStatusEle.contains("Published")
|
cy.contains("Published")
|
||||||
appStatusEle.get("svg[aria-label='Globe']").should("exist")
|
cy.get("svg[aria-label='Globe']").should("exist")
|
||||||
appStatusEle.get(".app-row-actions .spectrum-Button").contains("View app")
|
})
|
||||||
|
|
||||||
appStatusEle.get(".app-row-actions .spectrum-Button").contains("Edit").click({ force: true })
|
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 })
|
||||||
|
})
|
||||||
|
|
||||||
const publishStatusIcon = cy.get(".app-status-icon svg[aria-label='Globe']").should("exist")
|
cy.get(".app-status-icon svg[aria-label='Globe']").should("exist").click({ force: true })
|
||||||
publishStatusIcon.click({ force: true })
|
|
||||||
|
|
||||||
const publishingMenu = cy.get("[data-cy='publish-popover-action']")
|
|
||||||
publishingMenu.should("be.visible")
|
|
||||||
|
|
||||||
publishingMenu.get("button[data-cy='publish-popover-action']").should("exist")
|
|
||||||
publishingMenu.get("button").contains("View App").should("exist")
|
|
||||||
|
|
||||||
publishingMenu.get(".publish-popover-message").should("have.text", "Last Published: a few seconds ago")
|
|
||||||
|
|
||||||
|
cy.get("[data-cy='publish-popover-menu']").should("be.visible")
|
||||||
|
.within(() => {
|
||||||
|
cy.get("[data-cy='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")
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it("Should unpublish an application from the top navigation and reflect the status change", () => {
|
it("Should unpublish an application from the top navigation and reflect the status change", () => {
|
||||||
|
@ -73,36 +76,36 @@ filterTests(['all'], () => {
|
||||||
|
|
||||||
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||||
|
|
||||||
cy.get(".appTable")
|
cy.get(".appTable .app-status").eq(0)
|
||||||
let appStatusEle = cy.get(".app-status").eq(0)
|
.within(() => {
|
||||||
appStatusEle.contains("Published")
|
cy.contains("Published")
|
||||||
appStatusEle.get("svg[aria-label='Globe']").should("exist")
|
cy.get("svg[aria-label='Globe']").should("exist")
|
||||||
appStatusEle.get(".app-row-actions .spectrum-Button").contains("View app")
|
})
|
||||||
|
|
||||||
appStatusEle.get(".app-row-actions .spectrum-Button").contains("Edit").click({ force: true })
|
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 })
|
||||||
|
})
|
||||||
|
|
||||||
//The published status
|
//The published status
|
||||||
const publishStatusIcon = cy.get(".app-status-icon svg[aria-label='Globe']").should("exist")
|
cy.get(".app-status-icon svg[aria-label='Globe']").should("exist")
|
||||||
publishStatusIcon.click({ force: true })
|
.click({ force: true })
|
||||||
|
|
||||||
const publishingMenu = cy.get("[data-cy='publish-popover-action']")
|
cy.get("[data-cy='publish-popover-menu']").should("be.visible")
|
||||||
publishingMenu.should("be.visible")
|
cy.get("[data-cy='publish-popover-menu'] [data-cy='publish-popover-action']")
|
||||||
|
.click({ force : true })
|
||||||
|
|
||||||
const unpublishButton = publishingMenu.get("button[data-cy='publish-popover-action']")
|
cy.get("[data-cy='unpublish-modal']").should("be.visible")
|
||||||
unpublishButton.should("exist")
|
.within(() => {
|
||||||
|
cy.get(".confirm-wrap button").click({ force: true }
|
||||||
unpublishButton.click({ force : true })
|
)})
|
||||||
|
|
||||||
const unpublishModal = cy.get("[data-cy='unpublish-modal']")
|
|
||||||
unpublishModal.should("be.visible")
|
|
||||||
unpublishModal.get(".confirm-wrap button").click({ force: true })
|
|
||||||
|
|
||||||
cy.get(".app-status-icon svg[aria-label='GlobeStrike']").should("exist")
|
cy.get(".app-status-icon svg[aria-label='GlobeStrike']").should("exist")
|
||||||
|
|
||||||
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||||
|
|
||||||
appStatusEle = cy.get(".appTable")
|
cy.get(".appTable .app-status").eq(0).contains("Unpublished")
|
||||||
appStatusEle.get(".app-status").eq(0).contains("Unpublished")
|
|
||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue