budibase/packages/builder/cypress/integration/createScreen.spec.js

55 lines
1.7 KiB
JavaScript
Raw Normal View History

import filterTests from "../support/filterTests"
const interact = require('../support/interact')
2022-01-21 14:12:16 +01:00
filterTests(["smoke", "all"], () => {
2023-01-16 12:17:11 +01:00
xcontext("Screen Tests", () => {
before(() => {
cy.login()
cy.createTestApp()
cy.navigateToFrontend()
})
it.skip("Should successfully create a screen", () => {
2022-05-10 23:40:27 +02:00
cy.createScreen("test")
cy.get(interact.BODY).within(() => {
cy.contains("/test").should("exist")
})
})
it("Should update the url", () => {
cy.createScreen("test with spaces")
cy.get(interact.BODY).within(() => {
cy.contains("/test-with-spaces").should("exist")
})
})
2022-04-07 13:22:16 +02:00
it.skip("should delete all screens then create first screen via button", () => {
cy.deleteAllScreens()
2023-01-16 12:17:11 +01:00
cy.contains("Create first screen").click()
cy.get(interact.BODY, { timeout: 2000 }).should('contain', '/home')
})
2022-04-08 10:56:20 +02:00
it("Should create and filter screens by access level", () => {
const accessLevels = ["Basic", "Admin", "Public", "Power"]
2022-04-08 10:56:20 +02:00
2023-01-16 12:17:11 +01:00
for (const access of accessLevels) {
// Create screen with specified access level
cy.createScreen(access, access)
// Filter by access level and confirm screen visible
cy.filterScreensAccessLevel(access)
cy.get(interact.BODY).within(() => {
cy.get(interact.NAV_ITEM).should('contain', access.toLowerCase())
})
}
2022-04-08 10:56:20 +02:00
// Filter by All screens - Confirm all screens visible
cy.filterScreensAccessLevel("All screens")
cy.get(interact.BODY).should('contain', accessLevels[0])
2023-01-16 12:17:11 +01:00
.and('contain', accessLevels[1])
.and('contain', accessLevels[2])
.and('contain', accessLevels[3])
2022-04-07 13:22:16 +02:00
})
2022-01-21 14:12:16 +01:00
})
})