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 cb803b1abf
commit e7089a26cd
3 changed files with 33 additions and 20 deletions

View File

@ -40,20 +40,29 @@ Cypress.Commands.add("createApp", name => {
} }
}) })
.then(() => { .then(() => {
cy.get("input[name=applicationName]") cy.get(".spectrum-Modal")
.type(name) .within(() => {
.should("have.value", name) cy.get("input")
cy.contains("Next").click() .eq(0)
cy.get("input[name=email]") .type(name)
.click() .should("have.value", name)
.type("test@test.com") .blur()
cy.get("input[name=password]") cy.contains("Next").click()
.click() cy.get("input")
.type("test") .eq(1)
cy.contains("Submit").click() .type("test@test.com")
cy.get("[data-cy=new-table]", { .blur()
timeout: 20000, cy.get("input")
}).should("be.visible") .eq(2)
.type("test")
.blur()
cy.contains("Submit").click()
})
.then(() => {
cy.get("[data-cy=new-table]", {
timeout: 20000,
}).should("be.visible")
})
}) })
}) })
@ -62,11 +71,15 @@ Cypress.Commands.add("deleteApp", name => {
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>