2019-11-18 18:18:28 -08:00
|
|
|
(async() => {
|
2020-07-27 18:40:21 -07:00
|
|
|
const { playwrightPath, browserTypeName, launchOptions, stallOnClose } = JSON.parse(process.argv[2]);
|
2020-05-20 14:58:27 -07:00
|
|
|
if (stallOnClose) {
|
|
|
|
launchOptions.__testHookGracefullyClose = () => {
|
|
|
|
console.log(`(stalled=>true)`);
|
|
|
|
return new Promise(() => {});
|
|
|
|
};
|
|
|
|
}
|
2020-07-27 18:40:21 -07:00
|
|
|
|
|
|
|
const path = require('path');
|
|
|
|
const { setUnderTest } = require(path.join(playwrightPath, 'lib', 'helper'));
|
2020-07-30 10:22:28 -07:00
|
|
|
const { setupInProcess } = require(path.join(playwrightPath, 'lib', 'rpc', 'inprocess'));
|
2020-07-27 18:40:21 -07:00
|
|
|
setUnderTest();
|
2020-07-30 10:22:28 -07:00
|
|
|
const playwrightImpl = require(path.join(playwrightPath, 'index'));
|
|
|
|
const playwright = process.env.PWCHANNEL ? setupInProcess(playwrightImpl) : playwrightImpl;
|
2020-07-27 18:40:21 -07:00
|
|
|
|
2020-07-30 10:22:28 -07:00
|
|
|
const browserServer = await playwright[browserTypeName].launchServer(launchOptions);
|
2020-02-05 12:41:55 -08:00
|
|
|
browserServer.on('close', (exitCode, signal) => {
|
2020-05-20 14:58:27 -07:00
|
|
|
console.log(`(exitCode=>${exitCode})`);
|
|
|
|
console.log(`(signal=>${signal})`);
|
2020-01-28 13:07:53 -08:00
|
|
|
});
|
2020-05-20 14:58:27 -07:00
|
|
|
console.log(`(pid=>${browserServer.process().pid})`);
|
|
|
|
console.log(`(wsEndpoint=>${browserServer.wsEndpoint()})`);
|
2019-11-18 18:18:28 -08:00
|
|
|
})();
|