diff --git a/e2e/login-authorization-code-flow-with-queryfn.test.ts b/e2e/login-authorization-code-flow-with-queryfn.test.ts index 1c13fad..df2ce6e 100644 --- a/e2e/login-authorization-code-flow-with-queryfn.test.ts +++ b/e2e/login-authorization-code-flow-with-queryfn.test.ts @@ -1,5 +1,5 @@ import puppeteer, { Browser } from 'puppeteer'; -import { getTextContent } from './test-utils'; +import { getTextContent, IS_RUNNING_IN_GITHUB_ACTIONS } from './test-utils'; const URL = 'http://localhost:3000'; @@ -11,7 +11,9 @@ afterAll((done) => { }); test('Login with authorization code flow and exchangeCodeForQueryFn works as expected', async () => { - browser = await puppeteer.launch({ args: ['--no-sandbox', '--disable-setuid-sandbox'] }); + browser = await puppeteer.launch( + IS_RUNNING_IN_GITHUB_ACTIONS ? { args: ['--no-sandbox', '--disable-setuid-sandbox'] } : {} + ); const page = await browser.newPage(); await page.goto(URL); diff --git a/e2e/login-authorization-code-flow.test.ts b/e2e/login-authorization-code-flow.test.ts index 528f973..2610362 100644 --- a/e2e/login-authorization-code-flow.test.ts +++ b/e2e/login-authorization-code-flow.test.ts @@ -1,5 +1,5 @@ import puppeteer, { Browser } from 'puppeteer'; -import { getTextContent } from './test-utils'; +import { getTextContent, IS_RUNNING_IN_GITHUB_ACTIONS } from './test-utils'; const URL = 'http://localhost:3000'; @@ -11,7 +11,9 @@ afterAll((done) => { }); test('Login with authorization code flow works as expected', async () => { - browser = await puppeteer.launch({ args: ['--no-sandbox', '--disable-setuid-sandbox'] }); + browser = await puppeteer.launch( + IS_RUNNING_IN_GITHUB_ACTIONS ? { args: ['--no-sandbox', '--disable-setuid-sandbox'] } : {} + ); const page = await browser.newPage(); await page.goto(URL); diff --git a/e2e/login-implicit-grant-flow.test.ts b/e2e/login-implicit-grant-flow.test.ts index d2ad588..b71c530 100644 --- a/e2e/login-implicit-grant-flow.test.ts +++ b/e2e/login-implicit-grant-flow.test.ts @@ -1,5 +1,5 @@ import puppeteer, { Browser } from 'puppeteer'; -import { getTextContent } from './test-utils'; +import { getTextContent, IS_RUNNING_IN_GITHUB_ACTIONS } from './test-utils'; const URL = 'http://localhost:3000'; @@ -11,9 +11,9 @@ afterAll((done) => { }); test('Login with implicit grant flow works as expected', async () => { - browser = await puppeteer.launch({ - args: ['--no-sandbox', '--disable-setuid-sandbox'], - }); + browser = await puppeteer.launch( + IS_RUNNING_IN_GITHUB_ACTIONS ? { args: ['--no-sandbox', '--disable-setuid-sandbox'] } : {} + ); const page = await browser.newPage(); await page.goto(URL); diff --git a/e2e/test-utils.ts b/e2e/test-utils.ts index 87e9190..b556d8c 100644 --- a/e2e/test-utils.ts +++ b/e2e/test-utils.ts @@ -2,3 +2,5 @@ import { Page } from 'puppeteer'; export const getTextContent = (page: Page, selector: string) => page.$eval(selector, (element) => element.textContent); + +export const IS_RUNNING_IN_GITHUB_ACTIONS = process.env.GITHUB_ACTIONS === 'true';