From 3aec3df36df5d74e78befe368dc466bf7106b271 Mon Sep 17 00:00:00 2001 From: Pedro Silva Date: Fri, 23 Dec 2022 16:03:02 +0000 Subject: [PATCH 1/4] Improvements on apps and tables --- .../TestConfiguration/applications.ts | 23 +++++++ .../internal-api/TestConfiguration/rows.ts | 20 +++++- .../src/config/internal-api/fixtures/rows.ts | 24 ++++++++ .../applications/applications.spec.ts | 9 +++ .../tests/internal-api/tables/tables.spec.ts | 61 ++++++++++++++++++- 5 files changed, 134 insertions(+), 3 deletions(-) diff --git a/qa-core/src/config/internal-api/TestConfiguration/applications.ts b/qa-core/src/config/internal-api/TestConfiguration/applications.ts index 1cfd025974..1cb9033984 100644 --- a/qa-core/src/config/internal-api/TestConfiguration/applications.ts +++ b/qa-core/src/config/internal-api/TestConfiguration/applications.ts @@ -153,4 +153,27 @@ export default class AppApi { expect(response).toHaveStatusCode(204) return [response] } + + async unlock(appId: string): Promise<[Response, responseMessage]> { + const response = await this.api.del(`/dev/${appId}/lock`) + const json = await response.json() + expect(response).toHaveStatusCode(200) + expect(json.message).toEqual("Lock released successfully.") + return [response, json] + } + + async updateIcon(appId: string): Promise<[Response, Application]> { + const body = { + icon: { + name: "ConversionFunnel", + color: "var(--spectrum-global-color-red-400)" + } + } + const response = await this.api.put(`/applications/${appId}`, { body }) + const json = await response.json() + expect(response).toHaveStatusCode(200) + expect(json.icon.name).toEqual(body.icon.name) + expect(json.icon.color).toEqual(body.icon.color) + return [response, json] + } } diff --git a/qa-core/src/config/internal-api/TestConfiguration/rows.ts b/qa-core/src/config/internal-api/TestConfiguration/rows.ts index 39ba01f467..435be85d56 100644 --- a/qa-core/src/config/internal-api/TestConfiguration/rows.ts +++ b/qa-core/src/config/internal-api/TestConfiguration/rows.ts @@ -15,7 +15,7 @@ export default class RowsApi { const json = await response.json() if (this.rowAdded) { expect(response).toHaveStatusCode(200) - expect(json.length).toEqual(1) + expect(json.length).toBeGreaterThanOrEqual(1) } return [response, json] } @@ -36,4 +36,22 @@ export default class RowsApi { expect(response).toHaveStatusCode(200) return [response, json] } + + async searchSinglePage(tableId: string, body: any): Promise<[Response, Row[]]> { + const response = await this.api.post(`/${tableId}/search`, { body }) + const json = await response.json() + expect(response).toHaveStatusCode(200) + expect(json.rows.length).toBeLessThanOrEqual(9) + expect(json.hasNextPage).toEqual(false) + return [response, json.rows] + } + + async searchMultiPage(tableId: string, body: any): Promise<[Response, Row[]]> { + const response = await this.api.post(`/${tableId}/search`, { body }) + const json = await response.json() + expect(response).toHaveStatusCode(200) + expect(json.hasNextPage).toEqual(true) + expect(json.rows.length).toEqual(10) + return [response, json.rows] + } } diff --git a/qa-core/src/config/internal-api/fixtures/rows.ts b/qa-core/src/config/internal-api/fixtures/rows.ts index 90f6350dcf..fbb965c215 100644 --- a/qa-core/src/config/internal-api/fixtures/rows.ts +++ b/qa-core/src/config/internal-api/fixtures/rows.ts @@ -6,3 +6,27 @@ export const generateNewRowForTable = (tableId: string): Row => { tableId: tableId, } } + +export const searchBody = (primaryDisplay: string): any => { + return { + bookmark: null, + limit: 10, + paginate: true, + query: { + contains: {}, + containsAny: {}, + empty: {}, + equal: {}, + fuzzy: {}, + notContains: {}, + notEmpty: {}, + notEqual: {}, + oneOf: {}, + range: {}, + string: {}, + }, + sort: primaryDisplay, + sortOrder: "ascending", + sortType: "string" + } +} \ No newline at end of file diff --git a/qa-core/src/tests/internal-api/applications/applications.spec.ts b/qa-core/src/tests/internal-api/applications/applications.spec.ts index 7d889b7e87..4edcd34ca4 100644 --- a/qa-core/src/tests/internal-api/applications/applications.spec.ts +++ b/qa-core/src/tests/internal-api/applications/applications.spec.ts @@ -104,6 +104,14 @@ describe("Internal API - Application creation, update, publish and delete", () = }) }) + it("Update the icon and color of an application", async () => { + const app = await config.applications.create(generateApp()) + + config.applications.api.appId = app.appId + + await config.applications.updateIcon(app.appId) + }) + it("POST - Revert Changes without changes", async () => { const app = await config.applications.create(generateApp()) config.applications.api.appId = app.appId @@ -124,6 +132,7 @@ describe("Internal API - Application creation, update, publish and delete", () = // // Revert the app to published state await config.applications.revertPublished(app.appId) + await config.applications.unlock(app.appId) // Check screen is removed await config.applications.getRoutes() }) diff --git a/qa-core/src/tests/internal-api/tables/tables.spec.ts b/qa-core/src/tests/internal-api/tables/tables.spec.ts index 6b2d2240e5..41acf42f92 100644 --- a/qa-core/src/tests/internal-api/tables/tables.spec.ts +++ b/qa-core/src/tests/internal-api/tables/tables.spec.ts @@ -6,9 +6,9 @@ import { generateTable, generateNewColumnForTable, } from "../../../config/internal-api/fixtures/table" -import { generateNewRowForTable } from "../../../config/internal-api/fixtures/rows" +import { generateNewRowForTable, searchBody } from "../../../config/internal-api/fixtures/rows" -describe("Internal API - Application creation, update, publish and delete", () => { +describe("Internal API - Table Operations", () => { const api = new InternalAPIClient() const config = new TestConfiguration(api) @@ -86,4 +86,61 @@ describe("Internal API - Application creation, update, publish and delete", () = //Table was deleted await config.tables.getAll(2) }) + + it("Search and pagination", async () => { + // create the app + const appName = generator.word() + const app = await createAppFromTemplate() + config.applications.api.appId = app.appId + + // Get current tables: expect 2 in this template + await config.tables.getAll(2) + + // Add new table + const [createdTableResponse, createdTableData] = await config.tables.save( + generateTable() + ) + + //Table was added + await config.tables.getAll(3) + + //Get information about the table + await config.tables.getTableById(createdTableData._id) + + //Add Column to table + const newColumn = generateNewColumnForTable(createdTableData) + const [addColumnResponse, addColumnData] = await config.tables.save( + newColumn, + true + ) + + //Add Row to table + let newRow = generateNewRowForTable(addColumnData._id) + await config.rows.add(addColumnData._id, newRow) + + //Search single row + await config.rows.searchSinglePage(createdTableData._id, searchBody(createdTableData.primaryDisplay)) + + //Add 10 more rows + for (let i = 0; i < 10; i++) { + let newRow = generateNewRowForTable(addColumnData._id) + await config.rows.add(addColumnData._id, newRow) + } + + //Search multiple rows + const [allRowsResponse, allRowsJson] = await config.rows.searchMultiPage(createdTableData._id, searchBody(createdTableData.primaryDisplay)) + + //Delete Rows from table + const rowToDelete = { + rows: [allRowsJson], + } + const [deleteRowResponse, deleteRowData] = await config.rows.delete( + addColumnData._id, + rowToDelete + ) + + //Search single row + await config.rows.searchSinglePage(createdTableData._id, searchBody(createdTableData.primaryDisplay)) + + }) }) From 125a06517d3f790fd4a96261a6d177272fab7280 Mon Sep 17 00:00:00 2001 From: Pedro Silva Date: Wed, 28 Dec 2022 15:46:01 +0000 Subject: [PATCH 2/4] "Edit multiple rows" --- qa-core/src/tests/internal-api/tables/tables.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qa-core/src/tests/internal-api/tables/tables.spec.ts b/qa-core/src/tests/internal-api/tables/tables.spec.ts index 41acf42f92..f93ec0438b 100644 --- a/qa-core/src/tests/internal-api/tables/tables.spec.ts +++ b/qa-core/src/tests/internal-api/tables/tables.spec.ts @@ -127,7 +127,7 @@ describe("Internal API - Table Operations", () => { await config.rows.add(addColumnData._id, newRow) } - //Search multiple rows + //Search rows with pagination const [allRowsResponse, allRowsJson] = await config.rows.searchMultiPage(createdTableData._id, searchBody(createdTableData.primaryDisplay)) //Delete Rows from table @@ -135,7 +135,7 @@ describe("Internal API - Table Operations", () => { rows: [allRowsJson], } const [deleteRowResponse, deleteRowData] = await config.rows.delete( - addColumnData._id, + createdTableData._id, rowToDelete ) From 3fc6dd62f7f8a7a8de4940c39c6338f38360f8f4 Mon Sep 17 00:00:00 2001 From: Pedro Silva Date: Mon, 2 Jan 2023 10:06:05 +0000 Subject: [PATCH 3/4] Add test for table pagination --- qa-core/src/config/internal-api/TestConfiguration/rows.ts | 5 ++--- qa-core/src/tests/internal-api/tables/tables.spec.ts | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/qa-core/src/config/internal-api/TestConfiguration/rows.ts b/qa-core/src/config/internal-api/TestConfiguration/rows.ts index 435be85d56..3514dd1b35 100644 --- a/qa-core/src/config/internal-api/TestConfiguration/rows.ts +++ b/qa-core/src/config/internal-api/TestConfiguration/rows.ts @@ -37,16 +37,15 @@ export default class RowsApi { return [response, json] } - async searchSinglePage(tableId: string, body: any): Promise<[Response, Row[]]> { + async searchNoPagination(tableId: string, body: any): Promise<[Response, Row[]]> { const response = await this.api.post(`/${tableId}/search`, { body }) const json = await response.json() expect(response).toHaveStatusCode(200) - expect(json.rows.length).toBeLessThanOrEqual(9) expect(json.hasNextPage).toEqual(false) return [response, json.rows] } - async searchMultiPage(tableId: string, body: any): Promise<[Response, Row[]]> { + async searchWithPagination(tableId: string, body: any): Promise<[Response, Row[]]> { const response = await this.api.post(`/${tableId}/search`, { body }) const json = await response.json() expect(response).toHaveStatusCode(200) diff --git a/qa-core/src/tests/internal-api/tables/tables.spec.ts b/qa-core/src/tests/internal-api/tables/tables.spec.ts index f93ec0438b..c6dd4ebf3d 100644 --- a/qa-core/src/tests/internal-api/tables/tables.spec.ts +++ b/qa-core/src/tests/internal-api/tables/tables.spec.ts @@ -31,7 +31,7 @@ describe("Internal API - Table Operations", () => { }) } - it("Operations on Tables", async () => { + it("Create and delete table, columns and rows", async () => { // create the app const appName = generator.word() const app = await createAppFromTemplate() @@ -119,7 +119,7 @@ describe("Internal API - Table Operations", () => { await config.rows.add(addColumnData._id, newRow) //Search single row - await config.rows.searchSinglePage(createdTableData._id, searchBody(createdTableData.primaryDisplay)) + await config.rows.searchNoPagination(createdTableData._id, searchBody(createdTableData.primaryDisplay)) //Add 10 more rows for (let i = 0; i < 10; i++) { @@ -128,7 +128,7 @@ describe("Internal API - Table Operations", () => { } //Search rows with pagination - const [allRowsResponse, allRowsJson] = await config.rows.searchMultiPage(createdTableData._id, searchBody(createdTableData.primaryDisplay)) + const [allRowsResponse, allRowsJson] = await config.rows.searchWithPagination(createdTableData._id, searchBody(createdTableData.primaryDisplay)) //Delete Rows from table const rowToDelete = { @@ -140,7 +140,7 @@ describe("Internal API - Table Operations", () => { ) //Search single row - await config.rows.searchSinglePage(createdTableData._id, searchBody(createdTableData.primaryDisplay)) + await config.rows.searchWithPagination(createdTableData._id, searchBody(createdTableData.primaryDisplay)) }) }) From 41c51cb8340e601c1e7cbcbbb4aeb8a0e470ecc8 Mon Sep 17 00:00:00 2001 From: Pedro Silva Date: Mon, 2 Jan 2023 10:09:55 +0000 Subject: [PATCH 4/4] Improve naming and comments --- .../TestConfiguration/applications.ts | 2 +- .../applications/applications.spec.ts | 14 +++--- .../internal-api/screens/screens.spec.ts | 6 +-- .../userManagement/appSpecificRoles.spec.ts | 49 +++++++++++++++---- .../userManagement/userManagement.spec.ts | 5 ++ 5 files changed, 55 insertions(+), 21 deletions(-) diff --git a/qa-core/src/config/internal-api/TestConfiguration/applications.ts b/qa-core/src/config/internal-api/TestConfiguration/applications.ts index 1cb9033984..a874ef0cb8 100644 --- a/qa-core/src/config/internal-api/TestConfiguration/applications.ts +++ b/qa-core/src/config/internal-api/TestConfiguration/applications.ts @@ -117,7 +117,7 @@ export default class AppApi { return [response, json] } - async update( + async rename( appId: string, oldName: string, body: any diff --git a/qa-core/src/tests/internal-api/applications/applications.spec.ts b/qa-core/src/tests/internal-api/applications/applications.spec.ts index 4edcd34ca4..e0e07e3fba 100644 --- a/qa-core/src/tests/internal-api/applications/applications.spec.ts +++ b/qa-core/src/tests/internal-api/applications/applications.spec.ts @@ -67,7 +67,7 @@ describe("Internal API - Application creation, update, publish and delete", () = await config.applications.unpublish(app.appId) }) - it("POST - Sync application before deployment", async () => { + it("Sync application before deployment", async () => { const app = await config.applications.create(generateApp()) config.applications.api.appId = app.appId @@ -79,7 +79,7 @@ describe("Internal API - Application creation, update, publish and delete", () = }) }) - it("POST - Sync application after deployment", async () => { + it("Sync application after deployment", async () => { const app = await config.applications.create(generateApp()) config.applications.api.appId = app.appId @@ -94,12 +94,12 @@ describe("Internal API - Application creation, update, publish and delete", () = }) }) - it("PUT - Update an application", async () => { + it("Rename an application", async () => { const app = await config.applications.create(generateApp()) config.applications.api.appId = app.appId - await config.applications.update(app.appId, app.name, { + await config.applications.rename(app.appId, app.name, { name: generator.word(), }) }) @@ -112,14 +112,14 @@ describe("Internal API - Application creation, update, publish and delete", () = await config.applications.updateIcon(app.appId) }) - it("POST - Revert Changes without changes", async () => { + it("Revert Changes without changes", async () => { const app = await config.applications.create(generateApp()) config.applications.api.appId = app.appId await config.applications.revertUnpublished(app.appId) }) - it("POST - Revert Changes", async () => { + it("Revert Changes", async () => { const app = await config.applications.create(generateApp()) config.applications.api.appId = app.appId @@ -137,7 +137,7 @@ describe("Internal API - Application creation, update, publish and delete", () = await config.applications.getRoutes() }) - it("DELETE - Delete an application", async () => { + it("Delete an application", async () => { const app = await config.applications.create(generateApp()) await config.applications.delete(app.appId) 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 1d2a21a8c7..2e4292afa8 100644 --- a/qa-core/src/tests/internal-api/screens/screens.spec.ts +++ b/qa-core/src/tests/internal-api/screens/screens.spec.ts @@ -18,7 +18,7 @@ describe("Internal API - /screens endpoints", () => { await config.afterAll() }) - it("POST - Create a screen with each role type", async () => { + it("Create a screen with each role type", async () => { // Create app const app = await appConfig.applications.create(generateApp()) @@ -32,7 +32,7 @@ describe("Internal API - /screens endpoints", () => { } }) - it("GET - Fetch screens", async () => { + it("Get screens", async () => { // Create app const app = await appConfig.applications.create(generateApp()) @@ -44,7 +44,7 @@ describe("Internal API - /screens endpoints", () => { await appConfig.applications.getRoutes(true) }) - it("DELETE - Delete a screen", async () => { + it("Delete a screen", async () => { // Create app const app = await appConfig.applications.create(generateApp()) diff --git a/qa-core/src/tests/internal-api/userManagement/appSpecificRoles.spec.ts b/qa-core/src/tests/internal-api/userManagement/appSpecificRoles.spec.ts index 2447a31558..fe985094fd 100644 --- a/qa-core/src/tests/internal-api/userManagement/appSpecificRoles.spec.ts +++ b/qa-core/src/tests/internal-api/userManagement/appSpecificRoles.spec.ts @@ -22,15 +22,21 @@ describe("Internal API - App Specific Roles & Permissions", () => { }) it("Add BASIC user to app", async () => { + // Create a user with BASIC role and check if it was created successfully const appUser = generateUser() expect(appUser[0].builder?.global).toEqual(false) expect(appUser[0].admin?.global).toEqual(false) + + // Add the user to the tenant. const [createUserResponse, createUserJson] = await config.users.addMultiple(appUser) const app = await config.applications.create(appFromTemplate()) config.applications.api.appId = app.appId + // Get all the information from the create user const [userInfoResponse, userInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id) + + // Create the body with the information from the user and add the role to the app const body: User = { ...userInfoJson, roles: { @@ -39,6 +45,7 @@ describe("Internal API - App Specific Roles & Permissions", () => { } await config.users.updateInfo(body) + // Get the user information again and check if the role was added const [changedUserInfoResponse, changedUserInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id) expect(changedUserInfoJson.roles[app.appId]).toBeDefined() expect(changedUserInfoJson.roles[app.appId]).toEqual("BASIC") @@ -46,18 +53,19 @@ describe("Internal API - App Specific Roles & Permissions", () => { }) it("Add ADMIN user to app", async () => { + // Create a user with ADMIN role and check if it was created successfully const adminUser = generateUser(1, "admin") expect(adminUser[0].builder?.global).toEqual(true) expect(adminUser[0].admin?.global).toEqual(true) const [createUserResponse, createUserJson] = await config.users.addMultiple(adminUser) - //const app = await config.applications.create(generateApp()) - //config.applications.api.appId = app.appId - const app = await config.applications.create(appFromTemplate()) config.applications.api.appId = app.appId + // Get all the information from the create user const [userInfoResponse, userInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id) + + // Create the body with the information from the user and add the role to the app const body: User = { ...userInfoJson, roles: { @@ -66,28 +74,26 @@ describe("Internal API - App Specific Roles & Permissions", () => { } await config.users.updateInfo(body) + // Get the user information again and check if the role was added const [changedUserInfoResponse, changedUserInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id) expect(changedUserInfoJson.roles[app.appId]).toBeDefined() expect(changedUserInfoJson.roles[app.appId]).toEqual("ADMIN") - // publish app - await config.applications.publish(app.appId) - // check published app renders - config.applications.api.appId = db.getProdAppID(app.appId!) - await config.applications.canRender() - }) it("Add POWER user to app", async () => { + // Create a user with POWER role and check if it was created successfully const powerUser = generateUser(1, 'developer') expect(powerUser[0].builder?.global).toEqual(true) - const [createUserResponse, createUserJson] = await config.users.addMultiple(powerUser) const app = await config.applications.create(generateApp()) config.applications.api.appId = app.appId + // Get all the information from the create user const [userInfoResponse, userInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id) + + // Create the body with the information from the user and add the role to the app const body: User = { ...userInfoJson, roles: { @@ -96,6 +102,7 @@ describe("Internal API - App Specific Roles & Permissions", () => { } await config.users.updateInfo(body) + // Get the user information again and check if the role was added const [changedUserInfoResponse, changedUserInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id) expect(changedUserInfoJson.roles[app.appId]).toBeDefined() expect(changedUserInfoJson.roles[app.appId]).toEqual("POWER") @@ -104,6 +111,7 @@ describe("Internal API - App Specific Roles & Permissions", () => { describe("Check Access for default roles", () => { it("Check Table access for app user", async () => { + // Create a user with BASIC role and check if it was created successfully const appUser = generateUser() expect(appUser[0].builder?.global).toEqual(false) expect(appUser[0].admin?.global).toEqual(false) @@ -112,7 +120,10 @@ describe("Internal API - App Specific Roles & Permissions", () => { const app = await config.applications.create(generateApp()) config.applications.api.appId = app.appId + // Get all the information from the create user const [userInfoResponse, userInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id) + + // Create the body with the information from the user and add the role to the app const body: User = { ...userInfoJson, roles: { @@ -121,13 +132,17 @@ describe("Internal API - App Specific Roles & Permissions", () => { } await config.users.updateInfo(body) + // Get the user information again and check if the role was added const [changedUserInfoResponse, changedUserInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id) expect(changedUserInfoJson.roles[app.appId]).toBeDefined() expect(changedUserInfoJson.roles[app.appId]).toEqual("BASIC") + // Create a table const [createdTableResponse, createdTableData] = await config.tables.save( generateTable() ) + + // Login with the user created and try to create a column await config.login(appUser[0].email, appUser[0].password) const newColumn = generateNewColumnForTable(createdTableData) await config.tables.forbiddenSave( @@ -136,6 +151,7 @@ describe("Internal API - App Specific Roles & Permissions", () => { }) it("Check Table access for developer", async () => { + // Create a user with POWER role and check if it was created successfully const developer = generateUser(1, 'developer') expect(developer[0].builder?.global).toEqual(true) @@ -144,7 +160,10 @@ describe("Internal API - App Specific Roles & Permissions", () => { const app = await config.applications.create(generateApp()) config.applications.api.appId = app.appId + // Get all the information from the create user const [userInfoResponse, userInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id) + + // Create the body with the information from the user and add the role to the app const body: User = { ...userInfoJson, roles: { @@ -153,13 +172,17 @@ describe("Internal API - App Specific Roles & Permissions", () => { } await config.users.updateInfo(body) + // Get the user information again and check if the role was added const [changedUserInfoResponse, changedUserInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id) expect(changedUserInfoJson.roles[app.appId]).toBeDefined() expect(changedUserInfoJson.roles[app.appId]).toEqual("POWER") + // Create a table const [createdTableResponse, createdTableData] = await config.tables.save( generateTable() ) + + // Login with the user created and try to create a column await config.login(developer[0].email, developer[0].password) const newColumn = generateNewColumnForTable(createdTableData) const [addColumnResponse, addColumnData] = await config.tables.save( @@ -169,6 +192,7 @@ describe("Internal API - App Specific Roles & Permissions", () => { }) it("Check Table access for admin", async () => { + // Create a user with ADMIN role and check if it was created successfully const adminUser = generateUser(1, "admin") expect(adminUser[0].builder?.global).toEqual(true) expect(adminUser[0].admin?.global).toEqual(true) @@ -177,7 +201,10 @@ describe("Internal API - App Specific Roles & Permissions", () => { const app = await config.applications.create(generateApp()) config.applications.api.appId = app.appId + // Get all the information from the create user const [userInfoResponse, userInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id) + + // Create the body with the information from the user and add the role to the app const body: User = { ...userInfoJson, roles: { @@ -186,10 +213,12 @@ describe("Internal API - App Specific Roles & Permissions", () => { } await config.users.updateInfo(body) + // Get the user information again and check if the role was added const [changedUserInfoResponse, changedUserInfoJson] = await config.users.getInfo(createUserJson.created.successful[0]._id) expect(changedUserInfoJson.roles[app.appId]).toBeDefined() expect(changedUserInfoJson.roles[app.appId]).toEqual("ADMIN") + // Login with the created user and create a table await config.login(adminUser[0].email, adminUser[0].password) const [createdTableResponse, createdTableData] = await config.tables.save( generateTable() diff --git a/qa-core/src/tests/internal-api/userManagement/userManagement.spec.ts b/qa-core/src/tests/internal-api/userManagement/userManagement.spec.ts index 32820b8b7f..2290106731 100644 --- a/qa-core/src/tests/internal-api/userManagement/userManagement.spec.ts +++ b/qa-core/src/tests/internal-api/userManagement/userManagement.spec.ts @@ -18,9 +18,13 @@ describe("Internal API - User Management & Permissions", () => { }) it("Add Users with different roles", async () => { + // Get all users await config.users.search() + + // Get all roles await config.users.getRoles() + // Add users with each role const admin = generateUser(1, "admin") expect(admin[0].builder?.global).toEqual(true) expect(admin[0].admin?.global).toEqual(true) @@ -34,6 +38,7 @@ describe("Internal API - User Management & Permissions", () => { await config.users.addMultiple(userList) + // Check users are added const [allUsersResponse, allUsersJson] = await config.users.getAll() expect(allUsersJson.length).toBeGreaterThan(0)