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
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue