Cypress test fixes and refactoring around the create app workflows
This commit is contained in:
parent
c353adf151
commit
f512441f11
|
@ -6,9 +6,13 @@ filterTests(['all'], () => {
|
||||||
cy.login()
|
cy.login()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
after(() => {
|
||||||
|
cy.deleteAllApps()
|
||||||
|
})
|
||||||
|
|
||||||
it("should change the icon and colour for an application", () => {
|
it("should change the icon and colour for an application", () => {
|
||||||
// Search for test application
|
// Search for test application
|
||||||
cy.searchForApplication("Cypress Tests")
|
cy.applicationInAppTable("Cypress Tests")
|
||||||
cy.get(".appTable")
|
cy.get(".appTable")
|
||||||
.within(() => {
|
.within(() => {
|
||||||
cy.get(".spectrum-Icon").eq(1).click()
|
cy.get(".spectrum-Icon").eq(1).click()
|
||||||
|
|
|
@ -2,11 +2,146 @@ import filterTests from '../support/filterTests'
|
||||||
|
|
||||||
filterTests(['smoke', 'all'], () => {
|
filterTests(['smoke', 'all'], () => {
|
||||||
context("Create an Application", () => {
|
context("Create an Application", () => {
|
||||||
it("should create a new application", () => {
|
|
||||||
|
beforeEach(() => {
|
||||||
cy.login()
|
cy.login()
|
||||||
cy.createTestApp()
|
|
||||||
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
|
||||||
cy.contains("Cypress Tests").should("exist")
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("should show the new user UI/UX", () => {
|
||||||
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||||
|
cy.get(`[data-cy="create-app-btn"]`).contains('Start from scratch').should("exist")
|
||||||
|
cy.get(`[data-cy="import-app-btn"]`).should("exist")
|
||||||
|
|
||||||
|
cy.get(".template-category-filters").should("exist")
|
||||||
|
cy.get(".template-categories").should("exist")
|
||||||
|
|
||||||
|
cy.get(".appTable").should("not.exist")
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should provide filterable templates", () => {
|
||||||
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||||
|
cy.wait(500)
|
||||||
|
|
||||||
|
cy.get(".template-category-filters").should("exist")
|
||||||
|
cy.get(".template-categories").should("exist")
|
||||||
|
|
||||||
|
cy.get(".template-category").its('length').should('be.gt', 1)
|
||||||
|
cy.get(".template-category-filters .spectrum-ActionButton").its('length').should('be.gt', 2)
|
||||||
|
|
||||||
|
cy.get(".template-category-filters .spectrum-ActionButton").eq(1).click()
|
||||||
|
cy.get(".template-category").should('have.length', 1)
|
||||||
|
|
||||||
|
cy.get(".template-category-filters .spectrum-ActionButton").eq(0).click()
|
||||||
|
cy.get(".template-category").its('length').should('be.gt', 1)
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should enforce a valid url before submission", () => {
|
||||||
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||||
|
cy.wait(500)
|
||||||
|
|
||||||
|
const appName = "A New App"
|
||||||
|
|
||||||
|
cy.get(`[data-cy="create-app-btn"]`).contains('Start from scratch').click({force: true})
|
||||||
|
cy.get(".spectrum-Modal").within(() => {
|
||||||
|
|
||||||
|
//Auto fill
|
||||||
|
cy.get("input").eq(0).type(appName).should("have.value", appName).blur()
|
||||||
|
cy.get("input").eq(1).should("have.value", "/a-new-app")
|
||||||
|
cy.get(".spectrum-ButtonGroup").contains("Create app").should('not.be.disabled')
|
||||||
|
|
||||||
|
//Empty the app url - disabled create
|
||||||
|
cy.get("input").eq(1).clear().blur()
|
||||||
|
cy.get(".spectrum-ButtonGroup").contains("Create app").should('be.disabled')
|
||||||
|
|
||||||
|
//Invalid url
|
||||||
|
cy.get("input").eq(1).type("/new app-url").blur()
|
||||||
|
cy.get(".spectrum-ButtonGroup").contains("Create app").should('be.disabled')
|
||||||
|
|
||||||
|
//Specifically alter the url
|
||||||
|
cy.get("input").eq(1).clear()
|
||||||
|
cy.get("input").eq(1).type("another-app-name").blur()
|
||||||
|
cy.get("input").eq(1).should("have.value", "/another-app-name")
|
||||||
|
cy.get("input").eq(0).should("have.value", appName)
|
||||||
|
cy.get(".spectrum-ButtonGroup").contains("Create app").should('not.be.disabled')
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should create the first application from scratch", () => {
|
||||||
|
const appName = "Cypress Tests"
|
||||||
|
cy.deleteApp(appName)
|
||||||
|
cy.createApp(appName, "This app is used for Cypress testing.")
|
||||||
|
|
||||||
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||||
|
cy.wait(1000)
|
||||||
|
|
||||||
|
cy.applicationInAppTable(appName)
|
||||||
|
cy.deleteApp(appName)
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should generate the first application from a template", () => {
|
||||||
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||||
|
cy.wait(500)
|
||||||
|
|
||||||
|
cy.get(".template-category-filters").should("exist")
|
||||||
|
cy.get(".template-categories").should("exist")
|
||||||
|
|
||||||
|
//### Select nth template and choose to create?
|
||||||
|
cy.get('.template-category').eq(0).within(() => {
|
||||||
|
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})
|
||||||
|
})
|
||||||
|
|
||||||
|
//### CMD Create app from theme card
|
||||||
|
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, "-")
|
||||||
|
cy.get(".spectrum-Modal input").eq(0).should("have.value", templateNameText)
|
||||||
|
cy.get(".spectrum-Modal input").eq(1).should("have.value", templateNameParsed)
|
||||||
|
|
||||||
|
cy.get(".spectrum-Modal .spectrum-ButtonGroup").contains("Create app").click()
|
||||||
|
cy.wait(5000)
|
||||||
|
|
||||||
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||||
|
cy.wait(1000)
|
||||||
|
|
||||||
|
cy.applicationInAppTable(templateNameText)
|
||||||
|
cy.deleteAllApps()
|
||||||
|
});
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should display a second application and app filtering", () => {
|
||||||
|
const appName = "Cypress Tests"
|
||||||
|
cy.deleteApp(appName)
|
||||||
|
cy.createApp(appName, "This app is used for Cypress testing.")
|
||||||
|
|
||||||
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||||
|
cy.wait(500)
|
||||||
|
|
||||||
|
const secondAppName = "Second App Demo"
|
||||||
|
cy.deleteApp(secondAppName)
|
||||||
|
|
||||||
|
cy.get(`[data-cy="create-app-btn"]`).contains('Create new app').click({force: true})
|
||||||
|
cy.wait(500)
|
||||||
|
cy.url().should('include', '/builder/portal/apps/create')
|
||||||
|
|
||||||
|
cy.createAppFromScratch(secondAppName)
|
||||||
|
|
||||||
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||||
|
cy.wait(500)
|
||||||
|
|
||||||
|
//Both applications should exist and be searchable
|
||||||
|
cy.searchForApplication(appName)
|
||||||
|
cy.searchForApplication(secondAppName)
|
||||||
|
|
||||||
|
cy.deleteAllApps()
|
||||||
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -7,6 +7,10 @@ filterTests(["smoke", "all"], () => {
|
||||||
cy.createTestApp()
|
cy.createTestApp()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
after(() => {
|
||||||
|
cy.deleteAllApps()
|
||||||
|
})
|
||||||
|
|
||||||
it("should create a new Table", () => {
|
it("should create a new Table", () => {
|
||||||
cy.createTable("dog")
|
cy.createTable("dog")
|
||||||
cy.wait(1000)
|
cy.wait(1000)
|
||||||
|
|
|
@ -4,9 +4,14 @@ filterTests(["smoke", "all"], () => {
|
||||||
context("Create a User and Assign Roles", () => {
|
context("Create a User and Assign Roles", () => {
|
||||||
before(() => {
|
before(() => {
|
||||||
cy.login()
|
cy.login()
|
||||||
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||||
|
cy.wait(500)
|
||||||
|
cy.createAppFromScratch("Initial App")
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should create a user", () => {
|
it("should create a user", () => {
|
||||||
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||||
|
cy.wait(1000)
|
||||||
cy.createUser("bbuser@test.com")
|
cy.createUser("bbuser@test.com")
|
||||||
cy.get(".spectrum-Table").should("contain", "bbuser")
|
cy.get(".spectrum-Table").should("contain", "bbuser")
|
||||||
})
|
})
|
||||||
|
@ -30,7 +35,14 @@ filterTests(["smoke", "all"], () => {
|
||||||
for (let i = 1; i < 3; i++) {
|
for (let i = 1; i < 3; i++) {
|
||||||
const uuid = () => Cypress._.random(0, 1e6)
|
const uuid = () => Cypress._.random(0, 1e6)
|
||||||
const name = uuid()
|
const name = uuid()
|
||||||
|
if(i < 1){
|
||||||
cy.createApp(name)
|
cy.createApp(name)
|
||||||
|
} else {
|
||||||
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||||
|
cy.wait(500)
|
||||||
|
cy.get(`[data-cy="create-app-btn"]`).click({ force: true })
|
||||||
|
cy.createAppFromScratch(name)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -4,6 +4,8 @@ filterTests(['smoke', 'all'], () => {
|
||||||
context("Create a View", () => {
|
context("Create a View", () => {
|
||||||
before(() => {
|
before(() => {
|
||||||
cy.login()
|
cy.login()
|
||||||
|
cy.deleteAllApps()
|
||||||
|
|
||||||
cy.createTestApp()
|
cy.createTestApp()
|
||||||
cy.createTable("data")
|
cy.createTable("data")
|
||||||
cy.addColumn("data", "group", "Text")
|
cy.addColumn("data", "group", "Text")
|
||||||
|
|
|
@ -4,6 +4,7 @@ filterTests(["smoke", "all"], () => {
|
||||||
context("REST Datasource Testing", () => {
|
context("REST Datasource Testing", () => {
|
||||||
before(() => {
|
before(() => {
|
||||||
cy.login()
|
cy.login()
|
||||||
|
cy.deleteAllApps()
|
||||||
cy.createTestApp()
|
cy.createTestApp()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -23,7 +24,7 @@ filterTests(["smoke", "all"], () => {
|
||||||
cy.wait("@queryError")
|
cy.wait("@queryError")
|
||||||
cy.get("@queryError")
|
cy.get("@queryError")
|
||||||
.its("response.body")
|
.its("response.body")
|
||||||
.should("have.property", "message", "Invalid URL: http://random text?")
|
.should("have.property", "message", "Invalid URL")
|
||||||
cy.get("@queryError")
|
cy.get("@queryError")
|
||||||
.its("response.body")
|
.its("response.body")
|
||||||
.should("have.property", "status", 400)
|
.should("have.property", "status", 400)
|
||||||
|
|
|
@ -4,7 +4,7 @@ filterTests(["smoke", "all"], () => {
|
||||||
context("Query Level Transformers", () => {
|
context("Query Level Transformers", () => {
|
||||||
before(() => {
|
before(() => {
|
||||||
cy.login()
|
cy.login()
|
||||||
cy.deleteApp("Cypress Tests")
|
cy.deleteAllApps()
|
||||||
cy.createApp("Cypress Tests")
|
cy.createApp("Cypress Tests")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,8 @@ filterTests(['all'], () => {
|
||||||
renameApp(appName, appRename)
|
renameApp(appName, appRename)
|
||||||
cy.reload()
|
cy.reload()
|
||||||
cy.wait(1000)
|
cy.wait(1000)
|
||||||
cy.searchForApplication(appRename)
|
|
||||||
cy.get(".appTable").find(".title").should("have.length", 1)
|
cy.get(".appTable").find(".title").should("have.length", 1)
|
||||||
|
cy.applicationInAppTable(appRename)
|
||||||
// Set app name back to Cypress Tests
|
// Set app name back to Cypress Tests
|
||||||
cy.reload()
|
cy.reload()
|
||||||
cy.wait(1000)
|
cy.wait(1000)
|
||||||
|
@ -29,17 +29,17 @@ filterTests(['all'], () => {
|
||||||
const appRename = "Cypress Renamed"
|
const appRename = "Cypress Renamed"
|
||||||
// Publish the app
|
// Publish the app
|
||||||
cy.get(".toprightnav")
|
cy.get(".toprightnav")
|
||||||
cy.get(".spectrum-Button").contains("Publish").click({force: true})
|
cy.get(".spectrum-Button").contains("Publish").click({ force: true })
|
||||||
cy.get(".spectrum-Dialog-grid")
|
cy.get(".spectrum-Dialog-grid")
|
||||||
.within(() => {
|
.within(() => {
|
||||||
// Click publish again within the modal
|
// Click publish again within the modal
|
||||||
cy.get(".spectrum-Button").contains("Publish").click({force: true})
|
cy.get(".spectrum-Button").contains("Publish").click({ force: true })
|
||||||
})
|
})
|
||||||
// Rename app, Search for app, Confirm name was changed
|
// Rename app, Search for app, Confirm name was changed
|
||||||
cy.get(".home-logo").click()
|
cy.get(".home-logo").click()
|
||||||
renameApp(appName, appRename, true)
|
renameApp(appName, appRename, true)
|
||||||
cy.searchForApplication(appRename)
|
|
||||||
cy.get(".appTable").find(".wrapper").should("have.length", 1)
|
cy.get(".appTable").find(".wrapper").should("have.length", 1)
|
||||||
|
cy.applicationInAppTable(appRename)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("Should try to rename an application to have no name", () => {
|
it("Should try to rename an application to have no name", () => {
|
||||||
|
@ -51,7 +51,7 @@ filterTests(['all'], () => {
|
||||||
cy.get(".spectrum-Dialog-grid").contains("Cancel").click()
|
cy.get(".spectrum-Dialog-grid").contains("Cancel").click()
|
||||||
cy.reload()
|
cy.reload()
|
||||||
cy.wait(1000)
|
cy.wait(1000)
|
||||||
cy.searchForApplication(appName)
|
cy.applicationInAppTable(appName)
|
||||||
cy.get(".appTable").find(".title").should("have.length", 1)
|
cy.get(".appTable").find(".title").should("have.length", 1)
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -61,12 +61,12 @@ filterTests(['all'], () => {
|
||||||
const appName = "Cypress Tests"
|
const appName = "Cypress Tests"
|
||||||
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||||
cy.wait(500)
|
cy.wait(500)
|
||||||
cy.get(".spectrum-Button").contains("Create app").click({force: true})
|
cy.get(".spectrum-Button").contains("Create app").click({ force: true })
|
||||||
cy.contains(/Start from scratch/).click()
|
cy.contains(/Start from scratch/).click()
|
||||||
cy.get(".spectrum-Modal")
|
cy.get(".spectrum-Modal")
|
||||||
.within(() => {
|
.within(() => {
|
||||||
cy.get("input").eq(0).type(appName)
|
cy.get("input").eq(0).type(appName)
|
||||||
cy.get(".spectrum-ButtonGroup").contains("Create app").click({force: true})
|
cy.get(".spectrum-ButtonGroup").contains("Create app").click({ force: true })
|
||||||
cy.get(".error").should("have.text", "Another app with the same name already exists")
|
cy.get(".error").should("have.text", "Another app with the same name already exists")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -81,7 +81,7 @@ filterTests(['all'], () => {
|
||||||
renameApp(appName, numberName)
|
renameApp(appName, numberName)
|
||||||
cy.reload()
|
cy.reload()
|
||||||
cy.wait(1000)
|
cy.wait(1000)
|
||||||
cy.searchForApplication(numberName)
|
cy.applicationInAppTable(numberName)
|
||||||
cy.get(".appTable").find(".title").should("have.length", 1)
|
cy.get(".appTable").find(".title").should("have.length", 1)
|
||||||
cy.reload()
|
cy.reload()
|
||||||
cy.wait(1000)
|
cy.wait(1000)
|
||||||
|
@ -94,7 +94,7 @@ filterTests(['all'], () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
const renameApp = (originalName, changedName, published, noName) => {
|
const renameApp = (originalName, changedName, published, noName) => {
|
||||||
cy.searchForApplication(originalName)
|
cy.applicationInAppTable(originalName)
|
||||||
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 => {
|
||||||
|
@ -104,7 +104,7 @@ filterTests(['all'], () => {
|
||||||
cy.get(".spectrum-Icon").eq(1).click()
|
cy.get(".spectrum-Icon").eq(1).click()
|
||||||
})
|
})
|
||||||
// Check for when an app is published
|
// Check for when an app is published
|
||||||
if (published == true){
|
if (published == true) {
|
||||||
// Should not have Edit as option, will unpublish app
|
// Should not have Edit as option, will unpublish app
|
||||||
cy.should("not.have.value", "Edit")
|
cy.should("not.have.value", "Edit")
|
||||||
cy.get(".spectrum-Menu").contains("Unpublish").click()
|
cy.get(".spectrum-Menu").contains("Unpublish").click()
|
||||||
|
@ -114,7 +114,7 @@ filterTests(['all'], () => {
|
||||||
cy.contains("Edit").click()
|
cy.contains("Edit").click()
|
||||||
cy.get(".spectrum-Modal")
|
cy.get(".spectrum-Modal")
|
||||||
.within(() => {
|
.within(() => {
|
||||||
if (noName == true){
|
if (noName == true) {
|
||||||
cy.get("input").clear()
|
cy.get("input").clear()
|
||||||
cy.get(".spectrum-Dialog-grid").click()
|
cy.get(".spectrum-Dialog-grid").click()
|
||||||
.contains("App name must be letters, numbers and spaces only")
|
.contains("App name must be letters, numbers and spaces only")
|
||||||
|
@ -122,7 +122,7 @@ filterTests(['all'], () => {
|
||||||
}
|
}
|
||||||
cy.get("input").clear()
|
cy.get("input").clear()
|
||||||
cy.get("input").eq(0).type(changedName).should("have.value", changedName).blur()
|
cy.get("input").eq(0).type(changedName).should("have.value", changedName).blur()
|
||||||
cy.get(".spectrum-ButtonGroup").contains("Save").click({force: true})
|
cy.get(".spectrum-ButtonGroup").contains("Save").click({ force: true })
|
||||||
cy.wait(500)
|
cy.wait(500)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,9 @@ Cypress.Commands.add("login", () => {
|
||||||
Cypress.Commands.add("createApp", name => {
|
Cypress.Commands.add("createApp", name => {
|
||||||
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
||||||
cy.wait(500)
|
cy.wait(500)
|
||||||
cy.get(".spectrum-Button").contains("Create app").click({ force: true })
|
|
||||||
|
cy.get(`[data-cy="create-app-btn"]`).click({ force: true })
|
||||||
|
|
||||||
cy.get(".spectrum-Modal").within(() => {
|
cy.get(".spectrum-Modal").within(() => {
|
||||||
cy.get("input").eq(0).type(name).should("have.value", name).blur()
|
cy.get("input").eq(0).type(name).should("have.value", name).blur()
|
||||||
cy.get(".spectrum-ButtonGroup").contains("Create app").click()
|
cy.get(".spectrum-ButtonGroup").contains("Create app").click()
|
||||||
|
@ -51,10 +53,23 @@ Cypress.Commands.add("deleteApp", name => {
|
||||||
.its("body")
|
.its("body")
|
||||||
.then(val => {
|
.then(val => {
|
||||||
if (val.length > 0) {
|
if (val.length > 0) {
|
||||||
cy.searchForApplication(name)
|
const appId = val.reduce((acc, app) => {
|
||||||
cy.get(".appTable").within(() => {
|
if (name === app.name) {
|
||||||
cy.get(".spectrum-Icon").eq(1).click()
|
acc = app.appId
|
||||||
|
}
|
||||||
|
return acc
|
||||||
|
}, "")
|
||||||
|
|
||||||
|
if (appId == "") {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const appIdParsed = appId.split("_").pop()
|
||||||
|
const actionEleId = `[data-cy=row_actions_${appIdParsed}]`
|
||||||
|
cy.get(actionEleId).within(() => {
|
||||||
|
cy.get(".spectrum-Icon").eq(0).click()
|
||||||
})
|
})
|
||||||
|
|
||||||
cy.get(".spectrum-Menu").then($menu => {
|
cy.get(".spectrum-Menu").then($menu => {
|
||||||
if ($menu.text().includes("Unpublish")) {
|
if ($menu.text().includes("Unpublish")) {
|
||||||
cy.get(".spectrum-Menu").contains("Unpublish").click()
|
cy.get(".spectrum-Menu").contains("Unpublish").click()
|
||||||
|
@ -80,22 +95,18 @@ Cypress.Commands.add("deleteAllApps", () => {
|
||||||
.its("body")
|
.its("body")
|
||||||
.then(val => {
|
.then(val => {
|
||||||
for (let i = 0; i < val.length; i++) {
|
for (let i = 0; i < val.length; i++) {
|
||||||
cy.get(".spectrum-Heading")
|
const appIdParsed = val[i].appId.split("_").pop()
|
||||||
.eq(1)
|
const actionEleId = `[data-cy=row_actions_${appIdParsed}]`
|
||||||
.then(app => {
|
cy.get(actionEleId).within(() => {
|
||||||
const name = app.text()
|
|
||||||
cy.get(".title")
|
|
||||||
.children()
|
|
||||||
.within(() => {
|
|
||||||
cy.get(".spectrum-Icon").eq(0).click()
|
cy.get(".spectrum-Icon").eq(0).click()
|
||||||
})
|
})
|
||||||
|
|
||||||
cy.get(".spectrum-Menu").contains("Delete").click()
|
cy.get(".spectrum-Menu").contains("Delete").click()
|
||||||
cy.get(".spectrum-Dialog-grid").within(() => {
|
cy.get(".spectrum-Dialog-grid").within(() => {
|
||||||
cy.get("input").type(name)
|
cy.get("input").type(val[i].name)
|
||||||
cy.get(".spectrum-Button--warning").click()
|
cy.get(".spectrum-Button--warning").click()
|
||||||
})
|
})
|
||||||
cy.reload()
|
cy.reload()
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -190,9 +201,11 @@ Cypress.Commands.add("addRowMultiValue", values => {
|
||||||
Cypress.Commands.add("createUser", email => {
|
Cypress.Commands.add("createUser", email => {
|
||||||
// quick hacky recorded way to create a user
|
// quick hacky recorded way to create a user
|
||||||
cy.contains("Users").click()
|
cy.contains("Users").click()
|
||||||
cy.get(".spectrum-Button--primary").click()
|
cy.get(`[data-cy="add-user"]`).click()
|
||||||
cy.get(".spectrum-Picker-label").click()
|
cy.get(".spectrum-Picker-label").click()
|
||||||
cy.get(".spectrum-Menu-item:nth-child(2) > .spectrum-Menu-itemLabel").click()
|
cy.get(".spectrum-Menu-item:nth-child(2) > .spectrum-Menu-itemLabel").click()
|
||||||
|
|
||||||
|
//Onboarding type selector
|
||||||
cy.get(
|
cy.get(
|
||||||
":nth-child(2) > .spectrum-Form-itemField > .spectrum-Textfield > .spectrum-Textfield-input"
|
":nth-child(2) > .spectrum-Form-itemField > .spectrum-Textfield > .spectrum-Textfield-input"
|
||||||
)
|
)
|
||||||
|
@ -312,16 +325,37 @@ Cypress.Commands.add("addCustomSourceOptions", totalOptions => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
//Filters visible with 1 or more
|
||||||
Cypress.Commands.add("searchForApplication", appName => {
|
Cypress.Commands.add("searchForApplication", appName => {
|
||||||
cy.wait(1000)
|
cy.wait(1000)
|
||||||
// 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(() => {
|
||||||
|
cy.get("input").eq(0).clear()
|
||||||
cy.get("input").eq(0).type(appName)
|
cy.get("input").eq(0).type(appName)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
// Confirms app exists after search
|
// Confirms app exists after search
|
||||||
cy.get(".appTable").contains(appName)
|
cy.applicationInAppTable(appName)
|
||||||
|
})
|
||||||
|
|
||||||
|
//Assumes there are no others
|
||||||
|
Cypress.Commands.add("applicationInAppTable", appName => {
|
||||||
|
cy.get(".appTable").within(() => {
|
||||||
|
cy.get(".title").contains(appName).should("exist")
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
Cypress.Commands.add("createAppFromScratch", appName => {
|
||||||
|
cy.get(`[data-cy="create-app-btn"]`)
|
||||||
|
.contains("Start from scratch")
|
||||||
|
.click({ force: true })
|
||||||
|
cy.get(".spectrum-Modal").within(() => {
|
||||||
|
cy.get("input").eq(0).type(appName).should("have.value", appName).blur()
|
||||||
|
cy.get(".spectrum-ButtonGroup").contains("Create app").click()
|
||||||
|
cy.wait(10000)
|
||||||
|
})
|
||||||
|
cy.createTable("Cypress Tests", true)
|
||||||
})
|
})
|
||||||
|
|
||||||
Cypress.Commands.add("selectExternalDatasource", datasourceName => {
|
Cypress.Commands.add("selectExternalDatasource", datasourceName => {
|
||||||
|
|
|
@ -69,6 +69,7 @@
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
{#each templateCategories as templateCategoryKey}
|
{#each templateCategories as templateCategoryKey}
|
||||||
<ActionButton
|
<ActionButton
|
||||||
|
dataCy={templateCategoryKey}
|
||||||
selected={templateCategoryKey == selectedTemplateCategory}
|
selected={templateCategoryKey == selectedTemplateCategory}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
selectedTemplateCategory = templateCategoryKey
|
selectedTemplateCategory = templateCategoryKey
|
||||||
|
@ -85,7 +86,7 @@
|
||||||
<div class="template-categories">
|
<div class="template-categories">
|
||||||
<Layout gap="XL" noPadding>
|
<Layout gap="XL" noPadding>
|
||||||
{#each filteredTemplateCategories as templateCategoryKey}
|
{#each filteredTemplateCategories as templateCategoryKey}
|
||||||
<div class="template-category">
|
<div class="template-category" data-cy={templateCategoryKey}>
|
||||||
<Detail size="M">{templateCategoryKey}</Detail>
|
<Detail size="M">{templateCategoryKey}</Detail>
|
||||||
<div class="template-grid">
|
<div class="template-grid">
|
||||||
{#each filteredTemplates[templateCategoryKey] as templateEntry}
|
{#each filteredTemplates[templateCategoryKey] as templateEntry}
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
{#if app.deployed}Published{:else}Unpublished{/if}
|
{#if app.deployed}Published{:else}Unpublished{/if}
|
||||||
</StatusLight>
|
</StatusLight>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div data-cy={`row_actions_${app.appId}`}>
|
||||||
<Button
|
<Button
|
||||||
size="S"
|
size="S"
|
||||||
disabled={app.lockedOther}
|
disabled={app.lockedOther}
|
||||||
|
|
|
@ -42,11 +42,31 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// auto add slash to url
|
const resolveAppUrl = (template, name) => {
|
||||||
$: {
|
let parsedName
|
||||||
if ($values.url && !$values.url.startsWith("/")) {
|
const resolvedName = resolveAppName(null, name)
|
||||||
$values.url = `/${$values.url}`
|
parsedName = resolvedName ? resolvedName.toLowerCase() : ""
|
||||||
|
const parsedUrl = parsedName ? parsedName.replace(/\s+/g, "-") : ""
|
||||||
|
return encodeURI(parsedUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const resolveAppName = (template, name) => {
|
||||||
|
if (template && !name) {
|
||||||
|
return template.name
|
||||||
|
}
|
||||||
|
return name ? name.trim() : null
|
||||||
|
}
|
||||||
|
|
||||||
|
const tidyUrl = url => {
|
||||||
|
if (url && !url.startsWith("/")) {
|
||||||
|
url = `/${url}`
|
||||||
|
}
|
||||||
|
$values.url = url === "" ? null : url
|
||||||
|
}
|
||||||
|
|
||||||
|
const nameToUrl = appName => {
|
||||||
|
let resolvedUrl = resolveAppUrl(null, appName)
|
||||||
|
tidyUrl(resolvedUrl)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -61,15 +81,17 @@
|
||||||
bind:value={$values.name}
|
bind:value={$values.name}
|
||||||
error={$validation.touched.name && $validation.errors.name}
|
error={$validation.touched.name && $validation.errors.name}
|
||||||
on:blur={() => ($validation.touched.name = true)}
|
on:blur={() => ($validation.touched.name = true)}
|
||||||
|
on:change={nameToUrl($values.name)}
|
||||||
label="Name"
|
label="Name"
|
||||||
/>
|
/>
|
||||||
<Input
|
<Input
|
||||||
bind:value={$values.url}
|
bind:value={$values.url}
|
||||||
error={$validation.touched.url && $validation.errors.url}
|
error={$validation.touched.url && $validation.errors.url}
|
||||||
on:blur={() => ($validation.touched.url = true)}
|
on:blur={() => ($validation.touched.url = true)}
|
||||||
|
on:change={tidyUrl($values.url)}
|
||||||
label="URL"
|
label="URL"
|
||||||
placeholder={$values.name
|
placeholder={$values.url
|
||||||
? "/" + encodeURIComponent($values.name).toLowerCase()
|
? $values.url
|
||||||
: "/"}
|
: `/${resolveAppUrl(null, $values.name)}`}
|
||||||
/>
|
/>
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
<Heading size="S">Users</Heading>
|
<Heading size="S">Users</Heading>
|
||||||
<ButtonGroup>
|
<ButtonGroup>
|
||||||
<Button disabled secondary>Import users</Button>
|
<Button disabled secondary>Import users</Button>
|
||||||
<Button primary on:click={createUserModal.show}>Add user</Button>
|
<Button primary dataCy="add-user" on:click={createUserModal.show}>Add user</Button>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
|
|
Loading…
Reference in New Issue