IT Ticketing System Template Tests
Two tests for IT Ticketing System template - Create and publish app - Filter tickets by status (Skipped for now as functionality seems broken specifically for the CI run, looking into it...) Commands - Added new template navigation function - Added this to appropriate template test files
This commit is contained in:
parent
3ea297c5fc
commit
d79ccb62d5
|
@ -1,7 +1,7 @@
|
||||||
import filterTests from "../../../support/filterTests"
|
import filterTests from "../../../support/filterTests"
|
||||||
|
|
||||||
filterTests(["all"], () => {
|
filterTests(["all"], () => {
|
||||||
context("Job Application Functionality", () => {
|
context("Job Application Tracker Template Functionality", () => {
|
||||||
const templateName = "Job Application Tracker"
|
const templateName = "Job Application Tracker"
|
||||||
const templateNameParsed = templateName.toLowerCase().replace(/\s+/g, '-')
|
const templateNameParsed = templateName.toLowerCase().replace(/\s+/g, '-')
|
||||||
|
|
||||||
|
@ -14,15 +14,7 @@ filterTests(["all"], () => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
cy.wait(2000)
|
cy.wait(2000)
|
||||||
|
cy.templateNavigation()
|
||||||
// Template navigation
|
|
||||||
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`)
|
|
||||||
.its("body")
|
|
||||||
.then(val => {
|
|
||||||
if (val.length > 0) {
|
|
||||||
cy.get(".spectrum-Button").contains("Templates").click({force: true})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should create and publish app with Job Application Tracker template", () => {
|
it("should create and publish app with Job Application Tracker template", () => {
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
import filterTests from "../../../support/filterTests"
|
||||||
|
|
||||||
|
filterTests(["all"], () => {
|
||||||
|
context("IT Ticketing System Template Functionality", () => {
|
||||||
|
const templateName = "IT Ticketing System"
|
||||||
|
const templateNameParsed = templateName.toLowerCase().replace(/\s+/g, '-')
|
||||||
|
|
||||||
|
before(() => {
|
||||||
|
cy.login()
|
||||||
|
cy.deleteApp(templateName)
|
||||||
|
cy.visit(`${Cypress.config().baseUrl}/builder`, {
|
||||||
|
onBeforeLoad(win) {
|
||||||
|
cy.stub(win, 'open')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
cy.wait(2000)
|
||||||
|
cy.templateNavigation()
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should create and publish app with IT Ticketing System template", () => {
|
||||||
|
// Select IT Ticketing System 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
|
||||||
|
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')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
xit("should filter tickets by status", () => {
|
||||||
|
// Visit published app
|
||||||
|
cy.visit(`${Cypress.config().baseUrl}/app/` + templateNameParsed)
|
||||||
|
cy.wait(1000)
|
||||||
|
|
||||||
|
// Tickets section
|
||||||
|
cy.get(".links").contains("Tickets").click({ force: true })
|
||||||
|
cy.wait(1000)
|
||||||
|
|
||||||
|
// Filter by stage - Confirm table updates
|
||||||
|
cy.get(".spectrum-Picker").contains("Filter by status").click({ force: true })
|
||||||
|
cy.get(".spectrum-Menu").find('li').its('length').then(len => {
|
||||||
|
for (let i = 1; i < len; i++) {
|
||||||
|
cy.get(".spectrum-Menu-item").eq(i).click()
|
||||||
|
const stage = cy.get(".spectrum-Picker-label")
|
||||||
|
stage.invoke('text').then(stageText => {
|
||||||
|
if (stageText == "In progress" || stageText == "On hold" || stageText == "Triaged") {
|
||||||
|
cy.get(".placeholder").should('contain', 'No rows found')
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cy.get(".spectrum-Table-row").should('contain', stageText)
|
||||||
|
}
|
||||||
|
cy.get(".spectrum-Picker").contains(stageText).click({ force: true })
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
|
@ -595,3 +595,15 @@ Cypress.Commands.add("createRestQuery", (method, restUrl, queryPrettyName) => {
|
||||||
.should("contain", method)
|
.should("contain", method)
|
||||||
.and("contain", queryPrettyName)
|
.and("contain", queryPrettyName)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Cypress.Commands.add("templateNavigation", () => {
|
||||||
|
// Navigates to templates section
|
||||||
|
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`)
|
||||||
|
.its("body")
|
||||||
|
.then(val => {
|
||||||
|
// Templates button needs clicked if apps already exist
|
||||||
|
if (val.length > 0) {
|
||||||
|
cy.get(".spectrum-Button").contains("Templates").click({ force: true })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
Loading…
Reference in New Issue