2022-01-21 13:43:27 +01:00
|
|
|
import filterTests from "../support/filterTests"
|
2022-06-15 16:08:03 +02:00
|
|
|
const interact = require("../support/interact")
|
2021-10-15 18:36:10 +02:00
|
|
|
|
2022-06-15 16:08:03 +02:00
|
|
|
filterTests(["all"], () => {
|
2022-10-27 12:01:16 +02:00
|
|
|
xcontext("Rename an App", () => {
|
2022-03-29 00:21:38 +02:00
|
|
|
beforeEach(() => {
|
|
|
|
cy.login()
|
|
|
|
cy.createTestApp()
|
|
|
|
})
|
2021-10-15 18:36:10 +02:00
|
|
|
|
2022-01-21 13:43:27 +01:00
|
|
|
it("should rename an unpublished application", () => {
|
2022-03-29 00:21:38 +02:00
|
|
|
const appName = "Cypress Tests"
|
|
|
|
const appRename = "Cypress Renamed"
|
|
|
|
// Rename app, Search for app, Confirm name was changed
|
2022-07-07 12:07:05 +02:00
|
|
|
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 })
|
2022-03-29 00:21:38 +02:00
|
|
|
renameApp(appName, appRename)
|
|
|
|
cy.reload()
|
2022-04-01 12:31:18 +02:00
|
|
|
cy.searchForApplication(appRename)
|
2022-06-13 11:18:18 +02:00
|
|
|
cy.get(interact.APP_TABLE).find(interact.TITLE).should("have.length", 1)
|
2022-03-29 00:21:38 +02:00
|
|
|
cy.applicationInAppTable(appRename)
|
|
|
|
// Set app name back to Cypress Tests
|
|
|
|
cy.reload()
|
|
|
|
renameApp(appRename, appName)
|
2022-01-21 13:43:27 +01:00
|
|
|
})
|
2022-03-29 00:21:38 +02:00
|
|
|
|
2022-01-21 13:43:27 +01:00
|
|
|
xit("Should rename a published application", () => {
|
2022-03-29 00:21:38 +02:00
|
|
|
// It is not possible to rename a published application
|
|
|
|
const appName = "Cypress Tests"
|
|
|
|
const appRename = "Cypress Renamed"
|
|
|
|
// Publish the app
|
2022-06-13 11:18:18 +02:00
|
|
|
cy.get(interact.TOP_RIGHT_NAV)
|
2022-06-15 16:08:03 +02:00
|
|
|
cy.get(interact.SPECTRUM_BUTTON)
|
|
|
|
.contains("Publish")
|
|
|
|
.click({ force: true })
|
|
|
|
cy.get(interact.SPECTRUM_DIALOG_GRID).within(() => {
|
|
|
|
// Click publish again within the modal
|
|
|
|
cy.get(interact.SPECTRUM_BUTTON)
|
|
|
|
.contains("Publish")
|
|
|
|
.click({ force: true })
|
|
|
|
})
|
2022-03-29 00:21:38 +02:00
|
|
|
// Rename app, Search for app, Confirm name was changed
|
2022-07-07 12:07:05 +02:00
|
|
|
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 })
|
2022-03-29 00:21:38 +02:00
|
|
|
renameApp(appName, appRename, true)
|
2022-06-13 11:18:18 +02:00
|
|
|
cy.get(interact.APP_TABLE).find(interact.WRAPPER).should("have.length", 1)
|
2022-03-29 00:21:38 +02:00
|
|
|
cy.applicationInAppTable(appRename)
|
2022-01-21 13:43:27 +01:00
|
|
|
})
|
2021-10-15 18:36:10 +02:00
|
|
|
|
2022-01-21 13:43:27 +01:00
|
|
|
it("Should try to rename an application to have no name", () => {
|
2022-03-29 00:21:38 +02:00
|
|
|
const appName = "Cypress Tests"
|
2022-07-07 12:07:05 +02:00
|
|
|
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 })
|
2022-03-29 00:21:38 +02:00
|
|
|
renameApp(appName, " ", false, true)
|
|
|
|
// Close modal and confirm name has not been changed
|
2022-06-17 18:45:43 +02:00
|
|
|
cy.get(interact.SPECTRUM_DIALOG_GRID, { timeout: 1000 }).contains("Cancel").click()
|
2022-03-29 00:21:38 +02:00
|
|
|
cy.applicationInAppTable(appName)
|
2021-10-15 18:36:10 +02:00
|
|
|
})
|
|
|
|
|
2022-01-21 13:43:27 +01:00
|
|
|
xit("Should create two applications with the same name", () => {
|
2022-03-29 00:21:38 +02:00
|
|
|
// It is not possible to have applications with the same name
|
|
|
|
const appName = "Cypress Tests"
|
2022-07-07 12:07:05 +02:00
|
|
|
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 })
|
2022-06-20 19:42:38 +02:00
|
|
|
cy.get(interact.SPECTRUM_BUTTON), { timeout: 500 }
|
2022-06-15 16:08:03 +02:00
|
|
|
.contains("Create app")
|
|
|
|
.click({ force: true })
|
2022-03-29 00:21:38 +02:00
|
|
|
cy.contains(/Start from scratch/).click()
|
2022-06-15 16:08:03 +02:00
|
|
|
cy.get(interact.SPECTRUM_MODAL).within(() => {
|
|
|
|
cy.get("input").eq(0).type(appName)
|
|
|
|
cy.get(interact.SPECTRUM_BUTTON_GROUP)
|
|
|
|
.contains("Create app")
|
|
|
|
.click({ force: true })
|
|
|
|
cy.get(interact.ERROR).should(
|
|
|
|
"have.text",
|
|
|
|
"Another app with the same name already exists"
|
|
|
|
)
|
|
|
|
})
|
2022-01-21 13:43:27 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
it("should validate application names", () => {
|
2022-03-29 00:21:38 +02:00
|
|
|
// App name must be letters, numbers and spaces only
|
|
|
|
// This test checks numbers and special characters specifically
|
|
|
|
const appName = "Cypress Tests"
|
|
|
|
const numberName = 12345
|
|
|
|
const specialCharName = "£$%^"
|
2022-07-07 12:07:05 +02:00
|
|
|
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 })
|
2022-03-29 00:21:38 +02:00
|
|
|
renameApp(appName, numberName)
|
|
|
|
cy.applicationInAppTable(numberName)
|
|
|
|
renameApp(numberName, specialCharName)
|
2022-06-15 16:08:03 +02:00
|
|
|
cy.get(interact.ERROR).should(
|
|
|
|
"have.text",
|
|
|
|
"App name must be letters, numbers and spaces only"
|
|
|
|
)
|
2022-03-29 00:21:38 +02:00
|
|
|
// Set app name back to Cypress Tests
|
|
|
|
renameApp(numberName, appName)
|
2022-01-21 13:43:27 +01:00
|
|
|
})
|
2022-03-29 00:21:38 +02:00
|
|
|
|
|
|
|
const renameApp = (originalName, changedName, published, noName) => {
|
2022-04-01 12:31:18 +02:00
|
|
|
cy.searchForApplication(originalName)
|
2022-06-20 19:42:38 +02:00
|
|
|
cy.get(interact.APP_TABLE, { timeout: 1000 }).within(() => {
|
2022-06-15 16:08:03 +02:00
|
|
|
cy.get(".app-row-actions button")
|
|
|
|
.contains("Manage")
|
|
|
|
.eq(0)
|
|
|
|
.click({ force: true })
|
2022-04-20 10:17:01 +02:00
|
|
|
})
|
2022-06-15 16:08:03 +02:00
|
|
|
cy.get(".spectrum-Tabs-item").contains("Settings").click()
|
|
|
|
cy.get(".spectrum-Tabs-item.is-selected").contains("Settings")
|
|
|
|
cy.get(".settings-tab").should("be.visible")
|
|
|
|
cy.get(".details-section .page-action button")
|
|
|
|
.contains("Edit")
|
|
|
|
.click({ force: true })
|
2022-05-11 20:37:12 +02:00
|
|
|
cy.updateAppName(changedName, noName)
|
|
|
|
}
|
|
|
|
})
|
2021-10-15 18:36:10 +02:00
|
|
|
})
|