diff --git a/packages/builder/cypress/integration/templates/HR/jobApplicationTracker.spec.js b/packages/builder/cypress/integration/templates/HR/jobApplicationTracker.spec.js index 3bfbd43738..045a85d8f6 100644 --- a/packages/builder/cypress/integration/templates/HR/jobApplicationTracker.spec.js +++ b/packages/builder/cypress/integration/templates/HR/jobApplicationTracker.spec.js @@ -35,19 +35,10 @@ filterTests(["all"], () => { cy.get(".spectrum-Button").contains("Create app").click({ force: true }) }) - // Publish App + // Publish App & Verify it opened cy.wait(2000) // Wait for app to generate - cy.get(".toprightnav").contains("Publish").click({ force: true }) - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get(".spectrum-Button").contains("Publish").click({ force: true }) - }) - - // Verify Published app - cy.wait(2000) // Wait for App to publish and modal to appear - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get(".spectrum-Button").contains("View App").click({ force: true }) - cy.window().its('open').should('be.calledOnce') - }) + cy.publishApp(true) + cy.window().its('open').should('be.calledOnce') }) it("should add active/inactive vacancies", () => { diff --git a/packages/builder/cypress/integration/templates/IT/ITTicketingSystem.spec.js b/packages/builder/cypress/integration/templates/IT/ITTicketingSystem.spec.js index 37f412205e..15628ab131 100644 --- a/packages/builder/cypress/integration/templates/IT/ITTicketingSystem.spec.js +++ b/packages/builder/cypress/integration/templates/IT/ITTicketingSystem.spec.js @@ -35,19 +35,10 @@ filterTests(["all"], () => { cy.get(".spectrum-Button").contains("Create app").click({ force: true }) }) - // Publish App + // Publish App & Verify it opened cy.wait(2000) // Wait for app to generate - cy.get(".toprightnav").contains("Publish").click({ force: true }) - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get(".spectrum-Button").contains("Publish").click({ force: true }) - }) - - // Verify Published app - cy.wait(2000) // Wait for App to publish and modal to appear - cy.get(".spectrum-Dialog-grid").within(() => { - cy.get(".spectrum-Button").contains("View App").click({ force: true }) - cy.window().its('open').should('be.calledOnce') - }) + cy.publishApp(true) + cy.window().its('open').should('be.calledOnce') }) xit("should filter tickets by status", () => { diff --git a/packages/builder/cypress/integration/templates/marketing/leadGenerationForm.spec.js b/packages/builder/cypress/integration/templates/marketing/leadGenerationForm.spec.js new file mode 100644 index 0000000000..9f08b36d56 --- /dev/null +++ b/packages/builder/cypress/integration/templates/marketing/leadGenerationForm.spec.js @@ -0,0 +1,44 @@ +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') + }) + }) +}) diff --git a/packages/builder/cypress/support/commands.js b/packages/builder/cypress/support/commands.js index 4295860dc1..89284279d1 100644 --- a/packages/builder/cypress/support/commands.js +++ b/packages/builder/cypress/support/commands.js @@ -222,6 +222,21 @@ Cypress.Commands.add("createTestTableWithData", () => { cy.addColumn("dog", "age", "Number") }) +Cypress.Commands.add("publishApp", (viewApp = false) => { + cy.get(".toprightnav").contains("Publish").click({ force: true }) + cy.get(".spectrum-Dialog-grid").within(() => { + cy.get(".spectrum-Button").contains("Publish").click({ force: true }) + }) + cy.wait(2000) // Wait for App to publish and modal to appear + cy.get(".spectrum-Dialog-grid").within(() => { + if (viewApp) { + cy.get(".spectrum-Button").contains("View App").click({ force: true }) + } else { + cy.get(".spectrum-Button").contains("Done").click({ force: true }) + } + }) +}) + Cypress.Commands.add("createTable", (tableName, initialTable) => { if (!initialTable) { cy.navigateToDataSection()