diff --git a/test-e2e/sync.js b/test-e2e/sync.js index 68524e24b..e369ee98a 100644 --- a/test-e2e/sync.js +++ b/test-e2e/sync.js @@ -690,6 +690,17 @@ test('no sync capabilities === no namespaces sync apart from auth', async (t) => ) const [invitorProject, inviteeProject] = projects + assert.equal( + (await invitorProject.$member.getById(blocked.deviceId)).role.roleId, + BLOCKED_ROLE_ID, + 'invitor sees blocked participant as part of the project' + ) + assert.equal( + (await inviteeProject.$member.getById(blocked.deviceId)).role.roleId, + BLOCKED_ROLE_ID, + 'invitee sees blocked participant as part of the project' + ) + const generatedDocs = (await seedDatabases([inviteeProject])).flat() const configDocsCount = generatedDocs.filter( (doc) => doc.schemaName !== 'observation' diff --git a/test-e2e/utils.js b/test-e2e/utils.js index 3102a32c9..e56955375 100644 --- a/test-e2e/utils.js +++ b/test-e2e/utils.js @@ -134,17 +134,21 @@ export async function invite({ */ export const waitForPeers = (managers, { waitForDeviceInfo = false } = {}) => new Promise((res) => { - const expectedCount = managers.length - 1 + const deviceIds = new Set(managers.map((m) => m.deviceId)) + const isDone = () => managers.every((manager) => { - const { peers } = manager[kRPC] - const connectedPeers = peers.filter( - ({ status }) => status === 'connected' - ) - return ( - connectedPeers.length === expectedCount && - (!waitForDeviceInfo || connectedPeers.every(({ name }) => !!name)) - ) + const unconnectedDeviceIds = new Set(deviceIds) + unconnectedDeviceIds.delete(manager.deviceId) + for (const peer of manager[kRPC].peers) { + if ( + peer.status === 'connected' && + (!waitForDeviceInfo || peer.name) + ) { + unconnectedDeviceIds.delete(peer.deviceId) + } + } + return unconnectedDeviceIds.size === 0 }) if (isDone()) {