2022-07-08 20:46:25 +00:00
|
|
|
// Copyright 2022 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import { assert } from 'chai';
|
2023-10-14 01:14:46 +00:00
|
|
|
import type { Group, PrimaryDevice } from '@signalapp/mock-server';
|
2024-02-01 21:05:22 +00:00
|
|
|
import { Proto, ServiceIdKind, StorageState } from '@signalapp/mock-server';
|
2022-07-08 20:46:25 +00:00
|
|
|
import createDebug from 'debug';
|
|
|
|
|
|
|
|
import * as durations from '../../util/durations';
|
2024-02-01 21:05:22 +00:00
|
|
|
import {
|
|
|
|
parseAndFormatPhoneNumber,
|
|
|
|
PhoneNumberFormat,
|
|
|
|
} from '../../util/libphonenumberInstance';
|
2022-07-08 20:46:25 +00:00
|
|
|
import { Bootstrap } from '../bootstrap';
|
|
|
|
import type { App } from '../bootstrap';
|
2024-03-12 16:29:31 +00:00
|
|
|
import { expectSystemMessages } from '../helpers';
|
2022-07-08 20:46:25 +00:00
|
|
|
|
|
|
|
export const debug = createDebug('mock:test:gv2');
|
|
|
|
|
2023-10-11 19:06:43 +00:00
|
|
|
describe('pnp/accept gv2 invite', function (this: Mocha.Suite) {
|
2022-07-08 20:46:25 +00:00
|
|
|
this.timeout(durations.MINUTE);
|
|
|
|
|
|
|
|
let bootstrap: Bootstrap;
|
|
|
|
let app: App;
|
|
|
|
let group: Group;
|
2023-10-14 01:14:46 +00:00
|
|
|
let unknownContact: PrimaryDevice;
|
2024-02-01 21:05:22 +00:00
|
|
|
let unknownPniContact: PrimaryDevice;
|
2022-07-08 20:46:25 +00:00
|
|
|
|
|
|
|
beforeEach(async () => {
|
2023-10-14 01:14:46 +00:00
|
|
|
bootstrap = new Bootstrap({
|
|
|
|
contactCount: 10,
|
|
|
|
unknownContactCount: 3,
|
|
|
|
});
|
2022-07-08 20:46:25 +00:00
|
|
|
await bootstrap.init();
|
|
|
|
|
2024-02-01 21:05:22 +00:00
|
|
|
const { phone, contacts, unknownContacts } = bootstrap;
|
2022-07-08 20:46:25 +00:00
|
|
|
const [first, second] = contacts;
|
2024-02-01 21:05:22 +00:00
|
|
|
[unknownContact, unknownPniContact] = unknownContacts;
|
2022-07-08 20:46:25 +00:00
|
|
|
|
|
|
|
group = await first.createGroup({
|
2024-02-01 21:05:22 +00:00
|
|
|
title: 'Invited Desktop PNI',
|
2023-10-14 01:14:46 +00:00
|
|
|
members: [first, second, unknownContact],
|
2022-07-08 20:46:25 +00:00
|
|
|
});
|
|
|
|
|
2024-02-01 21:05:22 +00:00
|
|
|
let state = StorageState.getEmpty();
|
|
|
|
|
|
|
|
state = state.updateAccount({
|
|
|
|
profileKey: phone.profileKey.serialize(),
|
|
|
|
e164: phone.device.number,
|
|
|
|
});
|
|
|
|
|
|
|
|
state = state.addContact(
|
|
|
|
unknownPniContact,
|
|
|
|
{
|
|
|
|
identityState: Proto.ContactRecord.IdentityState.DEFAULT,
|
|
|
|
whitelisted: true,
|
2024-02-07 21:38:43 +00:00
|
|
|
profileKey: undefined,
|
2024-02-01 21:05:22 +00:00
|
|
|
|
|
|
|
serviceE164: unknownPniContact.device.number,
|
|
|
|
},
|
|
|
|
ServiceIdKind.PNI
|
|
|
|
);
|
|
|
|
|
|
|
|
await phone.setStorageState(state);
|
|
|
|
|
2022-07-08 20:46:25 +00:00
|
|
|
app = await bootstrap.link();
|
|
|
|
|
|
|
|
const { desktop } = bootstrap;
|
|
|
|
|
|
|
|
group = await first.inviteToGroup(group, desktop, {
|
2023-08-16 20:54:39 +00:00
|
|
|
serviceIdKind: ServiceIdKind.PNI,
|
2022-07-08 20:46:25 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
// Verify that created group has pending member
|
2023-10-14 01:14:46 +00:00
|
|
|
assert.strictEqual(group.state?.members?.length, 3);
|
2023-08-16 20:54:39 +00:00
|
|
|
assert(!group.getMemberByServiceId(desktop.aci));
|
|
|
|
assert(!group.getMemberByServiceId(desktop.pni));
|
|
|
|
assert(!group.getPendingMemberByServiceId(desktop.aci));
|
|
|
|
assert(group.getPendingMemberByServiceId(desktop.pni));
|
2022-07-08 20:46:25 +00:00
|
|
|
|
|
|
|
const window = await app.getWindow();
|
|
|
|
|
2023-07-26 22:23:32 +00:00
|
|
|
const leftPane = window.locator('#LeftPane');
|
2022-07-08 20:46:25 +00:00
|
|
|
|
|
|
|
debug('Opening group');
|
2023-01-13 00:24:59 +00:00
|
|
|
await leftPane.locator(`[data-testid="${group.id}"]`).click();
|
2024-08-21 21:31:55 +00:00
|
|
|
|
|
|
|
debug('Wait for conversation open fetches to complete');
|
|
|
|
await app.waitForConversationOpenComplete();
|
2022-07-08 20:46:25 +00:00
|
|
|
});
|
|
|
|
|
2023-10-11 19:06:43 +00:00
|
|
|
afterEach(async function (this: Mocha.Context) {
|
2023-07-14 16:53:20 +00:00
|
|
|
await bootstrap.maybeSaveLogs(this.currentTest, app);
|
2022-07-08 20:46:25 +00:00
|
|
|
await app.close();
|
|
|
|
await bootstrap.teardown();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should accept PNI invite and modify the group state', async () => {
|
|
|
|
const { phone, contacts, desktop } = bootstrap;
|
|
|
|
const [first, second] = contacts;
|
|
|
|
|
|
|
|
const window = await app.getWindow();
|
|
|
|
|
2023-07-26 22:23:32 +00:00
|
|
|
const conversationStack = window.locator('.Inbox__conversation-stack');
|
2022-07-08 20:46:25 +00:00
|
|
|
|
|
|
|
debug('Accepting');
|
|
|
|
await conversationStack
|
|
|
|
.locator('.module-message-request-actions button >> "Accept"')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
group = await phone.waitForGroupUpdate(group);
|
|
|
|
assert.strictEqual(group.revision, 2);
|
2023-10-14 01:14:46 +00:00
|
|
|
assert.strictEqual(group.state?.members?.length, 4);
|
2023-08-16 20:54:39 +00:00
|
|
|
assert(group.getMemberByServiceId(desktop.aci));
|
|
|
|
assert(!group.getMemberByServiceId(desktop.pni));
|
|
|
|
assert(!group.getPendingMemberByServiceId(desktop.aci));
|
|
|
|
assert(!group.getPendingMemberByServiceId(desktop.pni));
|
2022-07-08 20:46:25 +00:00
|
|
|
|
|
|
|
debug('Checking that notifications are present');
|
|
|
|
await window
|
2024-03-12 16:29:31 +00:00
|
|
|
.locator(
|
|
|
|
`.SystemMessage:has-text("${first.profileName} invited you to the group.")`
|
|
|
|
)
|
2022-07-08 20:46:25 +00:00
|
|
|
.waitFor();
|
|
|
|
await window
|
|
|
|
.locator(
|
2024-03-12 16:29:31 +00:00
|
|
|
`.SystemMessage:has-text("You accepted an invitation to the group from ${first.profileName}.")`
|
2022-07-08 20:46:25 +00:00
|
|
|
)
|
|
|
|
.waitFor();
|
|
|
|
|
|
|
|
debug('Invite PNI again');
|
|
|
|
group = await second.inviteToGroup(group, desktop, {
|
2023-08-16 20:54:39 +00:00
|
|
|
serviceIdKind: ServiceIdKind.PNI,
|
2022-07-08 20:46:25 +00:00
|
|
|
});
|
2023-08-16 20:54:39 +00:00
|
|
|
assert(group.getMemberByServiceId(desktop.aci));
|
|
|
|
assert(group.getPendingMemberByServiceId(desktop.pni));
|
2022-07-08 20:46:25 +00:00
|
|
|
|
|
|
|
await window
|
2024-03-12 16:29:31 +00:00
|
|
|
.locator(
|
|
|
|
`.SystemMessage:has-text("${second.profileName} invited you to the group.")`
|
|
|
|
)
|
2022-07-08 20:46:25 +00:00
|
|
|
.waitFor();
|
|
|
|
|
|
|
|
debug('Verify that message request state is not visible');
|
|
|
|
await conversationStack
|
|
|
|
.locator('.module-message-request-actions button >> "Accept"')
|
|
|
|
.waitFor({ state: 'hidden' });
|
|
|
|
|
2023-10-06 15:45:43 +00:00
|
|
|
await window
|
2022-07-08 20:46:25 +00:00
|
|
|
.locator('button.module-ConversationHeader__button--more')
|
|
|
|
.click();
|
|
|
|
|
2023-10-06 15:45:43 +00:00
|
|
|
await window.locator('.react-contextmenu-item >> "Group settings"').click();
|
2022-07-08 20:46:25 +00:00
|
|
|
|
2023-10-14 01:14:46 +00:00
|
|
|
debug(
|
|
|
|
'Checking that we see all members of group, including (previously) unknown contact'
|
|
|
|
);
|
|
|
|
await window
|
|
|
|
.locator('.ConversationDetails-panel-section__title >> "4 members"')
|
|
|
|
.waitFor();
|
|
|
|
await window.getByText(unknownContact.profileName).waitFor();
|
|
|
|
|
|
|
|
debug('Leave the group through settings');
|
|
|
|
|
2022-07-08 20:46:25 +00:00
|
|
|
await conversationStack
|
|
|
|
.locator('.conversation-details-panel >> "Leave group"')
|
|
|
|
.click();
|
|
|
|
|
2024-06-05 21:48:54 +00:00
|
|
|
await window
|
|
|
|
.getByTestId('ConfirmationDialog.ConversationDetailsAction.confirmLeave')
|
|
|
|
.getByRole('button', { name: 'Leave' })
|
|
|
|
.click();
|
|
|
|
|
|
|
|
debug('Get back to timeline');
|
|
|
|
|
|
|
|
await window.locator('.ConversationPanel__header__back-button').click();
|
2022-07-08 20:46:25 +00:00
|
|
|
|
|
|
|
debug('Waiting for final group update');
|
|
|
|
group = await phone.waitForGroupUpdate(group);
|
|
|
|
assert.strictEqual(group.revision, 4);
|
2023-10-14 01:14:46 +00:00
|
|
|
assert.strictEqual(group.state?.members?.length, 3);
|
2023-08-16 20:54:39 +00:00
|
|
|
assert(!group.getMemberByServiceId(desktop.aci));
|
|
|
|
assert(!group.getMemberByServiceId(desktop.pni));
|
|
|
|
assert(!group.getPendingMemberByServiceId(desktop.aci));
|
|
|
|
assert(group.getPendingMemberByServiceId(desktop.pni));
|
2024-06-05 21:48:54 +00:00
|
|
|
|
|
|
|
debug('Waiting for notification');
|
|
|
|
await window
|
|
|
|
.locator('.SystemMessage:has-text("You left the group")')
|
|
|
|
.waitFor();
|
2022-07-08 20:46:25 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should decline PNI invite and modify the group state', async () => {
|
|
|
|
const { phone, desktop } = bootstrap;
|
|
|
|
|
|
|
|
const window = await app.getWindow();
|
|
|
|
|
2023-07-26 22:23:32 +00:00
|
|
|
const conversationStack = window.locator('.Inbox__conversation-stack');
|
2022-07-08 20:46:25 +00:00
|
|
|
|
|
|
|
debug('Declining');
|
|
|
|
await conversationStack
|
2024-03-12 16:29:31 +00:00
|
|
|
.locator('.module-message-request-actions button >> "Block"')
|
2022-07-08 20:46:25 +00:00
|
|
|
.click();
|
|
|
|
|
|
|
|
debug('waiting for confirmation modal');
|
2024-03-12 16:29:31 +00:00
|
|
|
await window.locator('.module-Modal button >> "Block"').click();
|
2022-07-08 20:46:25 +00:00
|
|
|
|
|
|
|
group = await phone.waitForGroupUpdate(group);
|
|
|
|
assert.strictEqual(group.revision, 2);
|
2023-10-14 01:14:46 +00:00
|
|
|
assert.strictEqual(group.state?.members?.length, 3);
|
2023-08-16 20:54:39 +00:00
|
|
|
assert(!group.getMemberByServiceId(desktop.aci));
|
|
|
|
assert(!group.getMemberByServiceId(desktop.pni));
|
|
|
|
assert(!group.getPendingMemberByServiceId(desktop.aci));
|
|
|
|
assert(!group.getPendingMemberByServiceId(desktop.pni));
|
2023-05-23 23:38:58 +00:00
|
|
|
|
|
|
|
// Verify that sync message was sent.
|
|
|
|
const { syncMessage } = await phone.waitForSyncMessage(entry =>
|
|
|
|
Boolean(entry.syncMessage.sent?.message?.groupV2?.groupChange)
|
|
|
|
);
|
|
|
|
const groupChangeBuffer = syncMessage.sent?.message?.groupV2?.groupChange;
|
|
|
|
assert.notEqual(groupChangeBuffer, null);
|
|
|
|
const groupChange = Proto.GroupChange.decode(
|
|
|
|
groupChangeBuffer ?? new Uint8Array(0)
|
|
|
|
);
|
|
|
|
assert.notEqual(groupChange.actions, null);
|
|
|
|
const actions = Proto.GroupChange.Actions.decode(
|
|
|
|
groupChange?.actions ?? new Uint8Array(0)
|
|
|
|
);
|
|
|
|
assert.strictEqual(actions.deletePendingMembers.length, 1);
|
2022-07-08 20:46:25 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should accept ACI invite with extra PNI on the invite list', async () => {
|
|
|
|
const { phone, contacts, desktop } = bootstrap;
|
|
|
|
const [first, second] = contacts;
|
|
|
|
|
|
|
|
const window = await app.getWindow();
|
|
|
|
|
2022-09-01 16:35:44 +00:00
|
|
|
debug('Waiting for the PNI invite');
|
|
|
|
await window
|
2024-03-12 16:29:31 +00:00
|
|
|
.locator(
|
|
|
|
`.SystemMessage:has-text("${first.profileName} invited you to the group.")`
|
|
|
|
)
|
2022-09-01 16:35:44 +00:00
|
|
|
.waitFor();
|
2022-07-08 20:46:25 +00:00
|
|
|
|
2022-09-01 16:35:44 +00:00
|
|
|
debug('Inviting ACI from another contact');
|
2022-07-08 20:46:25 +00:00
|
|
|
group = await second.inviteToGroup(group, desktop, {
|
2023-08-16 20:54:39 +00:00
|
|
|
serviceIdKind: ServiceIdKind.ACI,
|
2022-07-08 20:46:25 +00:00
|
|
|
});
|
|
|
|
|
2023-07-26 22:23:32 +00:00
|
|
|
const conversationStack = window.locator('.Inbox__conversation-stack');
|
2022-07-08 20:46:25 +00:00
|
|
|
|
2022-09-01 16:35:44 +00:00
|
|
|
debug('Waiting for the ACI invite');
|
|
|
|
await window
|
2024-03-12 16:29:31 +00:00
|
|
|
.locator(
|
|
|
|
`.SystemMessage:has-text("${second.profileName} invited you to the group.")`
|
|
|
|
)
|
2022-09-01 16:35:44 +00:00
|
|
|
.waitFor();
|
|
|
|
|
2022-07-08 20:46:25 +00:00
|
|
|
debug('Accepting');
|
|
|
|
await conversationStack
|
|
|
|
.locator('.module-message-request-actions button >> "Accept"')
|
|
|
|
.click();
|
|
|
|
|
2022-09-01 16:35:44 +00:00
|
|
|
debug('Checking final notification');
|
2022-07-08 20:46:25 +00:00
|
|
|
await window
|
|
|
|
.locator(
|
2024-03-12 16:29:31 +00:00
|
|
|
`.SystemMessage:has-text("You accepted an invitation to the group from ${second.profileName}.")`
|
2022-07-08 20:46:25 +00:00
|
|
|
)
|
|
|
|
.waitFor();
|
|
|
|
|
|
|
|
group = await phone.waitForGroupUpdate(group);
|
|
|
|
assert.strictEqual(group.revision, 3);
|
2023-10-14 01:14:46 +00:00
|
|
|
assert.strictEqual(group.state?.members?.length, 4);
|
2023-08-16 20:54:39 +00:00
|
|
|
assert(group.getMemberByServiceId(desktop.aci));
|
|
|
|
assert(!group.getMemberByServiceId(desktop.pni));
|
|
|
|
assert(!group.getPendingMemberByServiceId(desktop.aci));
|
|
|
|
assert(group.getPendingMemberByServiceId(desktop.pni));
|
2022-09-27 20:31:55 +00:00
|
|
|
|
|
|
|
debug('Verifying invite list');
|
|
|
|
await conversationStack
|
|
|
|
.locator('.module-ConversationHeader__header__info__title')
|
|
|
|
.click();
|
|
|
|
await conversationStack
|
|
|
|
.locator(
|
|
|
|
'.ConversationDetails-panel-row__root--button >> ' +
|
|
|
|
'text=Requests & Invites'
|
|
|
|
)
|
|
|
|
.click();
|
|
|
|
await conversationStack
|
2023-05-05 02:48:48 +00:00
|
|
|
.locator('.ConversationDetails__tabs__tab >> text=Invites (1)')
|
2022-09-27 20:31:55 +00:00
|
|
|
.click();
|
|
|
|
await conversationStack
|
|
|
|
.locator(
|
|
|
|
'.ConversationDetails-panel-row__root >> ' +
|
|
|
|
`text=/${first.profileName}.*Invited 1/i`
|
|
|
|
)
|
|
|
|
.waitFor();
|
2022-07-08 20:46:25 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should decline ACI invite with extra PNI on the invite list', async () => {
|
|
|
|
const { phone, contacts, desktop } = bootstrap;
|
|
|
|
const [, second] = contacts;
|
|
|
|
|
|
|
|
const window = await app.getWindow();
|
|
|
|
|
|
|
|
debug('Sending another invite');
|
|
|
|
|
|
|
|
// Invite ACI from another contact
|
|
|
|
group = await second.inviteToGroup(group, desktop, {
|
2023-08-16 20:54:39 +00:00
|
|
|
serviceIdKind: ServiceIdKind.ACI,
|
2022-07-08 20:46:25 +00:00
|
|
|
});
|
|
|
|
|
2023-07-26 22:23:32 +00:00
|
|
|
const conversationStack = window.locator('.Inbox__conversation-stack');
|
2022-07-08 20:46:25 +00:00
|
|
|
|
|
|
|
debug('Declining');
|
|
|
|
await conversationStack
|
2024-03-12 16:29:31 +00:00
|
|
|
.locator('.module-message-request-actions button >> "Block"')
|
2022-07-08 20:46:25 +00:00
|
|
|
.click();
|
|
|
|
|
|
|
|
debug('waiting for confirmation modal');
|
2024-03-12 16:29:31 +00:00
|
|
|
await window.locator('.module-Modal button >> "Block"').click();
|
2022-07-08 20:46:25 +00:00
|
|
|
|
|
|
|
group = await phone.waitForGroupUpdate(group);
|
|
|
|
assert.strictEqual(group.revision, 3);
|
2023-10-14 01:14:46 +00:00
|
|
|
assert.strictEqual(group.state?.members?.length, 3);
|
2023-08-16 20:54:39 +00:00
|
|
|
assert(!group.getMemberByServiceId(desktop.aci));
|
|
|
|
assert(!group.getMemberByServiceId(desktop.pni));
|
|
|
|
assert(!group.getPendingMemberByServiceId(desktop.aci));
|
|
|
|
assert(group.getPendingMemberByServiceId(desktop.pni));
|
2022-07-08 20:46:25 +00:00
|
|
|
});
|
2023-01-11 01:20:13 +00:00
|
|
|
|
|
|
|
it('should display a single notification for remote PNI accept', async () => {
|
|
|
|
const { phone, contacts, desktop } = bootstrap;
|
|
|
|
|
|
|
|
const [first, second] = contacts;
|
|
|
|
|
|
|
|
debug('Creating new group with Desktop');
|
|
|
|
group = await phone.createGroup({
|
|
|
|
title: 'Remote Invite',
|
|
|
|
members: [phone, first],
|
|
|
|
});
|
|
|
|
|
|
|
|
debug('Inviting remote PNI to group');
|
2023-08-16 20:54:39 +00:00
|
|
|
const secondKey = await second.device.popSingleUseKey(ServiceIdKind.PNI);
|
|
|
|
await first.addSingleUseKey(second.device, secondKey, ServiceIdKind.PNI);
|
2023-01-11 01:20:13 +00:00
|
|
|
|
|
|
|
group = await first.inviteToGroup(group, second.device, {
|
2023-08-16 20:54:39 +00:00
|
|
|
serviceIdKind: ServiceIdKind.PNI,
|
2023-01-11 01:20:13 +00:00
|
|
|
timestamp: bootstrap.getTimestamp(),
|
|
|
|
|
|
|
|
// There is no one to receive it so don't bother.
|
2024-02-01 21:05:22 +00:00
|
|
|
sendUpdateTo: [],
|
2023-01-11 01:20:13 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
debug('Sending message to group');
|
|
|
|
await first.sendText(desktop, 'howdy', {
|
|
|
|
group,
|
|
|
|
timestamp: bootstrap.getTimestamp(),
|
|
|
|
});
|
|
|
|
|
|
|
|
const window = await app.getWindow();
|
2023-07-26 22:23:32 +00:00
|
|
|
const leftPane = window.locator('#LeftPane');
|
2023-01-11 01:20:13 +00:00
|
|
|
|
|
|
|
debug('Opening new group');
|
2023-01-13 00:24:59 +00:00
|
|
|
await leftPane.locator(`[data-testid="${group.id}"]`).click();
|
2023-01-11 01:20:13 +00:00
|
|
|
|
|
|
|
debug('Accepting remote invite');
|
2024-02-01 21:05:22 +00:00
|
|
|
await second.acceptPniInvite(group, {
|
2023-01-11 01:20:13 +00:00
|
|
|
timestamp: bootstrap.getTimestamp(),
|
2024-02-01 21:05:22 +00:00
|
|
|
sendUpdateTo: [{ device: desktop }],
|
2023-01-11 01:20:13 +00:00
|
|
|
});
|
|
|
|
|
2024-03-12 16:29:31 +00:00
|
|
|
await expectSystemMessages(window, [
|
|
|
|
'You were added to the group.',
|
|
|
|
`${second.profileName} accepted an invitation to the group from ${first.profileName}.`,
|
|
|
|
]);
|
2023-01-11 01:20:13 +00:00
|
|
|
});
|
2024-02-01 21:05:22 +00:00
|
|
|
|
|
|
|
it('should display a e164 for a PNI invite', async () => {
|
|
|
|
const { phone, contacts, desktop } = bootstrap;
|
|
|
|
|
|
|
|
const [first] = contacts;
|
|
|
|
|
|
|
|
debug('Creating new group with Desktop');
|
|
|
|
group = await phone.createGroup({
|
|
|
|
title: 'Remote Invite',
|
|
|
|
members: [phone, first],
|
|
|
|
});
|
|
|
|
|
|
|
|
debug('Sending message to group');
|
|
|
|
await first.sendText(desktop, 'howdy', {
|
|
|
|
group,
|
|
|
|
timestamp: bootstrap.getTimestamp(),
|
|
|
|
});
|
|
|
|
|
|
|
|
const window = await app.getWindow();
|
|
|
|
const leftPane = window.locator('#LeftPane');
|
|
|
|
|
|
|
|
debug('Opening new group');
|
|
|
|
await leftPane.locator(`[data-testid="${group.id}"]`).click();
|
|
|
|
|
|
|
|
debug('Inviting remote PNI to group');
|
|
|
|
group = await phone.inviteToGroup(group, unknownPniContact.device, {
|
|
|
|
timestamp: bootstrap.getTimestamp(),
|
|
|
|
|
|
|
|
serviceIdKind: ServiceIdKind.PNI,
|
|
|
|
sendUpdateTo: [{ device: desktop }],
|
|
|
|
});
|
|
|
|
|
|
|
|
debug('Waiting for invite notification');
|
|
|
|
const parsedE164 = parseAndFormatPhoneNumber(
|
|
|
|
unknownPniContact.device.number,
|
|
|
|
'+1',
|
|
|
|
PhoneNumberFormat.NATIONAL
|
|
|
|
);
|
|
|
|
if (!parsedE164) {
|
|
|
|
throw new Error('Failed to parse device number');
|
|
|
|
}
|
|
|
|
const { e164 } = parsedE164;
|
|
|
|
await window
|
2024-03-12 16:29:31 +00:00
|
|
|
.locator(`.SystemMessage:has-text("You invited ${e164} to the group")`)
|
2024-02-01 21:05:22 +00:00
|
|
|
.waitFor();
|
|
|
|
|
|
|
|
debug('Accepting remote invite');
|
|
|
|
await unknownPniContact.acceptPniInvite(group, {
|
|
|
|
timestamp: bootstrap.getTimestamp(),
|
|
|
|
sendUpdateTo: [{ device: desktop }],
|
|
|
|
});
|
|
|
|
|
|
|
|
debug('Waiting for accept notification');
|
2024-03-12 16:29:31 +00:00
|
|
|
await expectSystemMessages(window, [
|
|
|
|
'You were added to the group.',
|
|
|
|
/^You invited .* to the group\.$/,
|
|
|
|
`${unknownPniContact.profileName} accepted your invitation to the group.`,
|
|
|
|
]);
|
2024-02-01 21:05:22 +00:00
|
|
|
});
|
2022-07-08 20:46:25 +00:00
|
|
|
});
|