Skip to content

Commit

Permalink
Merge pull request #1 from magurotuna/simplify
Browse files Browse the repository at this point in the history
Playwright fails to run with Deno on Ubuntu
  • Loading branch information
magurotuna authored Oct 16, 2024
2 parents ee0cc56 + 5956169 commit eeae249
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 54 deletions.
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

0 comments on commit eeae249

Please sign in to comment.