Skip to content

Commit

Permalink
Merge pull request #457 from angrykoala/dev
Browse files Browse the repository at this point in the history
2.12.1
  • Loading branch information
angrykoala authored Jun 7, 2020
2 parents cb774f4 + c02b4b4 commit 51766fd
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 25 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2.12.1 / 2020-07-06
===================

* Dependencies updated
* Minor wrapper to puppeteer launch

2.12.0 / 2020-04-26
===================

Expand Down
22 changes: 22 additions & 0 deletions lib/puppeteer_wrapper/puppeteer_launcher.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import puppeteer from 'puppeteer';
import { FinalBrowserSettings } from '../types';
import PuppeteerContext from './puppeteer_context';
import { BrowserContext } from './puppeteer_types';
export class PuppeteerLauncher {

public async launch(settings: FinalBrowserSettings): Promise<PuppeteerContext> {
let instance;
try {
instance = await puppeteer.launch(settings);
} catch (err) {
// retry to avoid one-off _dl_allocate_tls_init error
instance = await puppeteer.launch(settings);
}
let context: BrowserContext;
if (settings.incognito) {
context = await instance.createIncognitoBrowserContext();
} else context = instance.defaultBrowserContext();

return new PuppeteerContext(context);
}
}
20 changes: 4 additions & 16 deletions lib/wendigo.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import process from 'process';
import puppeteer from 'puppeteer';
import { BrowserContext } from './puppeteer_wrapper/puppeteer_types';
import BrowserFactory from './browser_factory';
import * as Errors from './models/errors';
import { WendigoPluginInterface, BrowserSettings, DefaultBrowserSettings, FinalBrowserSettings, WendigoPluginAssertionInterface, PluginModule } from './types';
import BrowserInterface from './browser/browser_interface';
import PuppeteerContext from './puppeteer_wrapper/puppeteer_context';
import { PuppeteerLauncher } from './puppeteer_wrapper/puppeteer_launcher';

const defaultSettings: DefaultBrowserSettings = {
log: false,
Expand Down Expand Up @@ -97,20 +96,9 @@ export default class Wendigo {
}
}

private async _createInstance(settings: FinalBrowserSettings): Promise<PuppeteerContext> {
let instance;
try {
instance = await puppeteer.launch(settings);
} catch (err) {
// retry to avoid one-off _dl_allocate_tls_init error
instance = await puppeteer.launch(settings);
}
let context: BrowserContext;
if (settings.incognito) {
context = await instance.createIncognitoBrowserContext();
} else context = instance.defaultBrowserContext();

return new PuppeteerContext(context);
private _createInstance(settings: FinalBrowserSettings): Promise<PuppeteerContext> {
const launcher = new PuppeteerLauncher()
return launcher.launch(settings);
}

private _removeBrowser(browser: BrowserInterface): void {
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wendigo",
"version": "2.12.0",
"version": "2.12.1",
"description": "A proper monster for front-end automated testing",
"engines": {
"node": ">=8.0.0"
Expand Down Expand Up @@ -43,19 +43,19 @@
"dependencies": {
"compositer": "^1.3.6",
"is-class": "0.0.9",
"puppeteer": "~3.0.1"
"puppeteer": "~3.3.0"
},
"devDependencies": {
"@types/mocha": "^7.0.2",
"@types/node": "^13.13.2",
"@types/puppeteer": "~2.0.1",
"@types/node": "^14.0.11",
"@types/puppeteer": "~3.0.0",
"basic-auth": "^2.0.1",
"eslint": "^6.8.0",
"eslint": "^7.2.0",
"express": "^4.17.1",
"markdownlint-cli": "^0.22.0",
"mocha": "^7.1.1",
"markdownlint-cli": "^0.23.1",
"mocha": "^7.2.0",
"sinon": "^9.0.2",
"tslint": "^6.1.1",
"typescript": "^3.8.3"
"tslint": "^6.1.2",
"typescript": "^3.9.5"
}
}

0 comments on commit 51766fd

Please sign in to comment.