Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playwright fails to run with Deno on Ubuntu #1

Merged
merged 5 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 5 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
pull_request:
branches:
- main
schedule:
- cron: '0 0 * * *' # Run every day
workflow_dispatch:

jobs:
Expand All @@ -15,6 +17,7 @@ jobs:
matrix:
browser: [chromium, firefox]
os: [ubuntu-latest, macos-latest]
deno-version: [1.46.3, 2.0.0-rc.6, canary, 2.0.0]
fail-fast: false

runs-on: ${{ matrix.os }}
Expand All @@ -25,38 +28,12 @@ jobs:

- name: Install Deno
uses: denoland/setup-deno@v1
with:
deno-version: ${{ matrix.deno-version }}

- name: Install ${{ matrix.browser }}
run: deno run -A npm:[email protected] install --with-deps ${{ matrix.browser }}

- name: Run
working-directory: ./deno
run: deno task ${{ matrix.browser }}

node:
strategy:
matrix:
browser: [chromium, firefox]
os: [ubuntu-latest, macos-latest]
fail-fast: false

runs-on: ${{ matrix.os }}

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4

- name: npm ci
working-directory: ./node
run: npm ci

- name: Install Playwright Browser
working-directory: ./node
run: npx playwright install --with-deps ${{ matrix.browser }}

- name: Run
working-directory: ./node
run: node index.mjs ${{ matrix.browser }}
15 changes: 1 addition & 14 deletions deno/chromium.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@
import { chromium } from "npm:[email protected]";

async function main() {
await using browser = await chromium.launch({
await using _browser = await chromium.launch({
headless: true,
args: [
"--no-sandbox",
//"--headless=new",
"--disable-dev-shm-usage",
"--disable-setuid-sandbox",
"--disable-gpu",
"--no-xshm",
"--disable-features=VizDisplayCompositor",
],
});
await using page = await browser.newPage();
await page.goto("https://example.com");
const title = await page.title();
console.log(`title: ${title}`);
}

if (import.meta.main) {
Expand Down
13 changes: 1 addition & 12 deletions deno/firefox.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
import { firefox } from "npm:[email protected]";

async function main() {
await using browser = await firefox.launch({
await using _browser = await firefox.launch({
headless: true,
args: [
"--no-sandbox",
],
firefoxUserPrefs: {
"gfx.webrender.all": false,
"media.hardware-video-decoding.enabled": false,
},
});
await using page = await browser.newPage();
await page.goto("https://example.com");
const title = await page.title();
console.log(`title: ${title}`);
}

if (import.meta.main) {
Expand Down
Loading