mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-08-28 00:46:33 +01:00
Improve mock test storage service version waits
This commit is contained in:
@@ -132,7 +132,7 @@ describe('messaging/relink', function (this: Mocha.Suite) {
|
||||
state = state.unpin(second);
|
||||
state = state.pin(first);
|
||||
|
||||
await phone.setStorageState(state);
|
||||
state = await phone.setStorageState(state);
|
||||
await phone.sendFetchStorage({
|
||||
timestamp: bootstrap.getTimestamp(),
|
||||
});
|
||||
|
||||
@@ -183,7 +183,7 @@ describe('pnp/merge', function (this: Mocha.Suite) {
|
||||
);
|
||||
{
|
||||
const state = await phone.expectStorageState('consistency check');
|
||||
await phone.setStorageState(
|
||||
const newState = await phone.setStorageState(
|
||||
state.mergeContact(pniContact, {
|
||||
identityState: Proto.ContactRecord.IdentityState.DEFAULT,
|
||||
whitelisted: true,
|
||||
@@ -195,7 +195,7 @@ describe('pnp/merge', function (this: Mocha.Suite) {
|
||||
await phone.sendFetchStorage({
|
||||
timestamp: bootstrap.getTimestamp(),
|
||||
});
|
||||
await app.waitForManifestVersion(state.version);
|
||||
await app.waitForManifestVersion(newState.version);
|
||||
}
|
||||
|
||||
debug('Verify final state');
|
||||
@@ -359,7 +359,7 @@ describe('pnp/merge', function (this: Mocha.Suite) {
|
||||
identityKey: pniContact.publicKey.serialize(),
|
||||
profileKey: pniContact.profileKey.serialize(),
|
||||
});
|
||||
await phone.setStorageState(state);
|
||||
state = await phone.setStorageState(state);
|
||||
await phone.sendFetchStorage({
|
||||
timestamp: bootstrap.getTimestamp(),
|
||||
});
|
||||
@@ -496,7 +496,7 @@ describe('pnp/merge', function (this: Mocha.Suite) {
|
||||
);
|
||||
state = state.pin(aciContact, ServiceIdKind.ACI);
|
||||
|
||||
await phone.setStorageState(state);
|
||||
state = await phone.setStorageState(state);
|
||||
await phone.sendFetchStorage({
|
||||
timestamp: bootstrap.getTimestamp(),
|
||||
});
|
||||
@@ -614,7 +614,7 @@ describe('pnp/merge', function (this: Mocha.Suite) {
|
||||
);
|
||||
{
|
||||
const state = await phone.expectStorageState('consistency check');
|
||||
await phone.setStorageState(
|
||||
const newState = await phone.setStorageState(
|
||||
state.mergeContact(pniContact, {
|
||||
identityState: Proto.ContactRecord.IdentityState.DEFAULT,
|
||||
whitelisted: true,
|
||||
@@ -626,7 +626,7 @@ describe('pnp/merge', function (this: Mocha.Suite) {
|
||||
await phone.sendFetchStorage({
|
||||
timestamp: bootstrap.getTimestamp(),
|
||||
});
|
||||
await app.waitForManifestVersion(state.version);
|
||||
await app.waitForManifestVersion(newState.version);
|
||||
}
|
||||
|
||||
const window = await app.getWindow();
|
||||
|
||||
@@ -40,11 +40,11 @@ describe('storage service', function (this: Mocha.Suite) {
|
||||
debug('archiving contact');
|
||||
{
|
||||
const state = await phone.expectStorageState('consistency check');
|
||||
const newState = state
|
||||
const modifiedState = state
|
||||
.updateContact(firstContact, { archived: true })
|
||||
.unpin(firstContact);
|
||||
|
||||
await phone.setStorageState(newState);
|
||||
const newState = await phone.setStorageState(modifiedState);
|
||||
await phone.sendFetchStorage({
|
||||
timestamp: bootstrap.getTimestamp(),
|
||||
});
|
||||
@@ -63,13 +63,13 @@ describe('storage service', function (this: Mocha.Suite) {
|
||||
debug('unarchiving pinned contact');
|
||||
{
|
||||
const state = await phone.expectStorageState('consistency check');
|
||||
const newState = state
|
||||
const modifiedState = state
|
||||
.updateContact(firstContact, {
|
||||
archived: false,
|
||||
})
|
||||
.pin(firstContact);
|
||||
|
||||
await phone.setStorageState(newState);
|
||||
const newState = await phone.setStorageState(modifiedState);
|
||||
await phone.sendFetchStorage({
|
||||
timestamp: bootstrap.getTimestamp(),
|
||||
});
|
||||
@@ -100,6 +100,7 @@ describe('storage service', function (this: Mocha.Suite) {
|
||||
|
||||
const archiveButton = window.getByRole('menuitem', {
|
||||
name: 'Archive',
|
||||
exact: true,
|
||||
});
|
||||
await archiveButton.click();
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ describe('storage service/chat folders', function (this: Mocha.Suite) {
|
||||
},
|
||||
});
|
||||
|
||||
await phone.setStorageState(state);
|
||||
state = await phone.setStorageState(state);
|
||||
await phone.sendFetchStorage({ timestamp: bootstrap.getTimestamp() });
|
||||
await app.waitForManifestVersion(state.version);
|
||||
|
||||
@@ -184,7 +184,7 @@ describe('storage service/chat folders', function (this: Mocha.Suite) {
|
||||
}
|
||||
);
|
||||
|
||||
await phone.setStorageState(state);
|
||||
state = await phone.setStorageState(state);
|
||||
await phone.sendFetchStorage({ timestamp: bootstrap.getTimestamp() });
|
||||
await app.waitForManifestVersion(state.version);
|
||||
|
||||
@@ -211,7 +211,7 @@ describe('storage service/chat folders', function (this: Mocha.Suite) {
|
||||
}
|
||||
);
|
||||
|
||||
await phone.setStorageState(state);
|
||||
state = await phone.setStorageState(state);
|
||||
await phone.sendFetchStorage({ timestamp: bootstrap.getTimestamp() });
|
||||
await app.waitForManifestVersion(state.version);
|
||||
|
||||
|
||||
@@ -65,7 +65,9 @@ describe('storage service', function (this: Mocha.Suite) {
|
||||
.getByRole('button', { name: 'More Info' })
|
||||
.click();
|
||||
|
||||
await window.getByRole('menuitem', { name: 'Archive' }).click();
|
||||
await window
|
||||
.getByRole('menuitem', { name: 'Archive', exact: true })
|
||||
.click();
|
||||
|
||||
await phone.waitForStorageState({
|
||||
after: state,
|
||||
@@ -150,7 +152,9 @@ describe('storage service', function (this: Mocha.Suite) {
|
||||
.getByRole('button', { name: 'More Info' })
|
||||
.click();
|
||||
|
||||
await window.getByRole('menuitem', { name: 'Pin chat' }).click();
|
||||
await window
|
||||
.getByRole('menuitem', { name: 'Pin chat', exact: true })
|
||||
.click();
|
||||
|
||||
const newState = await phone.waitForStorageState({
|
||||
after: state,
|
||||
|
||||
@@ -264,6 +264,7 @@ describe('storage service/notification profiles', function (this: Mocha.Suite) {
|
||||
deletedAtTimestampMs: null,
|
||||
};
|
||||
|
||||
let uploadedState: StorageState;
|
||||
{
|
||||
let newState = firstState.addRecord({
|
||||
type: IdentifierType.NOTIFICATION_PROFILE,
|
||||
@@ -303,14 +304,14 @@ describe('storage service/notification profiles', function (this: Mocha.Suite) {
|
||||
},
|
||||
});
|
||||
|
||||
await phone.setStorageState(newState);
|
||||
uploadedState = await phone.setStorageState(newState);
|
||||
}
|
||||
|
||||
debug('Waiting for desktop to process storage service updates');
|
||||
await phone.sendFetchStorage({
|
||||
timestamp: bootstrap.getTimestamp(),
|
||||
});
|
||||
await app.waitForManifestVersion(firstState.version + 1n);
|
||||
await app.waitForManifestVersion(uploadedState.version);
|
||||
|
||||
debug('Now we should be on the Notification Profiles list page');
|
||||
await expect(
|
||||
@@ -484,7 +485,7 @@ describe('storage service/notification profiles', function (this: Mocha.Suite) {
|
||||
notificationProfileSyncDisabled: false,
|
||||
});
|
||||
|
||||
await phone.setStorageState(newState);
|
||||
uploadedState = await phone.setStorageState(newState);
|
||||
}
|
||||
|
||||
// now desktop will see the off->on flip for sync, and reconcile profiles:
|
||||
@@ -496,7 +497,7 @@ describe('storage service/notification profiles', function (this: Mocha.Suite) {
|
||||
await phone.sendFetchStorage({
|
||||
timestamp: bootstrap.getTimestamp(),
|
||||
});
|
||||
await app.waitForManifestVersion(secondState.version + 1n);
|
||||
await app.waitForManifestVersion(uploadedState.version);
|
||||
|
||||
debug('Check what is on the list page now');
|
||||
await expect(
|
||||
|
||||
@@ -47,9 +47,9 @@ describe('storage service', function (this: Mocha.Suite) {
|
||||
debug('Unpinning group via storage service');
|
||||
{
|
||||
const state = await phone.expectStorageState('initial state');
|
||||
const newState = state.unpinGroup(group);
|
||||
const modifiedState = state.unpinGroup(group);
|
||||
|
||||
await phone.setStorageState(newState);
|
||||
const newState = await phone.setStorageState(modifiedState);
|
||||
await phone.sendFetchStorage({
|
||||
timestamp: bootstrap.getTimestamp(),
|
||||
});
|
||||
@@ -71,6 +71,7 @@ describe('storage service', function (this: Mocha.Suite) {
|
||||
|
||||
const pinButton = window.getByRole('menuitem', {
|
||||
name: 'Pin chat',
|
||||
exact: true,
|
||||
});
|
||||
await pinButton.click();
|
||||
|
||||
@@ -123,6 +124,7 @@ describe('storage service', function (this: Mocha.Suite) {
|
||||
|
||||
const pinButton = window.getByRole('menuitem', {
|
||||
name: 'Pin chat',
|
||||
exact: true,
|
||||
});
|
||||
// oxlint-disable-next-line no-await-in-loop
|
||||
await pinButton.click();
|
||||
|
||||
@@ -392,7 +392,7 @@ describe('stickers', function (this: Mocha.Suite) {
|
||||
{
|
||||
debug('expiring sticker pack via storage service');
|
||||
const state = await phone.expectStorageState('initial state');
|
||||
const newState = state.updateRecord(
|
||||
const modifiedState = state.updateRecord(
|
||||
getStickerPackRecordPredicate(STICKER_PACKS[0]),
|
||||
record => ({
|
||||
stickerPack: {
|
||||
@@ -402,7 +402,7 @@ describe('stickers', function (this: Mocha.Suite) {
|
||||
})
|
||||
);
|
||||
|
||||
await phone.setStorageState(newState);
|
||||
const newState = await phone.setStorageState(modifiedState);
|
||||
await phone.sendFetchStorage({
|
||||
timestamp: bootstrap.getTimestamp(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user