Add mock test for release notes

This commit is contained in:
yash-signal 2025-01-17 10:36:41 -06:00 committed by GitHub
parent 218f2c8bf4
commit 7a6b5ffe09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 76 additions and 5 deletions

8
package-lock.json generated
View file

@ -126,7 +126,7 @@
"@indutny/rezip-electron": "2.0.1",
"@indutny/symbolicate-mac": "2.3.0",
"@napi-rs/canvas": "0.1.61",
"@signalapp/mock-server": "10.4.0",
"@signalapp/mock-server": "10.4.1",
"@storybook/addon-a11y": "8.4.4",
"@storybook/addon-actions": "8.4.4",
"@storybook/addon-controls": "8.4.4",
@ -6491,9 +6491,9 @@
}
},
"node_modules/@signalapp/mock-server": {
"version": "10.4.0",
"resolved": "https://registry.npmjs.org/@signalapp/mock-server/-/mock-server-10.4.0.tgz",
"integrity": "sha512-Y2Fj2rP8sI/Z8JBjXgJoHO+6VqfORopeFixka11CrxxDBXQWr4u3+P3hsS5wIwwtgcsaXIultRW+kYhbkttRLw==",
"version": "10.4.1",
"resolved": "https://registry.npmjs.org/@signalapp/mock-server/-/mock-server-10.4.1.tgz",
"integrity": "sha512-9aBmFbOx3KfbN4Ptcx5PBRnVnROe6A58rRoErB/w1x+SSW9TjRHZxviJfgNpt9nGUOreryzOBsONSzWBIE12nQ==",
"dev": true,
"license": "AGPL-3.0-only",
"dependencies": {

View file

@ -217,7 +217,7 @@
"@indutny/rezip-electron": "2.0.1",
"@indutny/symbolicate-mac": "2.3.0",
"@napi-rs/canvas": "0.1.61",
"@signalapp/mock-server": "10.4.0",
"@signalapp/mock-server": "10.4.1",
"@storybook/addon-a11y": "8.4.4",
"@storybook/addon-actions": "8.4.4",
"@storybook/addon-controls": "8.4.4",

View file

@ -41,6 +41,7 @@ export type CIType = {
uploadBackup(): Promise<void>;
unlink: () => void;
print: (...args: ReadonlyArray<unknown>) => void;
resetReleaseNotesFetcher(): void;
};
export type GetCIOptionsType = Readonly<{
@ -181,6 +182,17 @@ export function getCI({ deviceName }: GetCIOptionsType): CIType {
handleEvent('print', format(...args));
}
async function resetReleaseNotesFetcher() {
await Promise.all([
window.textsecure.storage.put(
'releaseNotesVersionWatermark',
'7.0.0-alpha.1'
),
window.textsecure.storage.put('releaseNotesPreviousManifestHash', ''),
window.textsecure.storage.put('releaseNotesNextFetchTime', Date.now()),
]);
}
return {
deviceName,
getConversationId,
@ -195,5 +207,6 @@ export function getCI({ deviceName }: GetCIOptionsType): CIType {
unlink,
getPendingEventCount,
print,
resetReleaseNotesFetcher,
};
}

View file

@ -725,6 +725,7 @@ export class Bootstrap {
storageProfile: 'mock',
serverUrl: url,
storageUrl: url,
resourcesUrl: `${url}/updates2`,
sfuUrl: url,
cdn: {
'0': url,

View file

@ -0,0 +1,57 @@
// Copyright 2025 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import createDebug from 'debug';
import { assert } from 'chai';
import type { App } from '../playwright';
import { Bootstrap } from '../bootstrap';
import { MINUTE } from '../../util/durations';
import { SIGNAL_ACI } from '../../types/SignalConversation';
export const debug = createDebug('mock:test:releaseNotes');
describe('release notes', function (this: Mocha.Suite) {
let bootstrap: Bootstrap;
let app: App;
let nextApp: App;
this.timeout(MINUTE);
beforeEach(async () => {
bootstrap = new Bootstrap();
await bootstrap.init();
app = await bootstrap.link();
});
afterEach(async function (this: Mocha.Context) {
if (!bootstrap) {
return;
}
if (nextApp) {
await bootstrap.maybeSaveLogs(this.currentTest, nextApp);
}
await nextApp?.close();
await bootstrap.teardown();
});
it('shows release notes', async () => {
const firstWindow = await app.getWindow();
await firstWindow.evaluate('window.SignalCI.resetReleaseNotesFetcher()');
await app.close();
nextApp = await bootstrap.startApp();
const secondWindow = await nextApp.getWindow();
const leftPane = secondWindow.locator('#LeftPane');
const releaseNoteConversation = leftPane.getByTestId(SIGNAL_ACI);
await releaseNoteConversation.waitFor();
assert.isTrue(await releaseNoteConversation.isVisible());
});
});