fix home screen automation commands

This commit is contained in:
Peter Clement 2021-12-09 11:52:47 +00:00
parent feacfb922f
commit fa8fb5577e
4 changed files with 26 additions and 17 deletions

View File

@ -10,7 +10,7 @@ it("should rename an unpublished application", () => {
cy.get(".home-logo").click() cy.get(".home-logo").click()
renameApp(appRename) renameApp(appRename)
cy.searchForApplication(appRename) cy.searchForApplication(appRename)
cy.get(".appGrid").find(".wrapper").should("have.length", 1) cy.get(".appTable").find(".title").should("have.length", 1)
cy.deleteApp(appRename) cy.deleteApp(appRename)
}) })
@ -29,7 +29,7 @@ xit("Should rename a published application", () => {
cy.get(".home-logo").click() cy.get(".home-logo").click()
renameApp(appRename, true) renameApp(appRename, true)
cy.searchForApplication(appRename) cy.searchForApplication(appRename)
cy.get(".appGrid").find(".wrapper").should("have.length", 1) cy.get(".appTable").find(".title").should("have.length", 1)
}) })
it("Should try to rename an application to have no name", () => { it("Should try to rename an application to have no name", () => {
@ -38,7 +38,7 @@ it("Should try to rename an application to have no name", () => {
// Close modal and confirm name has not been changed // Close modal and confirm name has not been changed
cy.get(".spectrum-Dialog-grid").contains("Cancel").click() cy.get(".spectrum-Dialog-grid").contains("Cancel").click()
cy.searchForApplication("Cypress Tests") cy.searchForApplication("Cypress Tests")
cy.get(".appGrid").find(".wrapper").should("have.length", 1) cy.get(".appTable").find(".title").should("have.length", 1)
}) })
xit("Should create two applications with the same name", () => { xit("Should create two applications with the same name", () => {
@ -64,7 +64,7 @@ it("should validate application names", () => {
cy.get(".home-logo").click() cy.get(".home-logo").click()
renameApp(numberName) renameApp(numberName)
cy.searchForApplication(numberName) cy.searchForApplication(numberName)
cy.get(".appGrid").find(".wrapper").should("have.length", 1) cy.get(".appTable").find(".title").should("have.length", 1)
renameApp(specialCharName) renameApp(specialCharName)
cy.get(".error").should("have.text", "App name must be letters, numbers and spaces only") cy.get(".error").should("have.text", "App name must be letters, numbers and spaces only")
}) })
@ -74,14 +74,14 @@ it("should validate application names", () => {
.its("body") .its("body")
.then(val => { .then(val => {
if (val.length > 0) { if (val.length > 0) {
cy.get(".title > :nth-child(3) > .spectrum-Icon").click() cy.get(".appTable > :nth-child(5) > :nth-child(2) > .spectrum-Icon").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()
cy.get(".spectrum-Dialog-grid").contains("Unpublish app").click() cy.get(".spectrum-Dialog-grid").contains("Unpublish app").click()
cy.get(".title > :nth-child(3) > .spectrum-Icon").click() cy.get(".appTable > :nth-child(5) > :nth-child(2) > .spectrum-Icon").click()
} }
cy.contains("Edit").click() cy.contains("Edit").click()
cy.get(".spectrum-Modal") cy.get(".spectrum-Modal")

View File

@ -50,7 +50,9 @@ Cypress.Commands.add("deleteApp", appName => {
.its("body") .its("body")
.then(val => { .then(val => {
if (val.length > 0) { if (val.length > 0) {
cy.get(".title > :nth-child(3) > .spectrum-Icon").click() cy.get(
".appTable > :nth-child(5) > :nth-child(2) > .spectrum-Icon"
).click()
cy.contains("Delete").click() cy.contains("Delete").click()
cy.get(".spectrum-Modal").within(() => { cy.get(".spectrum-Modal").within(() => {
cy.get("input").type(appName) cy.get("input").type(appName)

View File

@ -9,6 +9,7 @@
} from "@budibase/bbui" } from "@budibase/bbui"
import { apps } from "stores/portal" import { apps } from "stores/portal"
import { processStringSync } from "@budibase/string-templates" import { processStringSync } from "@budibase/string-templates"
export let app export let app
export let exportApp export let exportApp
export let viewApp export let viewApp
@ -18,16 +19,19 @@
export let unpublishApp export let unpublishApp
export let releaseLock export let releaseLock
export let editIcon export let editIcon
$: color = $apps.filter(filtered_app => app?.appId === filtered_app.appId)[0] $: console.log($apps)
.icon?.color $: color =
$: name = $apps.filter(filtered_app => app?.appId === filtered_app.appId)[0] $apps.find(filtered_app => app?.appId === filtered_app.appId)?.icon
.icon?.name ?.color || ""
$: name =
$apps.find(filtered_app => app?.appId === filtered_app.appId)?.icon?.name ||
"Apps"
</script> </script>
<div class="title"> <div class="title">
<div style="display: flex;"> <div style="display: flex;">
<div style="color: {color || ''}"> <div style="color: {color}">
<Icon size="XL" name={name || "Apps"} /> <Icon size="XL" {name} />
</div> </div>
<div class="name" on:click={() => editApp(app)}> <div class="name" on:click={() => editApp(app)}>
<Heading size="XS"> <Heading size="XS">

View File

@ -3,9 +3,10 @@
import { apps } from "stores/portal" import { apps } from "stores/portal"
export let app export let app
console.log(app)
let modal let modal
let selectedIcon $: selectedIcon = app?.icon?.name
let selectedColor $: selectedColor = app?.icon?.color
let iconsList = [ let iconsList = [
"Actions", "Actions",
@ -22,7 +23,6 @@
"Organisations", "Organisations",
"Magnify", "Magnify",
"Launch", "Launch",
"Actions",
"Car", "Car",
"Camera", "Camera",
"Bug", "Bug",
@ -32,6 +32,7 @@
"GraphDonut", "GraphDonut",
"GraphBarHorizontal", "GraphBarHorizontal",
"Demographic", "Demographic",
"Apps",
] ]
export const show = () => { export const show = () => {
modal.show() modal.show()
@ -41,6 +42,8 @@
} }
const onCancel = () => { const onCancel = () => {
selectedIcon = ""
selectedColor = ""
hide() hide()
} }
@ -84,7 +87,7 @@
</div> </div>
<div class="color-selection-item"> <div class="color-selection-item">
<ColorPicker <ColorPicker
value={selectedColor} bind:value={selectedColor}
on:change={e => changeColor(e.detail)} on:change={e => changeColor(e.detail)}
/> />
</div> </div>