Skip to content

Commit 55ea901

Browse files
committed
fix(ci): set PLAYWRIGHT_LAUNCH_ARGS for tests
1 parent bcac54c commit 55ea901

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ jobs:
4444
run: npm ci
4545

4646
- name: Run tests
47+
env:
48+
PLAYWRIGHT_LAUNCH_ARGS: '--no-sandbox' # Add args needed for CI
4749
run: npm run test
4850

4951
build:

src/scraper/middleware/components/HtmlPlaywrightMiddleware.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ export class HtmlPlaywrightMiddleware implements ContentProcessorMiddleware {
1717
*/
1818
private async ensureBrowser(): Promise<Browser> {
1919
if (!this.browser || !this.browser.isConnected()) {
20-
logger.debug("Launching new Playwright browser instance (Chromium)...");
21-
this.browser = await chromium.launch();
20+
const launchArgs = process.env.PLAYWRIGHT_LAUNCH_ARGS?.split(" ") ?? [];
21+
logger.debug(
22+
`Launching new Playwright browser instance (Chromium) with args: ${launchArgs.join(" ") || "none"}...`,
23+
);
24+
this.browser = await chromium.launch({ args: launchArgs });
2225
this.browser.on("disconnected", () => {
2326
logger.debug("Playwright browser instance disconnected.");
2427
this.browser = null;

0 commit comments

Comments
 (0)