2022-01-21 13:43:27 +01:00
|
|
|
import filterTests from '../support/filterTests'
|
2022-05-16 14:32:04 +02:00
|
|
|
const interact = require('../support/interact')
|
2022-01-21 13:43:27 +01:00
|
|
|
|
|
|
|
filterTests(['smoke', 'all'], () => {
|
2022-02-17 15:06:17 +01:00
|
|
|
context("Create an Application", () => {
|
2022-03-29 00:21:38 +02:00
|
|
|
|
2022-04-01 12:31:18 +02:00
|
|
|
before(() => {
|
2022-01-21 13:43:27 +01:00
|
|
|
cy.login()
|
2022-04-01 12:31:18 +02:00
|
|
|
cy.deleteApp("Cypress Tests")
|
2022-03-29 00:21:38 +02:00
|
|
|
})
|
|
|
|
|
2022-04-01 12:31:18 +02:00
|
|
|
if (!(Cypress.env("TEST_ENV"))) {
|
|
|
|
it("should show the new user UI/UX", () => {
|
2022-05-16 14:32:04 +02:00
|
|
|
cy.visit(`${Cypress.config().baseUrl}/builder/portal/apps/create`) //added /portal/apps/create
|
|
|
|
cy.get(interact.CREATE_APP_BUTTON).contains('Start from scratch').should("exist")
|
|
|
|
cy.get(interact.CREATE_APP_BUTTON).should("exist")
|
2022-04-01 12:31:18 +02:00
|
|
|
|
2022-05-16 14:32:04 +02:00
|
|
|
cy.get(interact.TEMPLATE_CATEGORY_FILTER).should("exist")
|
|
|
|
cy.get(interact.TEMPLATE_CATEGORY).should("exist")
|
2022-04-01 12:31:18 +02:00
|
|
|
|
2022-05-16 14:32:04 +02:00
|
|
|
cy.get(interact.APP_TABLE).should("not.exist")
|
2022-04-01 12:31:18 +02:00
|
|
|
})
|
|
|
|
}
|
2022-03-29 00:21:38 +02:00
|
|
|
|
|
|
|
it("should provide filterable templates", () => {
|
|
|
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
|
|
|
cy.wait(500)
|
|
|
|
|
2022-04-12 18:24:15 +02:00
|
|
|
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`)
|
|
|
|
.its("body")
|
|
|
|
.then(val => {
|
|
|
|
if (val.length > 0) {
|
2022-05-16 14:32:04 +02:00
|
|
|
cy.get(interact.SPECTRUM_BUTTON_TEMPLATE).contains("Templates").click({force: true})
|
2022-04-12 18:24:15 +02:00
|
|
|
}
|
|
|
|
})
|
2022-04-01 12:31:18 +02:00
|
|
|
|
2022-05-16 14:32:04 +02:00
|
|
|
cy.get(interact.TEMPLATE_CATEGORY_FILTER).should("exist")
|
|
|
|
cy.get(interact.TEMPLATE_CATEGORY).should("exist")
|
2022-03-29 00:21:38 +02:00
|
|
|
|
2022-05-16 14:32:04 +02:00
|
|
|
cy.get(interact.TEMPLATE_CATEGORY_ACTIONGROUP).its('length').should('be.gt', 1)
|
|
|
|
cy.get(interact.TEMPLATE_CATEGORY_FILTER_ACTIONBUTTON).its('length').should('be.gt', 2)
|
2022-03-29 00:21:38 +02:00
|
|
|
|
2022-05-16 14:32:04 +02:00
|
|
|
cy.get(interact.TEMPLATE_CATEGORY_FILTER_ACTIONBUTTON).eq(1).click()
|
|
|
|
cy.get(interact.TEMPLATE_CATEGORY_ACTIONGROUP).should('have.length', 1)
|
2022-03-29 00:21:38 +02:00
|
|
|
|
2022-05-16 14:32:04 +02:00
|
|
|
cy.get(interact.TEMPLATE_CATEGORY_FILTER_ACTIONBUTTON).eq(0).click()
|
|
|
|
cy.get(interact.TEMPLATE_CATEGORY_ACTIONGROUP).its('length').should('be.gt', 1)
|
2022-03-29 00:21:38 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it("should enforce a valid url before submission", () => {
|
2022-01-21 13:43:27 +01:00
|
|
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
2022-03-29 00:21:38 +02:00
|
|
|
cy.wait(500)
|
|
|
|
|
2022-04-01 12:31:18 +02:00
|
|
|
// Start create app process. If apps already exist, click second button
|
2022-05-16 14:32:04 +02:00
|
|
|
cy.get(interact.CREATE_APP_BUTTON).click({ force: true })
|
2022-04-01 12:31:18 +02:00
|
|
|
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`)
|
|
|
|
.its("body")
|
|
|
|
.then(val => {
|
|
|
|
if (val.length > 0) {
|
2022-05-16 14:32:04 +02:00
|
|
|
cy.get(interact.CREATE_APP_BUTTON).click({ force: true })
|
2022-04-01 12:31:18 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
const appName = "Cypress Tests"
|
2022-05-16 14:32:04 +02:00
|
|
|
cy.get(interact.SPECTRUM_MODAL).within(() => {
|
2022-03-29 00:21:38 +02:00
|
|
|
|
|
|
|
//Auto fill
|
2022-05-16 14:32:04 +02:00
|
|
|
cy.get(interact.APP_NAME_INPUT).eq(0).type(appName).should("have.value", appName).blur()
|
|
|
|
cy.get(interact.APP_NAME_INPUT).eq(1).should("have.value", "/cypress-tests")
|
|
|
|
cy.get(interact.SPECTRUM_BUTTON_GROUP).contains("Create app").should('not.be.disabled')
|
2022-03-29 00:21:38 +02:00
|
|
|
|
|
|
|
//Empty the app url - disabled create
|
2022-05-16 14:32:04 +02:00
|
|
|
cy.get(interact.APP_NAME_INPUT).eq(1).clear().blur()
|
|
|
|
cy.get(interact.SPECTRUM_BUTTON_GROUP).contains("Create app").should('be.disabled')
|
2022-03-29 00:21:38 +02:00
|
|
|
|
|
|
|
//Invalid url
|
2022-05-16 14:32:04 +02:00
|
|
|
cy.get(interact.APP_NAME_INPUT).eq(1).type("/new app-url").blur()
|
|
|
|
cy.get(interact.SPECTRUM_BUTTON_GROUP).contains("Create app").should('be.disabled')
|
2022-03-29 00:21:38 +02:00
|
|
|
|
|
|
|
//Specifically alter the url
|
2022-05-16 14:32:04 +02:00
|
|
|
cy.get(interact.APP_NAME_INPUT).eq(1).clear()
|
|
|
|
cy.get(interact.APP_NAME_INPUT).eq(1).type("another-app-name").blur()
|
|
|
|
cy.get(interact.APP_NAME_INPUT).eq(1).should("have.value", "/another-app-name")
|
|
|
|
cy.get(interact.APP_NAME_INPUT).eq(0).should("have.value", appName)
|
|
|
|
cy.get(interact.SPECTRUM_BUTTON_GROUP).contains("Create app").should('not.be.disabled')
|
2022-03-29 00:21:38 +02:00
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it("should create the first application from scratch", () => {
|
|
|
|
const appName = "Cypress Tests"
|
2022-04-01 12:31:18 +02:00
|
|
|
cy.createApp(appName)
|
2022-03-29 00:21:38 +02:00
|
|
|
|
|
|
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
|
|
|
cy.wait(1000)
|
|
|
|
|
|
|
|
cy.applicationInAppTable(appName)
|
|
|
|
cy.deleteApp(appName)
|
2022-01-21 13:43:27 +01:00
|
|
|
})
|
2022-03-29 00:21:38 +02:00
|
|
|
|
|
|
|
it("should generate the first application from a template", () => {
|
|
|
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
|
|
|
cy.wait(500)
|
|
|
|
|
2022-04-01 12:31:18 +02:00
|
|
|
// Navigate to Create new app section if apps already exist
|
|
|
|
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`)
|
|
|
|
.its("body")
|
|
|
|
.then(val => {
|
|
|
|
if (val.length > 0) {
|
2022-05-16 14:32:04 +02:00
|
|
|
cy.get(interact.CREATE_APP_BUTTON).click({ force: true })
|
2022-04-01 12:31:18 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2022-05-16 14:32:04 +02:00
|
|
|
cy.get(interact.TEMPLATE_CATEGORY_FILTER).should("exist")
|
|
|
|
cy.get(interact.TEMPLATE_CATEGORY).should("exist")
|
2022-03-29 00:21:38 +02:00
|
|
|
|
2022-04-01 12:31:18 +02:00
|
|
|
// Select template
|
2022-05-16 14:32:04 +02:00
|
|
|
cy.get(interact.TEMPLATE_CATEGORY_ACTIONGROUP).eq(0).within(() => {
|
2022-03-29 00:21:38 +02:00
|
|
|
const card = cy.get('.template-card').eq(0).should("exist");
|
|
|
|
const cardOverlay = card.get('.template-thumbnail-action-overlay').should("exist")
|
|
|
|
cardOverlay.invoke("show")
|
|
|
|
cardOverlay.get("button").contains("Use template").should("exist").click({force: true})
|
|
|
|
})
|
|
|
|
|
2022-04-01 12:31:18 +02:00
|
|
|
// CMD Create app from theme card
|
2022-03-29 00:21:38 +02:00
|
|
|
cy.get(".spectrum-Modal").should('be.visible')
|
|
|
|
|
|
|
|
const templateName = cy.get(".spectrum-Modal .template-thumbnail-text")
|
|
|
|
templateName.invoke('text')
|
|
|
|
.then(templateNameText => {
|
|
|
|
const templateNameParsed = "/"+templateNameText.toLowerCase().replace(/\s+/g, "-")
|
2022-05-16 14:32:04 +02:00
|
|
|
cy.get(interact.SPECTRUM_MODAL_INPUT).eq(0).should("have.value", templateNameText)
|
|
|
|
cy.get(interact.SPECTRUM_MODAL_INPUT).eq(1).should("have.value", templateNameParsed)
|
2022-03-29 00:21:38 +02:00
|
|
|
|
|
|
|
cy.get(".spectrum-Modal .spectrum-ButtonGroup").contains("Create app").click()
|
|
|
|
cy.wait(5000)
|
|
|
|
|
|
|
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
2022-05-11 22:13:57 +02:00
|
|
|
cy.wait(2000)
|
2022-03-29 00:21:38 +02:00
|
|
|
|
|
|
|
cy.applicationInAppTable(templateNameText)
|
2022-04-01 12:31:18 +02:00
|
|
|
cy.deleteApp(templateNameText)
|
2022-03-29 00:21:38 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
it("should display a second application and app filtering", () => {
|
2022-04-01 12:31:18 +02:00
|
|
|
// Create first app
|
2022-03-29 00:21:38 +02:00
|
|
|
const appName = "Cypress Tests"
|
2022-04-01 12:31:18 +02:00
|
|
|
cy.createApp(appName)
|
2022-03-29 00:21:38 +02:00
|
|
|
|
|
|
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
|
|
|
cy.wait(500)
|
|
|
|
|
2022-04-01 12:31:18 +02:00
|
|
|
// Create second app
|
2022-03-29 00:21:38 +02:00
|
|
|
const secondAppName = "Second App Demo"
|
2022-04-01 12:31:18 +02:00
|
|
|
cy.createApp(secondAppName)
|
2022-03-29 00:21:38 +02:00
|
|
|
|
|
|
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
|
|
|
cy.wait(500)
|
|
|
|
|
|
|
|
//Both applications should exist and be searchable
|
|
|
|
cy.searchForApplication(appName)
|
|
|
|
cy.searchForApplication(secondAppName)
|
|
|
|
|
2022-04-01 12:31:18 +02:00
|
|
|
cy.deleteApp(secondAppName)
|
2022-03-29 00:21:38 +02:00
|
|
|
})
|
|
|
|
|
2022-01-21 13:43:27 +01:00
|
|
|
})
|
2020-06-09 13:52:19 +02:00
|
|
|
})
|