Changing test structure when searching for applications

Search functionality is not available when only 1 app exists - Updating to reflect this
This commit is contained in:
Mitch-Budibase 2022-04-01 14:37:11 +01:00
parent 4ad60322ab
commit b64b5edaa7
2 changed files with 46 additions and 42 deletions

View File

@ -79,7 +79,8 @@ filterTests(['all'], () => {
const appName = "Cypress Tests" const appName = "Cypress Tests"
const numberName = 12345 const numberName = 12345
const specialCharName = "£$%^" const specialCharName = "£$%^"
cy.get(".home-logo").click() cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.wait(500)
renameApp(appName, numberName) renameApp(appName, numberName)
cy.reload() cy.reload()
cy.wait(1000) cy.wait(1000)
@ -95,12 +96,7 @@ filterTests(['all'], () => {
}) })
const renameApp = (originalName, changedName, published, noName) => { const renameApp = (originalName, changedName, published, noName) => {
cy.wait(2000)
cy.searchForApplication(originalName) cy.searchForApplication(originalName)
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`)
.its("body")
.then(val => {
if (val.length > 0) {
cy.get(".appTable") cy.get(".appTable")
.within(() => { .within(() => {
cy.get(".spectrum-Icon").eq(1).click() cy.get(".spectrum-Icon").eq(1).click()
@ -129,7 +125,4 @@ filterTests(['all'], () => {
}) })
} }
}) })
}
})
}) })

View File

@ -344,6 +344,15 @@ Cypress.Commands.add("addCustomSourceOptions", totalOptions => {
Cypress.Commands.add("searchForApplication", appName => { Cypress.Commands.add("searchForApplication", appName => {
cy.visit(`${Cypress.config().baseUrl}/builder`) cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.wait(2000) cy.wait(2000)
// No app filter functionality if only 1 app exists
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`)
.its("body")
.then(val => {
if (val.length < 2) {
return
}
else {
// Searches for the app // Searches for the app
cy.get(".filter").then(() => { cy.get(".filter").then(() => {
cy.get(".spectrum-Textfield").within(() => { cy.get(".spectrum-Textfield").within(() => {
@ -351,6 +360,8 @@ Cypress.Commands.add("searchForApplication", appName => {
cy.get("input").eq(0).type(appName) cy.get("input").eq(0).type(appName)
}) })
}) })
}
})
}) })
//Assumes there are no others //Assumes there are no others