From 0061b246b8918352b68cbddad5879ebcace8f480 Mon Sep 17 00:00:00 2001 From: Evan Sims Date: Thu, 14 Sep 2023 22:34:02 -0500 Subject: [PATCH] Update Puppeteer launch arguments to new format --- .github/workflows/test.yml | 2 -- end-to-end/access-an-api.js | 8 +++++--- end-to-end/attempt-silent-login.test.js | 16 ++++++++++------ end-to-end/basic.test.js | 8 +++++--- end-to-end/private-key-jwt.test.js | 8 +++++--- end-to-end/userinfo.test.js | 8 +++++--- 6 files changed, 30 insertions(+), 20 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6b7d90da..69fed73c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -98,8 +98,6 @@ jobs: node-version: ${{ env.NODE_VERSION }} cache: npm - - run: node node_modules/puppeteer/install.js - - uses: actions/cache/restore@v3 with: path: . diff --git a/end-to-end/access-an-api.js b/end-to-end/access-an-api.js index 0f87e901..d306680a 100644 --- a/end-to-end/access-an-api.js +++ b/end-to-end/access-an-api.js @@ -32,9 +32,11 @@ describe('access an api', async () => { }); it('should get an access token and access an api', async () => { - const browser = await puppeteer.launch({ - args: ['no-sandbox', 'disable-setuid-sandbox'], - }); + const args = puppeteer.defaultArgs(); + args.set('--no-sandbox'); + args.set('--disable-setuid-sandbox'); + + const browser = await puppeteer.launch(args); const page = await browser.newPage(); const clock = sinon.useFakeTimers({ diff --git a/end-to-end/attempt-silent-login.test.js b/end-to-end/attempt-silent-login.test.js index c006e560..8a687a4c 100644 --- a/end-to-end/attempt-silent-login.test.js +++ b/end-to-end/attempt-silent-login.test.js @@ -26,9 +26,11 @@ describe('attempt silent login', async () => { }); it('should attempt silent login and swallow failures', async () => { - const browser = await puppeteer.launch({ - args: ['no-sandbox', 'disable-setuid-sandbox'], - }); + const args = puppeteer.defaultArgs(); + args.set('--no-sandbox'); + args.set('--disable-setuid-sandbox'); + + const browser = await puppeteer.launch(args); const page = await browser.newPage(); await goto(baseUrl, page); await page.waitForNavigation(); @@ -43,9 +45,11 @@ describe('attempt silent login', async () => { }); it('should login silently if there is an active session on the IDP', async () => { - const browser = await puppeteer.launch({ - args: ['no-sandbox', 'disable-setuid-sandbox'], - }); + const args = puppeteer.defaultArgs(); + args.set('--no-sandbox'); + args.set('--disable-setuid-sandbox'); + + const browser = await puppeteer.launch(args); const page = await browser.newPage(); await goto(`${baseUrl}/login`, page); assert.match( diff --git a/end-to-end/basic.test.js b/end-to-end/basic.test.js index 38b36df5..f139765c 100644 --- a/end-to-end/basic.test.js +++ b/end-to-end/basic.test.js @@ -28,9 +28,11 @@ describe('basic login and logout', async () => { }); it('should login and logout with default configuration', async () => { - const browser = await puppeteer.launch({ - args: ['no-sandbox', 'disable-setuid-sandbox'], - }); + const args = puppeteer.defaultArgs(); + args.set('--no-sandbox'); + args.set('--disable-setuid-sandbox'); + + const browser = await puppeteer.launch(args); const page = await browser.newPage(); await goto(baseUrl, page); assert.match( diff --git a/end-to-end/private-key-jwt.test.js b/end-to-end/private-key-jwt.test.js index 5212142e..3d30533a 100644 --- a/end-to-end/private-key-jwt.test.js +++ b/end-to-end/private-key-jwt.test.js @@ -27,9 +27,11 @@ describe('private key jwt', async () => { }); it('should login with private key jwt client auth method', async () => { - const browser = await puppeteer.launch({ - args: ['no-sandbox', 'disable-setuid-sandbox'], - }); + const args = puppeteer.defaultArgs(); + args.set('--no-sandbox'); + args.set('--disable-setuid-sandbox'); + + const browser = await puppeteer.launch(args); const page = await browser.newPage(); await goto(baseUrl, page); assert.match(page.url(), /http:\/\/localhost:3000/); diff --git a/end-to-end/userinfo.test.js b/end-to-end/userinfo.test.js index 7e969afc..3919b579 100644 --- a/end-to-end/userinfo.test.js +++ b/end-to-end/userinfo.test.js @@ -26,9 +26,11 @@ describe('fetch userinfo', async () => { }); it('should login with hybrid flow and fetch userinfo', async () => { - const browser = await puppeteer.launch({ - args: ['no-sandbox', 'disable-setuid-sandbox'], - }); + const args = puppeteer.defaultArgs(); + args.set('--no-sandbox'); + args.set('--disable-setuid-sandbox'); + + const browser = await puppeteer.launch(args); const page = await browser.newPage(); await goto(baseUrl, page); assert.match(