Updated deleteApp function

Added a check for app name, function returns if app does not exist, rather than trying to delete
This commit is contained in:
Mitch-Budibase 2022-04-12 15:59:12 +01:00
parent 4340a46fe7
commit 87ac25bcea
1 changed files with 41 additions and 35 deletions

View File

@ -60,6 +60,8 @@ Cypress.Commands.add("deleteApp", name => {
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`) cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`)
.its("body") .its("body")
.then(val => { .then(val => {
const findAppName = val.some(val => val.name == name)
if (findAppName) {
if (val.length > 0) { if (val.length > 0) {
if (Cypress.env("TEST_ENV")) { if (Cypress.env("TEST_ENV")) {
cy.searchForApplication(name) cy.searchForApplication(name)
@ -100,6 +102,10 @@ Cypress.Commands.add("deleteApp", name => {
} else { } else {
return return
} }
}
else {
return
}
}) })
}) })