diff --git a/qa-core/src/config/internal-api/fixtures/screens.ts b/qa-core/src/config/internal-api/fixtures/screens.ts index afd4faacad..1ebc1eb5c8 100644 --- a/qa-core/src/config/internal-api/fixtures/screens.ts +++ b/qa-core/src/config/internal-api/fixtures/screens.ts @@ -2,7 +2,7 @@ import generator from "../../generator" const randomId = generator.guid() -const generateScreen = (): any => ({ +const generateScreen = (roleId: string): any => ({ showNavigation: true, width: "Large", name: randomId, @@ -26,7 +26,7 @@ const generateScreen = (): any => ({ gap: "M" }, routing: { route: "/test", - roleId: "BASIC", + roleId: roleId, homeScreen: false }, }) diff --git a/qa-core/src/tests/internal-api/screens/screens.spec.ts b/qa-core/src/tests/internal-api/screens/screens.spec.ts index 8774d48007..4d2c17177f 100644 --- a/qa-core/src/tests/internal-api/screens/screens.spec.ts +++ b/qa-core/src/tests/internal-api/screens/screens.spec.ts @@ -19,17 +19,20 @@ describe("Internal API - /screens endpoints", () => { await config.afterAll() }) - it("POST - Create a BASIC screen", async () => { + it("POST - Create a screen with each role type", async () => { // Create app const [appResponse, app] = await appConfig.applications.create(generateApp()) expect(appResponse).toHaveStatusCode(200) expect(app._id).toBeDefined() // Create Screen + const roleArray = ["BASIC", "POWER", "ADMIN", "PUBLIC"] appConfig.applications.api.appId = app.appId - const [response, screen] = await config.screen.createScreen(generateScreen()) - expect(response).toHaveStatusCode(200) - expect(screen.routing.roleId).toEqual("BASIC") + for (let i = 0; i < 4; i++) { + const [response, screen] = await config.screen.createScreen(generateScreen(roleArray[i])) + expect(response).toHaveStatusCode(200) + expect(screen.routing.roleId).toEqual(roleArray[i]) + } }) it("GET - Fetch screens", async () => { @@ -40,7 +43,7 @@ describe("Internal API - /screens endpoints", () => { // Create Screen appConfig.applications.api.appId = app.appId - const [response, screen] = await config.screen.createScreen(generateScreen()) + const [response, screen] = await config.screen.createScreen(generateScreen("BASIC")) expect(response).toHaveStatusCode(200) // Check screen exists @@ -57,7 +60,7 @@ describe("Internal API - /screens endpoints", () => { // Create Screen appConfig.applications.api.appId = app.appId - const [screenResponse, screen] = await config.screen.createScreen(generateScreen()) + const [screenResponse, screen] = await config.screen.createScreen(generateScreen("BASIC")) expect(screenResponse).toHaveStatusCode(200) expect(screen._id).toBeDefined()