Add more timeouts, retries in mock tests
This commit is contained in:
parent
c25867c737
commit
a1207aa136
22 changed files with 31 additions and 3 deletions
|
@ -56,6 +56,7 @@ function createEditedMessage(
|
|||
|
||||
describe('editing', function needsName() {
|
||||
this.timeout(durations.MINUTE);
|
||||
this.retries(4);
|
||||
|
||||
let bootstrap: Bootstrap;
|
||||
let app: App;
|
||||
|
|
|
@ -13,6 +13,7 @@ export const debug = createDebug('mock:test:readSync');
|
|||
|
||||
describe('readSync', function needsName() {
|
||||
this.timeout(durations.MINUTE);
|
||||
this.retries(4);
|
||||
|
||||
let bootstrap: Bootstrap;
|
||||
let app: App;
|
||||
|
|
|
@ -13,6 +13,7 @@ export const debug = createDebug('mock:test:senderKey');
|
|||
|
||||
describe('senderKey', function needsName() {
|
||||
this.timeout(durations.MINUTE);
|
||||
this.retries(4);
|
||||
|
||||
let bootstrap: Bootstrap;
|
||||
let app: App;
|
||||
|
|
|
@ -22,6 +22,7 @@ const DISTRIBUTION2 = generateStoryDistributionId();
|
|||
|
||||
describe('story/messaging', function unknownContacts() {
|
||||
this.timeout(durations.MINUTE);
|
||||
this.retries(4);
|
||||
|
||||
let bootstrap: Bootstrap;
|
||||
let app: App;
|
||||
|
|
|
@ -14,6 +14,7 @@ export const debug = createDebug('mock:test:edit');
|
|||
|
||||
describe('unknown contacts', function unknownContacts() {
|
||||
this.timeout(durations.MINUTE);
|
||||
this.retries(4);
|
||||
|
||||
let bootstrap: Bootstrap;
|
||||
let app: App;
|
||||
|
|
|
@ -10,6 +10,7 @@ import type {
|
|||
IPCResponse as ChallengeResponseType,
|
||||
} from '../challenge';
|
||||
import type { ReceiptType } from '../types/Receipt';
|
||||
import { SECOND } from '../util/durations';
|
||||
|
||||
export type AppLoadedInfoType = Readonly<{
|
||||
loadTime: number;
|
||||
|
@ -40,6 +41,8 @@ export type AppOptionsType = Readonly<{
|
|||
config: string;
|
||||
}>;
|
||||
|
||||
const WAIT_FOR_EVENT_TIMEOUT = 30 * SECOND;
|
||||
|
||||
export class App extends EventEmitter {
|
||||
private privApp: ElectronApplication | undefined;
|
||||
|
||||
|
@ -152,11 +155,15 @@ export class App extends EventEmitter {
|
|||
// Private
|
||||
//
|
||||
|
||||
private async waitForEvent<T>(event: string): Promise<T> {
|
||||
private async waitForEvent<T>(
|
||||
event: string,
|
||||
timeout = WAIT_FOR_EVENT_TIMEOUT
|
||||
): Promise<T> {
|
||||
const window = await this.getWindow();
|
||||
|
||||
const result = await window.evaluate(
|
||||
`window.SignalCI.waitForEvent(${JSON.stringify(event)})`
|
||||
`window.SignalCI.waitForEvent(${JSON.stringify(event)})`,
|
||||
{ timeout }
|
||||
);
|
||||
|
||||
return result as T;
|
||||
|
|
|
@ -14,6 +14,7 @@ export const debug = createDebug('mock:test:gv2');
|
|||
|
||||
describe('pnp/accept gv2 invite', function needsName() {
|
||||
this.timeout(durations.MINUTE);
|
||||
this.retries(4);
|
||||
|
||||
let bootstrap: Bootstrap;
|
||||
let app: App;
|
||||
|
|
|
@ -12,6 +12,7 @@ export const debug = createDebug('mock:test:change-number');
|
|||
|
||||
describe('pnp/change number', function needsName() {
|
||||
this.timeout(durations.MINUTE);
|
||||
this.retries(4);
|
||||
|
||||
let bootstrap: Bootstrap;
|
||||
let app: App;
|
||||
|
|
|
@ -19,6 +19,7 @@ const IdentifierType = Proto.ManifestRecord.Identifier.Type;
|
|||
|
||||
describe('pnp/merge', function needsName() {
|
||||
this.timeout(durations.MINUTE);
|
||||
this.retries(4);
|
||||
|
||||
let bootstrap: Bootstrap;
|
||||
let app: App;
|
||||
|
|
|
@ -15,6 +15,7 @@ export const debug = createDebug('mock:test:pni-change');
|
|||
|
||||
describe('pnp/PNI Change', function needsName() {
|
||||
this.timeout(durations.MINUTE);
|
||||
this.retries(4);
|
||||
|
||||
let bootstrap: Bootstrap;
|
||||
let app: App;
|
||||
|
|
|
@ -24,6 +24,7 @@ const IdentifierType = Proto.ManifestRecord.Identifier.Type;
|
|||
|
||||
describe('pnp/PNI Signature', function needsName() {
|
||||
this.timeout(durations.MINUTE);
|
||||
this.retries(4);
|
||||
|
||||
let bootstrap: Bootstrap;
|
||||
let app: App;
|
||||
|
|
|
@ -20,6 +20,7 @@ export const debug = createDebug('mock:test:pni-unlink');
|
|||
|
||||
describe('pnp/PNI DecryptionError unlink', function needsName() {
|
||||
this.timeout(durations.MINUTE);
|
||||
this.retries(4);
|
||||
|
||||
let bootstrap: Bootstrap;
|
||||
let app: App | undefined;
|
||||
|
|
|
@ -18,6 +18,7 @@ export const debug = createDebug('mock:test:gv2');
|
|||
|
||||
describe('pnp/send gv2 invite', function needsName() {
|
||||
this.timeout(durations.MINUTE);
|
||||
this.retries(4);
|
||||
|
||||
let bootstrap: Bootstrap;
|
||||
let app: App;
|
||||
|
|
|
@ -25,6 +25,7 @@ const CARL_USERNAME = 'carl.84';
|
|||
|
||||
describe('pnp/username', function needsName() {
|
||||
this.timeout(durations.MINUTE);
|
||||
this.retries(4);
|
||||
|
||||
let bootstrap: Bootstrap;
|
||||
let app: App;
|
||||
|
|
|
@ -17,6 +17,7 @@ const IdentifierType = Proto.ManifestRecord.Identifier.Type;
|
|||
|
||||
describe('story/no-sender-key', function needsName() {
|
||||
this.timeout(durations.MINUTE);
|
||||
this.retries(4);
|
||||
|
||||
let bootstrap: Bootstrap;
|
||||
let app: App;
|
||||
|
|
|
@ -13,7 +13,8 @@ import { ReceiptType } from '../../types/Receipt';
|
|||
export const debug = createDebug('mock:test:challenge:receipts');
|
||||
|
||||
describe('challenge/receipts', function challengeReceiptsTest() {
|
||||
this.timeout(durations.MINUTE * 100);
|
||||
this.timeout(durations.MINUTE);
|
||||
this.retries(4);
|
||||
|
||||
let bootstrap: Bootstrap;
|
||||
let app: App;
|
||||
|
|
|
@ -9,6 +9,7 @@ import { initStorage, debug } from './fixtures';
|
|||
|
||||
describe('storage service', function needsName() {
|
||||
this.timeout(durations.MINUTE);
|
||||
this.retries(4);
|
||||
|
||||
let bootstrap: Bootstrap;
|
||||
let app: App;
|
||||
|
|
|
@ -12,6 +12,7 @@ const IdentifierType = Proto.ManifestRecord.Identifier.Type;
|
|||
|
||||
describe('storage service', function needsName() {
|
||||
this.timeout(durations.MINUTE);
|
||||
this.retries(4);
|
||||
|
||||
let bootstrap: Bootstrap;
|
||||
let app: App;
|
||||
|
|
|
@ -14,6 +14,7 @@ const IdentifierType = Proto.ManifestRecord.Identifier.Type;
|
|||
|
||||
describe('storage service', function needsName() {
|
||||
this.timeout(durations.MINUTE);
|
||||
this.retries(4);
|
||||
|
||||
let bootstrap: Bootstrap;
|
||||
let app: App;
|
||||
|
|
|
@ -9,6 +9,7 @@ import { initStorage, debug } from './fixtures';
|
|||
|
||||
describe('storage service', function needsName() {
|
||||
this.timeout(durations.MINUTE);
|
||||
this.retries(4);
|
||||
|
||||
let bootstrap: Bootstrap;
|
||||
let app: App;
|
||||
|
|
|
@ -12,6 +12,7 @@ import { initStorage, debug } from './fixtures';
|
|||
|
||||
describe('storage service', function needsName() {
|
||||
this.timeout(durations.MINUTE);
|
||||
this.retries(4);
|
||||
|
||||
let bootstrap: Bootstrap;
|
||||
let app: App;
|
||||
|
|
|
@ -64,6 +64,7 @@ function getStickerPackRecordPredicate(
|
|||
|
||||
describe('storage service', function needsName() {
|
||||
this.timeout(durations.MINUTE);
|
||||
this.retries(4);
|
||||
|
||||
let bootstrap: Bootstrap;
|
||||
let app: App;
|
||||
|
|
Loading…
Add table
Reference in a new issue