1e34f80c91
### What? Adds the name of the test that's running when the browser is started to the recording. Also makes `RECORD_REPLAY=1` work without `run-tests.js` Closes PACK-2206
23 lines
686 B
TypeScript
23 lines
686 B
TypeScript
import { getExecutablePath } from '@replayio/playwright'
|
|
import { Playwright } from './playwright'
|
|
export { quit } from './playwright'
|
|
|
|
export class Replay extends Playwright {
|
|
async launchBrowser(browserName: string, launchOptions: Record<string, any>) {
|
|
const browser: any = browserName === 'chrome' ? 'chromium' : browserName
|
|
const executablePath = getExecutablePath(browser)
|
|
|
|
if (!executablePath) {
|
|
throw new Error(`No replay.io executable for browser \`${browserName}\``)
|
|
}
|
|
|
|
return super.launchBrowser(browserName, {
|
|
...launchOptions,
|
|
executablePath,
|
|
env: {
|
|
...process.env,
|
|
RECORD_ALL_CONTENT: 1,
|
|
},
|
|
})
|
|
}
|
|
}
|