Update cpyress tests so create and delete app helpers work again

This commit is contained in:
Andrew Kingston 2021-04-28 14:56:31 +01:00
parent f8026e8683
commit 164c4b76c7
3 changed files with 33 additions and 20 deletions

View File

@ -40,33 +40,46 @@ Cypress.Commands.add("createApp", name => {
} }
}) })
.then(() => { .then(() => {
cy.get("input[name=applicationName]") cy.get(".spectrum-Modal")
.within(() => {
cy.get("input")
.eq(0)
.type(name) .type(name)
.should("have.value", name) .should("have.value", name)
.blur()
cy.contains("Next").click() cy.contains("Next").click()
cy.get("input[name=email]") cy.get("input")
.click() .eq(1)
.type("test@test.com") .type("test@test.com")
cy.get("input[name=password]") .blur()
.click() cy.get("input")
.eq(2)
.type("test") .type("test")
.blur()
cy.contains("Submit").click() cy.contains("Submit").click()
})
.then(() => {
cy.get("[data-cy=new-table]", { cy.get("[data-cy=new-table]", {
timeout: 20000, timeout: 20000,
}).should("be.visible") }).should("be.visible")
}) })
}) })
})
Cypress.Commands.add("deleteApp", name => { Cypress.Commands.add("deleteApp", name => {
cy.visit(`localhost:${Cypress.env("PORT")}/builder`) cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
cy.get(".apps").then($apps => { cy.get(".apps").then($apps => {
cy.wait(1000) cy.wait(1000)
if ($apps.find(`[data-cy="app-${name}"]`).length) { if ($apps.find(`[data-cy="app-${name}"]`).length) {
cy.get(`[data-cy="app-${name}"] a`).click() cy.get(`[data-cy="app-${name}"]`)
.contains("Open")
.click()
cy.get("[data-cy=settings-icon]").click() cy.get("[data-cy=settings-icon]").click()
cy.get(".modal-content").within(() => { cy.get(".spectrum-Dialog").within(() => {
cy.contains("Danger Zone").click() cy.contains("Danger Zone").click()
cy.get("input").type("DELETE") cy.get("input")
.type("DELETE")
.blur()
cy.contains("Delete Entire App").click() cy.contains("Delete Entire App").click()
}) })
} }

View File

@ -1,6 +1,6 @@
<script> <script>
import SettingsModal from "./SettingsModal.svelte" import SettingsModal from "./SettingsModal.svelte"
import { Modal } from "@budibase/bbui" import { Modal, Icon } from "@budibase/bbui"
let modal let modal
</script> </script>
@ -9,7 +9,7 @@
class="topnavitemright settings" class="topnavitemright settings"
data-cy="settings-icon" data-cy="settings-icon"
on:click={modal.show}> on:click={modal.show}>
<i class="ri-settings-3-line" /> <Icon hoverable name="Settings" />
</div> </div>
<Modal bind:this={modal} width="600px"> <Modal bind:this={modal} width="600px">
<SettingsModal /> <SettingsModal />

View File

@ -54,7 +54,7 @@
</Tabs> </Tabs>
<div <div
class="add-button" class="add-button"
data-cy={`new-${selected === 'External' ? 'datasource' : 'tabel'}`}> data-cy={`new-${selected === 'External' ? 'datasource' : 'table'}`}>
<Icon hoverable name="AddCircle" on:click={modal.show} /> <Icon hoverable name="AddCircle" on:click={modal.show} />
</div> </div>
</div> </div>