appOverview Refactor + Commands update

Refactoring tests within appOverview.spec.js

Commands
- refactoring the deleteApp command (works better with new UI)
This commit is contained in:
Mitch-Budibase 2022-06-28 18:01:04 +01:00
parent 60592616f8
commit 5fb18d4d79
2 changed files with 15 additions and 19 deletions

View File

@ -158,8 +158,9 @@ filterTests(["all"], () => {
.contains("Manage") .contains("Manage")
.eq(0) .eq(0)
.click({ force: true }) .click({ force: true })
cy.get(".app-icon", { timwout: 1000 }).click({ force: true }) cy.get(".edit-hover", { timeout: 1000 }).eq(0).click({ force: true })
// Select random icon // Select random icon
cy.wait(400)
cy.get(".grid").within(() => { cy.get(".grid").within(() => {
cy.get(".icon-item") cy.get(".icon-item")
.eq(Math.floor(Math.random() * 23) + 1) .eq(Math.floor(Math.random() * 23) + 1)
@ -178,6 +179,7 @@ filterTests(["all"], () => {
cy.get("@iconChange").its("response.statusCode").should("eq", 200) cy.get("@iconChange").its("response.statusCode").should("eq", 200)
// Confirm icon has changed from default // Confirm icon has changed from default
// Confirm colour has been applied // Confirm colour has been applied
cy.get(".spectrum-ActionButton-label").contains("Back").click({ force: true })
cy.get(".appTable", { timeout: 2000 }).within(() => { cy.get(".appTable", { timeout: 2000 }).within(() => {
cy.get("[aria-label]") cy.get("[aria-label]")
.eq(0) .eq(0)
@ -368,10 +370,10 @@ filterTests(["all"], () => {
.contains("Copy App ID") .contains("Copy App ID")
.click({ force: true }) .click({ force: true })
}) })
cy.get(".spectrum-Toast-content") cy.get(".spectrum-Toast-content")
.contains("App ID copied to clipboard.") .contains("App ID copied to clipboard.")
.should("be.visible") .should("be.visible")
}) })
it("Should allow unpublishing of the application", () => { it("Should allow unpublishing of the application", () => {
@ -380,15 +382,9 @@ filterTests(["all"], () => {
.contains("Manage") .contains("Manage")
.eq(0) .eq(0)
.click({ force: true }) .click({ force: true })
cy.get(".app-overview-actions-icon > .icon").click({ force: true })
cy.get("[data-cy='app-overview-menu-popover']") cy.get(`[data-cy="app-status"]`).within(() => {
.eq(0) cy.contains("Unpublish").click({ force: true })
.within(() => {
cy.get(".spectrum-Menu-item")
.contains("Unpublish")
.click({ force: true })
cy.wait(500)
}) })
cy.get("[data-cy='unpublish-modal']") cy.get("[data-cy='unpublish-modal']")
@ -399,9 +395,8 @@ filterTests(["all"], () => {
cy.get(".overview-tab [data-cy='app-status']").within(() => { cy.get(".overview-tab [data-cy='app-status']").within(() => {
cy.get(".status-display").contains("Unpublished") cy.get(".status-display").contains("Unpublished")
cy.get(".status-display .icon svg[aria-label='GlobeStrike']").should( cy.get(".status-display .icon svg[aria-label='GlobeStrike']")
"exist" .should("exist")
)
}) })
}) })

View File

@ -188,14 +188,15 @@ Cypress.Commands.add("deleteApp", name => {
cy.get(actionEleId).within(() => { cy.get(actionEleId).within(() => {
cy.contains("Manage").click({ force: true }) cy.contains("Manage").click({ force: true })
}) })
cy.wait(1000) cy.wait(500)
// Unpublish first if needed // Unpublish first if needed
cy.get(`[data-cy="app-status"]`).then($status => { cy.get(`[data-cy="app-status"]`).then($status => {
if ($status.text().includes("Last published")) { if ($status.text().includes("- Unpublish")) {
cy.contains("Unpublish").click() // Exact match for Unpublish
cy.contains("Unpublish").click({ force: true })
cy.get(".spectrum-Modal").within(() => { cy.get(".spectrum-Modal").within(() => {
cy.contains("Unpublish app").click() cy.contains("Unpublish app").click({ force: true })
}) })
} }
}) })