|
|
|
@ -79,7 +79,8 @@ filterTests(['all'], () => { |
|
|
|
const appName = "Cypress Tests" |
|
|
|
const numberName = 12345 |
|
|
|
const specialCharName = "£$%^" |
|
|
|
cy.get(".home-logo").click() |
|
|
|
cy.visit(`${Cypress.config().baseUrl}/builder`) |
|
|
|
cy.wait(500) |
|
|
|
renameApp(appName, numberName) |
|
|
|
cy.reload() |
|
|
|
cy.wait(1000) |
|
|
|
@ -95,41 +96,33 @@ filterTests(['all'], () => { |
|
|
|
}) |
|
|
|
|
|
|
|
const renameApp = (originalName, changedName, published, noName) => { |
|
|
|
cy.wait(2000) |
|
|
|
cy.searchForApplication(originalName) |
|
|
|
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`) |
|
|
|
.its("body") |
|
|
|
.then(val => { |
|
|
|
if (val.length > 0) { |
|
|
|
cy.get(".appTable") |
|
|
|
.within(() => { |
|
|
|
cy.get(".spectrum-Icon").eq(1).click() |
|
|
|
}) |
|
|
|
// Check for when an app is published
|
|
|
|
if (published == true) { |
|
|
|
// Should not have Edit as option, will unpublish app
|
|
|
|
cy.should("not.have.value", "Edit") |
|
|
|
cy.get(".spectrum-Menu").contains("Unpublish").click() |
|
|
|
cy.get(".spectrum-Dialog-grid").contains("Unpublish app").click() |
|
|
|
cy.get(".appTable > :nth-child(5) > :nth-child(2) > .spectrum-Icon").click() |
|
|
|
cy.get(".appTable") |
|
|
|
.within(() => { |
|
|
|
cy.get(".spectrum-Icon").eq(1).click() |
|
|
|
}) |
|
|
|
// Check for when an app is published
|
|
|
|
if (published == true) { |
|
|
|
// Should not have Edit as option, will unpublish app
|
|
|
|
cy.should("not.have.value", "Edit") |
|
|
|
cy.get(".spectrum-Menu").contains("Unpublish").click() |
|
|
|
cy.get(".spectrum-Dialog-grid").contains("Unpublish app").click() |
|
|
|
cy.get(".appTable > :nth-child(5) > :nth-child(2) > .spectrum-Icon").click() |
|
|
|
} |
|
|
|
cy.contains("Edit").click() |
|
|
|
cy.get(".spectrum-Modal") |
|
|
|
.within(() => { |
|
|
|
if (noName == true) { |
|
|
|
cy.get("input").clear() |
|
|
|
cy.get(".spectrum-Dialog-grid").click() |
|
|
|
.contains("App name must be letters, numbers and spaces only") |
|
|
|
return cy |
|
|
|
} |
|
|
|
cy.contains("Edit").click() |
|
|
|
cy.get(".spectrum-Modal") |
|
|
|
.within(() => { |
|
|
|
if (noName == true) { |
|
|
|
cy.get("input").clear() |
|
|
|
cy.get(".spectrum-Dialog-grid").click() |
|
|
|
.contains("App name must be letters, numbers and spaces only") |
|
|
|
return cy |
|
|
|
} |
|
|
|
cy.get("input").clear() |
|
|
|
cy.get("input").eq(0).type(changedName).should("have.value", changedName).blur() |
|
|
|
cy.get(".spectrum-ButtonGroup").contains("Save").click({ force: true }) |
|
|
|
cy.wait(500) |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
cy.get("input").clear() |
|
|
|
cy.get("input").eq(0).type(changedName).should("have.value", changedName).blur() |
|
|
|
cy.get(".spectrum-ButtonGroup").contains("Save").click({ force: true }) |
|
|
|
cy.wait(500) |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|