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