Skip to content

Commit

Permalink
fix: fix template context variable
Browse files Browse the repository at this point in the history
  • Loading branch information
aldeed authored and jperl committed Sep 21, 2020
1 parent 08100f9 commit ac8c787
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/build-code/buildTemplate.ts
Expand Up @@ -44,9 +44,9 @@ export const buildImports = ({

if (useTypeScript) {
if (device) {
imports = 'import { Browser, Page, devices } from "playwright";';
imports = 'import { Browser, BrowserContext, devices } from "playwright";';
} else {
imports = 'import { Browser, Page } from "playwright";';
imports = 'import { Browser, BrowserContext } from "playwright";';
}

imports += '\nimport qawolf from "qawolf";';
Expand All @@ -67,9 +67,9 @@ export const buildImports = ({
};

export const buildNewContext = (device?: string): string => {
if (!device) return 'const context = await browser.newContext();';
if (!device) return 'context = await browser.newContext();';

const context = `const context = await browser.newContext({ ...device });`;
const context = `context = await browser.newContext({ ...device });`;

return context;
};
Expand All @@ -90,7 +90,7 @@ export const buildTemplate: TemplateFunction = ({
const code = `${buildImports({ device, useTypeScript })}
let browser${useTypeScript ? ': Browser' : ''};
let page${useTypeScript ? ': Page' : ''};
let context${useTypeScript ? ': BrowserContext' : ''};
beforeAll(async () => {
browser = await qawolf.launch();
Expand Down

0 comments on commit ac8c787

Please sign in to comment.