Skip to content

Commit

Permalink
chore(test): fix tests when using browser path overwrites (#3453)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt authored Aug 15, 2020
1 parent 35fbd58 commit 5410c30
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions test/base.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,19 @@ registerWorkerFixture('httpService', async ({parallelIndex}, test) => {
]);
});

registerWorkerFixture('defaultBrowserOptions', async({}, test) => {
let executablePath = undefined;
const getExecutablePath = () => {
if (browserName === 'chromium' && process.env.CRPATH)
executablePath = process.env.CRPATH;
return process.env.CRPATH;
if (browserName === 'firefox' && process.env.FFPATH)
executablePath = process.env.FFPATH;
return process.env.FFPATH;
if (browserName === 'webkit' && process.env.WKPATH)
executablePath = process.env.WKPATH;
return process.env.WKPATH;
return
}

registerWorkerFixture('defaultBrowserOptions', async({}, test) => {
let executablePath = getExecutablePath();

if (executablePath)
console.error(`Using executable at ${executablePath}`);
await test({
Expand Down Expand Up @@ -147,7 +152,11 @@ registerFixture('toImpl', async ({playwright}, test) => {
});

registerWorkerFixture('browserType', async ({playwright}, test) => {
await test(playwright[process.env.BROWSER || 'chromium']);
const browserType = playwright[process.env.BROWSER || 'chromium']
const executablePath = getExecutablePath()
if (executablePath)
browserType._executablePath = executablePath
await test(browserType);
});

registerWorkerFixture('browser', async ({browserType, defaultBrowserOptions}, test) => {
Expand Down

0 comments on commit 5410c30

Please sign in to comment.