test: prepare fixtures test to run with rpc (#3190)

This commit is contained in:
Dmitry Gozman 2020-07-27 18:40:21 -07:00 committed by GitHub
parent da25a5b501
commit a59220b06d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -35,7 +35,7 @@ class Wrapper {
logger: undefined,
};
const options = {
playwrightFile: path.join(playwrightPath, 'index'),
playwrightPath,
browserTypeName: browserType.name(),
launchOptions,
...extraOptions,

View File

@ -1,11 +1,17 @@
(async() => {
const { playwrightFile, browserTypeName, launchOptions, stallOnClose } = JSON.parse(process.argv[2]);
const { playwrightPath, browserTypeName, launchOptions, stallOnClose } = JSON.parse(process.argv[2]);
if (stallOnClose) {
launchOptions.__testHookGracefullyClose = () => {
console.log(`(stalled=>true)`);
return new Promise(() => {});
};
}
const path = require('path');
const { setUnderTest } = require(path.join(playwrightPath, 'lib', 'helper'));
setUnderTest();
const playwrightFile = path.join(playwrightPath, 'index');
const browserServer = await require(playwrightFile)[browserTypeName].launchServer(launchOptions);
browserServer.on('close', (exitCode, signal) => {
console.log(`(exitCode=>${exitCode})`);