Restart browser once in a while during unit testing

The unit testing on mac is unreliable, making the last tests to hang.
This seems to be related to the upstream bug: crbug.com/741689

For now, this patch restarts the browser in the middle of unit testing.
This should be reverted once the upstream is fixed.

References #100.
This commit is contained in:
Andrey Lushnikov 2017-07-20 15:29:09 -07:00
parent 42edc3108a
commit f5215b2ed0

View File

@ -835,6 +835,14 @@ describe('Puppeteer', function() {
expect(keyboard.modifiers().Alt).toBe(false); expect(keyboard.modifiers().Alt).toBe(false);
})); }));
}); });
// FIXME: remove this when crbug.com/741689 is fixed.
it('RESTART BROWSER crbug.com/741689', SX(async function() {
page.close();
browser = new Browser({headless, args: ['--no-sandbox']});
page = await browser.newPage();
}));
describe('Page.setUserAgent', function() { describe('Page.setUserAgent', function() {
it('should work', SX(async function() { it('should work', SX(async function() {
expect(page.userAgent()).toContain('Mozilla'); expect(page.userAgent()).toContain('Mozilla');