From f4f719d799fd97e6f30664c91821cfebf7e304cb Mon Sep 17 00:00:00 2001 From: Diana Barsan Date: Wed, 26 Jul 2023 13:35:02 +0300 Subject: [PATCH] fix e2e test --- ...=> db-access-for-custom-roles.wdio-spec.js} | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) rename tests/e2e/default/db/{db-access-for-custom-roles.spec.js => db-access-for-custom-roles.wdio-spec.js} (86%) diff --git a/tests/e2e/default/db/db-access-for-custom-roles.spec.js b/tests/e2e/default/db/db-access-for-custom-roles.wdio-spec.js similarity index 86% rename from tests/e2e/default/db/db-access-for-custom-roles.spec.js rename to tests/e2e/default/db/db-access-for-custom-roles.wdio-spec.js index 1eeed0b0001..f87e2fb9142 100644 --- a/tests/e2e/default/db/db-access-for-custom-roles.spec.js +++ b/tests/e2e/default/db/db-access-for-custom-roles.wdio-spec.js @@ -24,18 +24,22 @@ const newRole = 'new_chw'; const addRole = async (role = newRole) => { const settings = await utils.getSettings(); - settings.roles[role] = { ...settings.roles.chw }; + settings.roles[role] = { name: newRole, offline: true }; + Object.values(settings.permissions).forEach(roles => { + if (roles.includes('chw')) { + roles.push(newRole); + } + }); await utils.updateSettings(settings, true); }; const username = uuid(); const user = { - _id: `org.couchdb.user:${username}`, - type: 'user', + username: username, password: uuid(), - facility_id: clinic._id, - contact_id: contact._id, - roles: [ newRole ] + place: clinic._id, + contact: contact._id, + roles: [newRole] }; describe('Database access for new roles', () => { @@ -60,7 +64,7 @@ describe('Database access for new roles', () => { await browserDbUtils.createDoc(report); await commonPage.sync(); - await utils.get(report._id); + await utils.getDoc(report._id); }); it('should be able to sync documents down', async () => {