2022-12-05 22:46:54 +00:00
|
|
|
// Copyright 2022 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import { assert } from 'chai';
|
2023-08-16 20:54:39 +00:00
|
|
|
import { ServiceIdKind, Proto, StorageState } from '@signalapp/mock-server';
|
2022-12-05 22:46:54 +00:00
|
|
|
import type { PrimaryDevice } from '@signalapp/mock-server';
|
|
|
|
import createDebug from 'debug';
|
2023-02-01 21:32:46 +00:00
|
|
|
import Long from 'long';
|
2022-12-05 22:46:54 +00:00
|
|
|
|
|
|
|
import * as durations from '../../util/durations';
|
|
|
|
import { uuidToBytes } from '../../util/uuidToBytes';
|
2024-01-29 22:37:26 +00:00
|
|
|
import { generateConfigMatrix } from '../../util/generateConfigMatrix';
|
2023-09-27 23:14:55 +00:00
|
|
|
import { toUntaggedPni } from '../../types/ServiceId';
|
2022-12-05 22:46:54 +00:00
|
|
|
import { MY_STORY_ID } from '../../types/Stories';
|
|
|
|
import { Bootstrap } from '../bootstrap';
|
|
|
|
import type { App } from '../bootstrap';
|
2024-03-12 16:29:31 +00:00
|
|
|
import { expectSystemMessages } from '../helpers';
|
2022-12-05 22:46:54 +00:00
|
|
|
|
|
|
|
export const debug = createDebug('mock:test:merge');
|
|
|
|
|
|
|
|
const IdentifierType = Proto.ManifestRecord.Identifier.Type;
|
|
|
|
|
2023-10-11 19:06:43 +00:00
|
|
|
describe('pnp/merge', function (this: Mocha.Suite) {
|
2022-12-05 22:46:54 +00:00
|
|
|
this.timeout(durations.MINUTE);
|
|
|
|
|
|
|
|
let bootstrap: Bootstrap;
|
|
|
|
let app: App;
|
|
|
|
let pniContact: PrimaryDevice;
|
|
|
|
let pniIdentityKey: Uint8Array;
|
|
|
|
let aciIdentityKey: Uint8Array;
|
|
|
|
|
|
|
|
beforeEach(async () => {
|
2023-02-01 21:32:46 +00:00
|
|
|
bootstrap = new Bootstrap({ contactCount: 0 });
|
2022-12-05 22:46:54 +00:00
|
|
|
await bootstrap.init();
|
|
|
|
|
|
|
|
const { server, phone } = bootstrap;
|
|
|
|
|
|
|
|
pniContact = await server.createPrimaryDevice({
|
|
|
|
profileName: 'ACI Contact',
|
|
|
|
});
|
2023-08-16 20:54:39 +00:00
|
|
|
pniIdentityKey = pniContact.getPublicKey(ServiceIdKind.PNI).serialize();
|
2022-12-05 22:46:54 +00:00
|
|
|
aciIdentityKey = pniContact.publicKey.serialize();
|
|
|
|
|
|
|
|
let state = StorageState.getEmpty();
|
|
|
|
|
|
|
|
state = state.updateAccount({
|
|
|
|
profileKey: phone.profileKey.serialize(),
|
|
|
|
e164: phone.device.number,
|
|
|
|
});
|
|
|
|
|
|
|
|
state = state.addContact(
|
|
|
|
pniContact,
|
|
|
|
{
|
|
|
|
identityState: Proto.ContactRecord.IdentityState.DEFAULT,
|
|
|
|
whitelisted: true,
|
|
|
|
|
|
|
|
identityKey: pniIdentityKey,
|
|
|
|
|
|
|
|
serviceE164: pniContact.device.number,
|
|
|
|
givenName: 'PNI Contact',
|
|
|
|
},
|
2023-08-16 20:54:39 +00:00
|
|
|
ServiceIdKind.PNI
|
2022-12-05 22:46:54 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
state = state.addContact(pniContact, {
|
|
|
|
identityState: Proto.ContactRecord.IdentityState.DEFAULT,
|
|
|
|
whitelisted: true,
|
|
|
|
|
|
|
|
serviceE164: undefined,
|
|
|
|
identityKey: aciIdentityKey,
|
2023-02-01 21:32:46 +00:00
|
|
|
givenName: pniContact.profileName,
|
2022-12-05 22:46:54 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
// Put both contacts in left pane
|
2023-08-16 20:54:39 +00:00
|
|
|
state = state.pin(pniContact, ServiceIdKind.PNI);
|
|
|
|
state = state.pin(pniContact, ServiceIdKind.ACI);
|
2022-12-05 22:46:54 +00:00
|
|
|
|
|
|
|
// Add my story
|
|
|
|
state = state.addRecord({
|
|
|
|
type: IdentifierType.STORY_DISTRIBUTION_LIST,
|
|
|
|
record: {
|
|
|
|
storyDistributionList: {
|
|
|
|
allowsReplies: true,
|
|
|
|
identifier: uuidToBytes(MY_STORY_ID),
|
|
|
|
isBlockList: true,
|
|
|
|
name: MY_STORY_ID,
|
2023-08-16 20:54:39 +00:00
|
|
|
recipientServiceIds: [],
|
2022-12-05 22:46:54 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
await phone.setStorageState(state);
|
|
|
|
|
|
|
|
app = await bootstrap.link();
|
|
|
|
});
|
|
|
|
|
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-12-05 22:46:54 +00:00
|
|
|
await app.close();
|
|
|
|
await bootstrap.teardown();
|
|
|
|
});
|
|
|
|
|
2024-01-29 22:37:26 +00:00
|
|
|
const matrix = generateConfigMatrix({
|
|
|
|
finalContact: [ServiceIdKind.ACI, ServiceIdKind.PNI],
|
|
|
|
withPNIMessage: [false, true],
|
|
|
|
pniSignatureVerified: [false, true],
|
|
|
|
});
|
|
|
|
for (const { finalContact, withPNIMessage, pniSignatureVerified } of matrix) {
|
|
|
|
const testName =
|
|
|
|
'happens via storage service, ' +
|
|
|
|
`${withPNIMessage ? 'with' : 'without'} pni message ` +
|
|
|
|
`${pniSignatureVerified ? 'with' : 'without'} pniSignatureVerified ` +
|
|
|
|
`(${finalContact})`;
|
2022-12-05 22:46:54 +00:00
|
|
|
|
2024-01-29 22:37:26 +00:00
|
|
|
// eslint-disable-next-line no-loop-func
|
|
|
|
it(testName, async () => {
|
|
|
|
const { phone } = bootstrap;
|
2022-12-05 22:46:54 +00:00
|
|
|
|
2024-01-29 22:37:26 +00:00
|
|
|
const window = await app.getWindow();
|
|
|
|
const leftPane = window.locator('#LeftPane');
|
2022-12-05 22:46:54 +00:00
|
|
|
|
2024-01-29 22:37:26 +00:00
|
|
|
debug('opening conversation with the aci contact');
|
|
|
|
await leftPane
|
|
|
|
.locator(`[data-testid="${pniContact.device.aci}"]`)
|
|
|
|
.click();
|
2023-01-10 18:57:39 +00:00
|
|
|
|
2024-01-29 22:37:26 +00:00
|
|
|
await window.locator('.module-conversation-hero').waitFor();
|
2023-01-10 18:57:39 +00:00
|
|
|
|
2024-01-29 22:37:26 +00:00
|
|
|
debug('Send message to ACI');
|
|
|
|
{
|
|
|
|
const compositionInput = await app.waitForEnabledComposer();
|
2023-01-10 18:57:39 +00:00
|
|
|
|
2024-01-29 22:37:26 +00:00
|
|
|
await compositionInput.type('Hello ACI');
|
|
|
|
await compositionInput.press('Enter');
|
|
|
|
}
|
2023-01-10 18:57:39 +00:00
|
|
|
|
2024-01-29 22:37:26 +00:00
|
|
|
debug('opening conversation with the pni contact');
|
|
|
|
await leftPane
|
|
|
|
.locator('.module-conversation-list__item--contact-or-conversation')
|
|
|
|
.first()
|
|
|
|
.click();
|
2023-03-24 00:52:46 +00:00
|
|
|
|
2024-01-29 22:37:26 +00:00
|
|
|
await window.locator('.module-conversation-hero').waitFor();
|
2023-01-10 18:57:39 +00:00
|
|
|
|
2024-01-29 22:37:26 +00:00
|
|
|
debug('Verify starting state');
|
|
|
|
{
|
|
|
|
// No messages
|
|
|
|
const messages = window.locator('.module-message__text');
|
|
|
|
assert.strictEqual(await messages.count(), 0, 'message count');
|
|
|
|
|
2024-03-12 16:29:31 +00:00
|
|
|
await expectSystemMessages(window, [
|
2024-03-15 19:11:48 +00:00
|
|
|
// none
|
2024-03-12 16:29:31 +00:00
|
|
|
]);
|
2024-01-29 22:37:26 +00:00
|
|
|
}
|
2023-03-24 00:52:46 +00:00
|
|
|
|
2024-01-29 22:37:26 +00:00
|
|
|
if (withPNIMessage) {
|
|
|
|
debug('Send message to PNI');
|
|
|
|
const compositionInput = await app.waitForEnabledComposer();
|
2023-03-24 00:52:46 +00:00
|
|
|
|
2024-01-29 22:37:26 +00:00
|
|
|
await compositionInput.type('Hello PNI');
|
|
|
|
await compositionInput.press('Enter');
|
|
|
|
}
|
2023-03-24 00:52:46 +00:00
|
|
|
|
2024-01-29 22:37:26 +00:00
|
|
|
if (finalContact === ServiceIdKind.ACI) {
|
|
|
|
debug('switching back to ACI conversation');
|
|
|
|
await leftPane
|
|
|
|
.locator(`[data-testid="${pniContact.device.aci}"]`)
|
|
|
|
.click();
|
2023-03-24 00:52:46 +00:00
|
|
|
|
2024-01-29 22:37:26 +00:00
|
|
|
await window.locator('.module-conversation-hero').waitFor();
|
|
|
|
}
|
2023-03-24 00:52:46 +00:00
|
|
|
|
2024-01-29 22:37:26 +00:00
|
|
|
debug(
|
|
|
|
'removing both contacts from storage service, adding one combined contact'
|
|
|
|
);
|
|
|
|
{
|
|
|
|
const state = await phone.expectStorageState('consistency check');
|
|
|
|
await phone.setStorageState(
|
|
|
|
state.mergeContact(pniContact, {
|
|
|
|
identityState: Proto.ContactRecord.IdentityState.DEFAULT,
|
|
|
|
whitelisted: true,
|
|
|
|
identityKey: pniContact.publicKey.serialize(),
|
|
|
|
profileKey: pniContact.profileKey.serialize(),
|
|
|
|
pniSignatureVerified,
|
|
|
|
})
|
2023-01-10 18:57:39 +00:00
|
|
|
);
|
2024-01-29 22:37:26 +00:00
|
|
|
await phone.sendFetchStorage({
|
|
|
|
timestamp: bootstrap.getTimestamp(),
|
|
|
|
});
|
|
|
|
await app.waitForManifestVersion(state.version);
|
|
|
|
}
|
2023-03-24 00:52:46 +00:00
|
|
|
|
2024-01-29 22:37:26 +00:00
|
|
|
debug('Verify final state');
|
|
|
|
{
|
|
|
|
// Should have both PNI and ACI messages
|
|
|
|
await window.locator('.module-message__text >> "Hello ACI"').waitFor();
|
|
|
|
if (withPNIMessage) {
|
2023-03-24 00:52:46 +00:00
|
|
|
await window
|
2024-01-29 22:37:26 +00:00
|
|
|
.locator('.module-message__text >> "Hello PNI"')
|
2023-03-24 00:52:46 +00:00
|
|
|
.waitFor();
|
2024-01-29 22:37:26 +00:00
|
|
|
}
|
2023-03-24 00:52:46 +00:00
|
|
|
|
2024-01-29 22:37:26 +00:00
|
|
|
const messages = window.locator('.module-message__text');
|
|
|
|
assert.strictEqual(
|
|
|
|
await messages.count(),
|
|
|
|
withPNIMessage ? 2 : 1,
|
|
|
|
'message count'
|
|
|
|
);
|
2023-03-24 00:52:46 +00:00
|
|
|
|
2024-03-12 16:29:31 +00:00
|
|
|
if (withPNIMessage) {
|
|
|
|
if (pniSignatureVerified) {
|
|
|
|
await expectSystemMessages(window, [
|
|
|
|
/Your message history with ACI Contact and their number .* has been merged\./,
|
|
|
|
]);
|
|
|
|
} else {
|
|
|
|
await expectSystemMessages(window, [
|
|
|
|
/Your message history with ACI Contact and their number .* has been merged\./,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
await expectSystemMessages(window, [
|
2024-03-15 19:11:48 +00:00
|
|
|
// none
|
2024-03-12 16:29:31 +00:00
|
|
|
]);
|
2023-03-24 00:52:46 +00:00
|
|
|
}
|
2024-01-29 22:37:26 +00:00
|
|
|
}
|
|
|
|
});
|
2023-01-10 18:57:39 +00:00
|
|
|
}
|
2023-02-01 21:32:46 +00:00
|
|
|
|
2024-01-31 17:51:09 +00:00
|
|
|
for (const withPniContact of [false, true]) {
|
|
|
|
const testName =
|
|
|
|
'accepts storage service contact splitting ' +
|
|
|
|
`${withPniContact ? 'with PNI contact' : 'without PNI contact'}`;
|
2023-02-01 21:32:46 +00:00
|
|
|
|
2024-01-31 17:51:09 +00:00
|
|
|
// eslint-disable-next-line no-loop-func
|
|
|
|
it(testName, async () => {
|
|
|
|
const { phone } = bootstrap;
|
|
|
|
|
|
|
|
debug(
|
|
|
|
'removing both contacts from storage service, adding one combined contact'
|
2023-02-01 21:32:46 +00:00
|
|
|
);
|
2024-01-31 17:51:09 +00:00
|
|
|
{
|
|
|
|
const state = await phone.expectStorageState('consistency check');
|
|
|
|
await phone.setStorageState(
|
|
|
|
state.mergeContact(pniContact, {
|
|
|
|
identityState: Proto.ContactRecord.IdentityState.DEFAULT,
|
|
|
|
whitelisted: true,
|
|
|
|
identityKey: pniContact.publicKey.serialize(),
|
|
|
|
profileKey: pniContact.profileKey.serialize(),
|
|
|
|
})
|
|
|
|
);
|
|
|
|
await phone.sendFetchStorage({
|
|
|
|
timestamp: bootstrap.getTimestamp(),
|
|
|
|
});
|
|
|
|
}
|
2023-02-01 21:32:46 +00:00
|
|
|
|
2024-01-31 17:51:09 +00:00
|
|
|
const window = await app.getWindow();
|
|
|
|
const leftPane = window.locator('#LeftPane');
|
2023-02-01 21:32:46 +00:00
|
|
|
|
2024-01-31 17:51:09 +00:00
|
|
|
debug('opening conversation with the merged contact');
|
|
|
|
await leftPane
|
|
|
|
.locator(
|
|
|
|
`[data-testid="${pniContact.device.aci}"] >> ` +
|
|
|
|
`"${pniContact.profileName}"`
|
|
|
|
)
|
|
|
|
.click();
|
2023-02-01 21:32:46 +00:00
|
|
|
|
2024-01-31 17:51:09 +00:00
|
|
|
await window.locator('.module-conversation-hero').waitFor();
|
2023-02-01 21:32:46 +00:00
|
|
|
|
2024-01-31 17:51:09 +00:00
|
|
|
debug('Send message to merged contact');
|
|
|
|
{
|
|
|
|
const compositionInput = await app.waitForEnabledComposer();
|
2023-02-01 21:32:46 +00:00
|
|
|
|
2024-01-31 17:51:09 +00:00
|
|
|
await compositionInput.type('Hello merged');
|
|
|
|
await compositionInput.press('Enter');
|
|
|
|
}
|
2023-02-01 21:32:46 +00:00
|
|
|
|
2024-01-31 17:51:09 +00:00
|
|
|
debug('Split contact and mark ACI as unregistered');
|
|
|
|
{
|
|
|
|
let state = await phone.expectStorageState('consistency check');
|
2023-02-01 21:32:46 +00:00
|
|
|
|
2024-01-31 17:51:09 +00:00
|
|
|
state = state.updateContact(pniContact, {
|
|
|
|
pni: undefined,
|
|
|
|
serviceE164: undefined,
|
|
|
|
unregisteredAtTimestamp: Long.fromNumber(bootstrap.getTimestamp()),
|
|
|
|
});
|
2023-02-01 21:32:46 +00:00
|
|
|
|
2024-01-31 17:51:09 +00:00
|
|
|
if (withPniContact) {
|
|
|
|
state = state.addContact(
|
|
|
|
pniContact,
|
|
|
|
{
|
|
|
|
identityState: Proto.ContactRecord.IdentityState.DEFAULT,
|
|
|
|
whitelisted: true,
|
2023-02-01 21:32:46 +00:00
|
|
|
|
2024-01-31 17:51:09 +00:00
|
|
|
identityKey: pniIdentityKey,
|
2023-02-01 21:32:46 +00:00
|
|
|
|
2024-01-31 17:51:09 +00:00
|
|
|
serviceE164: pniContact.device.number,
|
|
|
|
givenName: 'PNI Contact',
|
|
|
|
},
|
|
|
|
ServiceIdKind.PNI
|
|
|
|
);
|
|
|
|
}
|
2023-02-01 21:32:46 +00:00
|
|
|
|
2024-01-31 17:51:09 +00:00
|
|
|
state = state.pin(pniContact, ServiceIdKind.PNI);
|
2023-02-01 21:32:46 +00:00
|
|
|
|
2024-01-31 17:51:09 +00:00
|
|
|
await phone.setStorageState(state);
|
|
|
|
await phone.sendFetchStorage({
|
|
|
|
timestamp: bootstrap.getTimestamp(),
|
|
|
|
});
|
|
|
|
}
|
2023-02-01 21:32:46 +00:00
|
|
|
|
2024-01-31 17:51:09 +00:00
|
|
|
debug('Wait for pni contact to appear');
|
|
|
|
await leftPane
|
|
|
|
.locator(`[data-testid="${pniContact.device.pni}"]`)
|
|
|
|
.waitFor();
|
2023-02-01 21:32:46 +00:00
|
|
|
|
2024-01-31 17:51:09 +00:00
|
|
|
debug('Verify that the message is in the ACI conversation');
|
|
|
|
{
|
|
|
|
// Should have both PNI and ACI messages
|
|
|
|
await window
|
|
|
|
.locator('.module-message__text >> "Hello merged"')
|
|
|
|
.waitFor();
|
2023-02-01 21:32:46 +00:00
|
|
|
|
2024-01-31 17:51:09 +00:00
|
|
|
const messages = window.locator('.module-message__text');
|
|
|
|
assert.strictEqual(await messages.count(), 1, 'message count');
|
|
|
|
}
|
2023-02-01 21:32:46 +00:00
|
|
|
|
2024-01-31 17:51:09 +00:00
|
|
|
debug('Open PNI conversation');
|
|
|
|
await leftPane
|
|
|
|
.locator(`[data-testid="${pniContact.device.pni}"]`)
|
|
|
|
.click();
|
2023-02-01 21:32:46 +00:00
|
|
|
|
2024-01-31 17:51:09 +00:00
|
|
|
debug('Verify absence of messages in the PNI conversation');
|
|
|
|
{
|
|
|
|
const messages = window.locator('.module-message__text');
|
|
|
|
assert.strictEqual(await messages.count(), 0, 'message count');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2023-02-01 21:32:46 +00:00
|
|
|
|
|
|
|
it('splits contact when ACI becomes unregistered', async () => {
|
|
|
|
const { phone, server } = bootstrap;
|
|
|
|
|
|
|
|
debug(
|
|
|
|
'removing both contacts from storage service, adding one combined contact'
|
|
|
|
);
|
|
|
|
{
|
|
|
|
const state = await phone.expectStorageState('consistency check');
|
|
|
|
await phone.setStorageState(
|
|
|
|
state.mergeContact(pniContact, {
|
|
|
|
identityState: Proto.ContactRecord.IdentityState.DEFAULT,
|
|
|
|
whitelisted: true,
|
|
|
|
identityKey: pniContact.publicKey.serialize(),
|
|
|
|
profileKey: pniContact.profileKey.serialize(),
|
|
|
|
})
|
|
|
|
);
|
|
|
|
await phone.sendFetchStorage({
|
|
|
|
timestamp: bootstrap.getTimestamp(),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
const window = await app.getWindow();
|
2023-07-26 22:23:32 +00:00
|
|
|
const leftPane = window.locator('#LeftPane');
|
2023-02-01 21:32:46 +00:00
|
|
|
|
|
|
|
debug('opening conversation with the merged contact');
|
|
|
|
await leftPane
|
|
|
|
.locator(
|
2023-08-16 20:54:39 +00:00
|
|
|
`[data-testid="${pniContact.device.aci}"] >> ` +
|
2023-02-01 21:32:46 +00:00
|
|
|
`"${pniContact.profileName}"`
|
|
|
|
)
|
|
|
|
.click();
|
|
|
|
|
|
|
|
await window.locator('.module-conversation-hero').waitFor();
|
|
|
|
|
|
|
|
debug('Unregistering ACI');
|
|
|
|
server.unregister(pniContact);
|
|
|
|
|
|
|
|
const state = await phone.expectStorageState('initial state');
|
|
|
|
|
|
|
|
debug('Send message to merged contact');
|
|
|
|
{
|
2023-04-14 18:16:28 +00:00
|
|
|
const compositionInput = await app.waitForEnabledComposer();
|
2023-02-01 21:32:46 +00:00
|
|
|
|
|
|
|
await compositionInput.type('Hello merged');
|
|
|
|
await compositionInput.press('Enter');
|
|
|
|
}
|
|
|
|
|
|
|
|
debug('Verify that contact is split in storage service');
|
|
|
|
{
|
|
|
|
const newState = await phone.waitForStorageState({
|
|
|
|
after: state,
|
|
|
|
});
|
|
|
|
|
|
|
|
const { added, removed } = newState.diff(state);
|
|
|
|
assert.strictEqual(added.length, 2, 'only two records must be added');
|
|
|
|
assert.strictEqual(removed.length, 1, 'only one record must be removed');
|
|
|
|
|
|
|
|
let pniContacts = 0;
|
|
|
|
let aciContacts = 0;
|
|
|
|
for (const { contact } of added) {
|
|
|
|
if (!contact) {
|
|
|
|
throw new Error('Invalid record');
|
|
|
|
}
|
|
|
|
|
2023-08-16 20:54:39 +00:00
|
|
|
const { aci, serviceE164, pni } = contact;
|
|
|
|
if (aci === pniContact.device.aci) {
|
2023-02-01 21:32:46 +00:00
|
|
|
aciContacts += 1;
|
|
|
|
assert.strictEqual(pni, '');
|
|
|
|
assert.strictEqual(serviceE164, '');
|
2023-09-27 23:14:55 +00:00
|
|
|
} else if (pni === toUntaggedPni(pniContact.device.pni)) {
|
2023-02-01 21:32:46 +00:00
|
|
|
pniContacts += 1;
|
2023-08-16 20:54:39 +00:00
|
|
|
assert.strictEqual(aci, '');
|
2023-02-01 21:32:46 +00:00
|
|
|
assert.strictEqual(serviceE164, pniContact.device.number);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
assert.strictEqual(aciContacts, 1);
|
|
|
|
assert.strictEqual(pniContacts, 1);
|
|
|
|
|
2023-09-27 23:14:55 +00:00
|
|
|
assert.strictEqual(
|
|
|
|
removed[0].contact?.pni,
|
|
|
|
toUntaggedPni(pniContact.device.pni)
|
|
|
|
);
|
2023-08-16 20:54:39 +00:00
|
|
|
assert.strictEqual(removed[0].contact?.aci, pniContact.device.aci);
|
2023-02-01 21:32:46 +00:00
|
|
|
|
|
|
|
// Pin PNI so that it appears in the left pane
|
2023-08-16 20:54:39 +00:00
|
|
|
const updated = newState.pin(pniContact, ServiceIdKind.PNI);
|
2023-02-01 21:32:46 +00:00
|
|
|
await phone.setStorageState(updated);
|
|
|
|
await phone.sendFetchStorage({
|
|
|
|
timestamp: bootstrap.getTimestamp(),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
debug('Verify that the message is in the ACI conversation');
|
|
|
|
{
|
|
|
|
// Should have both PNI and ACI messages
|
|
|
|
await window.locator('.module-message__text >> "Hello merged"').waitFor();
|
|
|
|
|
|
|
|
const messages = window.locator('.module-message__text');
|
|
|
|
assert.strictEqual(await messages.count(), 1, 'message count');
|
|
|
|
}
|
|
|
|
|
|
|
|
debug('Open PNI conversation');
|
|
|
|
await leftPane.locator(`[data-testid="${pniContact.device.pni}"]`).click();
|
|
|
|
|
2023-02-08 17:14:59 +00:00
|
|
|
debug('Wait for ACI conversation to go away');
|
|
|
|
await window
|
|
|
|
.locator(`.module-conversation-hero >> ${pniContact.profileName}`)
|
|
|
|
.waitFor({
|
|
|
|
state: 'hidden',
|
|
|
|
});
|
|
|
|
|
2023-02-01 21:32:46 +00:00
|
|
|
debug('Verify absence of messages in the PNI conversation');
|
|
|
|
{
|
|
|
|
const messages = window.locator('.module-message__text');
|
|
|
|
assert.strictEqual(await messages.count(), 0, 'message count');
|
|
|
|
}
|
|
|
|
});
|
2022-12-05 22:46:54 +00:00
|
|
|
});
|