Skip to content

Commit cceb419

Browse files
committed
updates puppeteer tests to match latest docs. also updates version of node for pipeline
1 parent 8580784 commit cceb419

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Set up Node.js
1515
uses: actions/setup-node@v3
1616
with:
17-
node-version: 18
17+
node-version: 20
1818
check-latest: true
1919
cache: npm
2020

test/config/puppeteer_environment.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// puppeteer_environment.js
2-
import fs from 'fs';
2+
import {readFile} from 'fs/promises';
33
import os from 'os';
44
import path from 'path';
55
import puppeteer from 'puppeteer';
@@ -17,7 +17,7 @@ export default class PuppeteerEnvironment extends NodeEnvironment {
1717
async setup() {
1818
await super.setup();
1919
// get the wsEndpoint
20-
const wsEndpoint = fs.readFileSync(path.join(DIR, 'wsEndpoint'), 'utf8');
20+
const wsEndpoint = await readFile(path.join(DIR, 'wsEndpoint'), 'utf8');
2121
if (!wsEndpoint) {
2222
throw new Error('wsEndpoint not found');
2323
}
@@ -30,9 +30,18 @@ export default class PuppeteerEnvironment extends NodeEnvironment {
3030
}
3131

3232
async teardown() {
33+
// eslint-disable-next-line no-underscore-dangle
34+
if (this.global.__BROWSER_GLOBAL__) {
35+
// eslint-disable-next-line no-underscore-dangle
36+
this.global.__BROWSER_GLOBAL__.disconnect();
37+
}
3338
await super.teardown();
3439
}
3540

41+
getVmContext() {
42+
return super.getVmContext();
43+
}
44+
3645
runScript(script) {
3746
return super.runScript(script);
3847
}

0 commit comments

Comments
 (0)