diff --git a/api-tests/core/admin/ee/review-workflows.test.api.js b/api-tests/core/admin/ee/review-workflows.test.api.js index 0ce21e656c..3b0d8bbd2a 100644 --- a/api-tests/core/admin/ee/review-workflows.test.api.js +++ b/api-tests/core/admin/ee/review-workflows.test.api.js @@ -648,8 +648,14 @@ describeOnCondition(edition === 'EE')('Review workflows', () => { let utils; let entry; let restrictedRequest; + let restrictedUser; let restrictedRole; + const deleteFixtures = async () => { + await utils.deleteUserById(restrictedUser.id); + await utils.deleteRolesById([restrictedRole.id]); + }; + beforeAll(async () => { // Update workflow to assign content type await requests.admin.put(`/admin/review-workflows/workflows/${testWorkflow.id}?populate=*`, { @@ -658,24 +664,28 @@ describeOnCondition(edition === 'EE')('Review workflows', () => { entry = await createEntry(productUID, { name: 'Product' }); - const restrictedUser = { - email: 'restricted@user.io', - password: 'Restricted123', - }; - utils = createUtils(strapi); const role = await utils.createRole({ name: 'restricted-role', description: '', }); + restrictedRole = role; - await utils.createUserIfNotExists({ - ...restrictedUser, + const restrictedUserInfo = { + email: 'restricted@user.io', + password: 'Restricted123', + }; + + restrictedUser = await utils.createUserIfNotExists({ + ...restrictedUserInfo, roles: [role.id], }); - restrictedRole = role; - restrictedRequest = await createAuthRequest({ strapi, userInfo: restrictedUser }); + restrictedRequest = await createAuthRequest({ strapi, userInfo: restrictedUserInfo }); + }); + + afterAll(async () => { + await deleteFixtures(); }); test("It shouldn't be available for public", async () => {