1
0
Fork 0
mirror of synced 2024-07-06 23:10:57 +12:00
budibase/packages/builder/cypress/integration/templates/manufacturing/manufacturingTemplateDetails.spec.js
Mitch-Budibase edc8d7f1f7 Templates Details Tests
Added tests which check the details button for each template.
- Split per category (Will add more specific template tests under each category)
- Checks template name matches url (There are a few exceptions)
- Checks status of url - expects 200 back each time

Also updated the DeleteApp Function
- Fixed a smoke test issue associated with deleting the tests app
2022-04-28 17:50:06 +01:00

49 lines
1.5 KiB
JavaScript

import filterTests from "../../../support/filterTests"
filterTests(["all"], () => {
context("Verify Manufacturing Template Details", () => {
before(() => {
cy.login()
// 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})
}
})
// Filter Manufacturing Templates
cy.get(".template-category-filters").within(() => {
cy.get('[data-cy="Manufacturing"]').click()
})
})
it("should verify the details option for Manufacturing templates", () => {
cy.get(".template-grid").find(".template-card").its('length')
.then(len => {
// Verify template name is within details link
for (let i = 0; i < len; i++) {
cy.get(".template-card").eq(i).within(() => {
const templateName = cy.get(".template-thumbnail-text")
templateName.invoke('text')
.then(templateNameText => {
const templateNameParsed = templateNameText.toLowerCase().replace(/\s+/g, '-')
cy.get('a').should('have.attr', 'href').and('contain', templateNameParsed)
})
// Verify correct status from Details link - 200
cy.get('a')
.then(link => {
cy.request(link.prop('href'))
.its('status')
.should('eq', 200)
})
})
}
})
})
})
})