test: ignore the ready event from PDF Viewer (#28039)

This commit is contained in:
Cheng Zhao 2021-03-09 01:15:39 +09:00 committed by GitHub
parent 0505beb43d
commit 3270613bf7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,7 +6,7 @@ import { AddressInfo } from 'net';
import * as path from 'path';
import * as fs from 'fs';
import * as WebSocket from 'ws';
import { emittedOnce, emittedNTimes } from './events-helpers';
import { emittedOnce, emittedNTimes, emittedUntil } from './events-helpers';
const uuid = require('uuid');
@ -150,7 +150,9 @@ describe('chrome extensions', () => {
const loadedPromise = emittedOnce(customSession, 'extension-loaded');
const extension = await customSession.loadExtension(path.join(fixtures, 'extensions', 'red-bg'));
const [, loadedExtension] = await loadedPromise;
const [, readyExtension] = await emittedOnce(customSession, 'extension-ready');
const [, readyExtension] = await emittedUntil(customSession, 'extension-ready', (event: Event, extension: Extension) => {
return extension.name !== 'Chromium PDF Viewer';
});
// Compare JSON string to print more information if failed.
const expected = JSON.stringify(extension);