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
This commit is contained in:
parent
b530e86d29
commit
333279f66c
|
@ -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", () => {
|
||||
|
|
|
@ -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", () => {
|
||||
|
|
|
@ -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')
|
||||
})
|
||||
})
|
||||
})
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue