1
0
Fork 0
mirror of synced 2024-09-06 12:41:24 +12:00
budibase/packages/builder/cypress/integration/templates/marketing/leadGenerationForm.spec.js
Mitch-Budibase 333279f66c Lead Generation Form Template Test + Refactor
New Lead Generation Form template test
- Verifies app creation
- Successful Publish
- Published app opens when button clicked

Refactor of template functionality specific tests
- Created a command to publish app and either click view or done button afterwards
- Refactored into some template tests
2022-05-19 15:51:42 +01:00

44 lines
1.5 KiB
JavaScript

import filterTests from "../../../support/filterTests"
filterTests(["all"], () => {
context("Lead Generation Form Template Functionality", () => {
const templateName = "Lead Generation Form"
const templateNameParsed = templateName.toLowerCase().replace(/\s+/g, '-')
before(() => {
cy.login()
cy.deleteApp(templateName)
// Template navigation
cy.visit(`${Cypress.config().baseUrl}/builder/portal/apps/templates`, {
onBeforeLoad(win) {
cy.stub(win, 'open')
}
})
cy.wait(2000)
})
it("should create and publish app with Lead Generation Form template", () => {
// Select Lead Generation Form template
cy.get(".template-thumbnail-text")
.contains(templateName).parentsUntil(".template-grid").within(() => {
cy.get(".spectrum-Button").contains("Use template").click({ force: true })
})
// Confirm URL matches template name
const appUrl = cy.get(".app-server")
appUrl.invoke('text').then(appUrlText => {
expect(appUrlText).to.equal(`${Cypress.config().baseUrl}/app/` + templateNameParsed)
})
// Create App
cy.get(".spectrum-Dialog-grid").within(() => {
cy.get(".spectrum-Button").contains("Create app").click({ force: true })
})
// Publish App & Verify it opened
cy.wait(2000) // Wait for app to generate
cy.publishApp(true)
cy.window().its('open').should('be.calledOnce')
})
})
})