1
0
Fork 0
mirror of synced 2024-06-02 10:34:40 +12:00
budibase/packages/builder/cypress/integration/templates/approvalApps/approvalAppsTemplateDetails.spec.js
Mitch-Budibase a6c7b6ab26 Template Testing Refactor
Directly visiting the templates URL
2022-05-19 15:23:53 +01:00

52 lines
1.7 KiB
JavaScript

import filterTests from "../../../support/filterTests"
filterTests(["all"], () => {
context("Verify Aproval Apps Template Details", () => {
before(() => {
cy.login()
// Template navigation
cy.visit(`${Cypress.config().baseUrl}/builder/portal/apps/templates`)
// Filter Approval Apps Templates
cy.get(".template-category-filters").within(() => {
cy.get('[data-cy="Approval Apps"]').click()
})
})
it("should verify the details option for Approval Apps 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, '-')
if (templateNameText == "Content Approval System") {
// Template name should include 'content-approval'
const templateNameSplit = templateNameParsed.split('-system')[0]
cy.get('a')
.should('have.attr', 'href').and('contain', templateNameSplit)
}
else {
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)
})
})
}
})
})
})
})