mujo-code / puppeteer-headful Goto Github PK
View Code? Open in Web Editor NEWGithub Action for puppeteer that is headful.
License: MIT License
Github Action for puppeteer that is headful.
License: MIT License
to allow for projects like this to record the test videos.
Hello, I am running into an issue trying to get this to work with my project.
It seems to fail on the "Install Dependencies" step, and therefore the extension cannot be built and the tests fail.
The "Install Dependency" step fails due to it not finding the npm cache.
Is there something I am doing wrong? Here is the error and my .yml file.
Run actions/setup-node@v3
with:
node-version: 18.x
cache: npm
always-auth: false
check-latest: false
token: ***
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
Found in cache @ /opt/hostedtoolcache/node/18.16.0/x64
Environment details
node: v18.16.0
npm: 9.5.1
yarn: 1.22.19
/opt/hostedtoolcache/node/18.16.0/x64/bin/npm config get cache
/home/runner/.npm
npm cache is not found
I'm trying to run all the code in docker, include the puppeteer with chrome, and just for local development. here is my steps below:
docker build -t chrome .
docker run --rm -it -w /app -v $PWD:/app chrome bash
,npm i puppeteer -S
and node ./index.js
, code see blow:const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({
headless: false, // open the chrome
executablePath: "/usr/bin/google-chrome-stable", // process.env.PUPPETEER_EXEC_PATH
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
]
});
const page = await browser.newPage();
await page.goto('https://google.com', { waitUntil: 'networkidle2' });
console.log('hold it for a while and see the launched chrome...');
await page.waitFor(20000);
await browser.close();
})();
Finally, it turns out ok, but I cannot see the launched chrome in docker.
If it's possible to see the launched chrome from docker, It will be convenient to develop something useful.
Hey folks!
Great job on this action, it's super helpful 👍
I see this has 23 forks already, but I don't see a license file. Is this meant to be proprietary code or Open Source?
It would be great if you could add a license file so everyone who wants to fork it and make contributions knows whether they can legally do so or not 🙂.
Cheers!
Hi, I'm using this action and it doesn't seem to actually run my command.
The relevant section of my workflow yml looks like this:
- name: Run Tests
uses: mujo-code/puppeteer-headful@master
env:
CI: 'true'
with:
args: cd ./ember-debugger && yarn run test
When the github action runs, the "Run Tests" step completes in just 15s, and the only output in the logs is:
/usr/bin/docker run --name dd9e7397d7b3e5ce35497d97550af0970d049d_28b7b4 --label dd9e73 --workdir /github/workspace --rm -e CI -e INPUT_ARGS -e HOME -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e GITHUB_ACTIONS=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/chrome-extensions/chrome-extensions":"/github/workspace" dd9e73:97d7b3e5ce35497d97550af0970d049d cd ./ember-debugger && yarn run test
Running 'cd ./ember-debugger && yarn run test'!
Successfully ran 'cd ./ember-debugger && yarn run test'
The yarn run test
command should be printing out some output that should appear in the logs, and the test command typically takes ~30s locally.
I've added an explicit assert.ok(false)
to my code, too, to ensure that the test command fails.
Any suggestions for debugging this?
Hi,
I want to use this GitHub action to test a chrome extension. I set headless
to false
according to the docs as well as the env var PUPPETEER_EXEC_PATH
. However, the job is failing with the following error message.
(chrome:6378): Gtk-WARNING **: 18:44:16.028: cannot open display:
Error: Failed to launch chrome!
It seems like PUPPETEER_EXEC_PATH
is not defined. Any idea what is missing? I tried to find other repositories which are using this action, but nothing showed up in the GitHub search. I also set PUPPETEER_EXEC_PATH
to google-chrome-stable
, but it keeps failing
This is how my workflow file looks like
name: Node CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: '10.x'
- run: npm ci
- run: npm run build
- name: Run E2E
uses: mujo-code/puppeteer-headful@master
env:
CI: true
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
- run: npm run e2e
This is the related PR OctoLinker/OctoLinker#662
https://github.com/marketplace/actions/puppeteer-headful
This caught us since this old version uses Node 12, where as the v2
tag uses Node 16. I wonder if we could delete the 12.3.1
tag and maybe the marketplace will pick up v2
as latest? Not sure if this would break existing workflows...
Upgrade node to v18.7.0 please :)
PR is already open, just click on merge :) #109
When I'm trying to load the MetaMask extension to the browser Chrome is crashing. Can somebody help me with that?
Failed to launch the browser process!
[118:145:0421/180114.044621:ERROR:bus.cc(397)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[118:145:0421/180114.044708:ERROR:bus.cc(397)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[118:118:0421/180114.050376:ERROR:process_singleton_posix.cc(465)] readlink failed: Permission denied (13)
[118:118:0421/180114.050792:ERROR:process_singleton_lock_posix.cc(20)] readlink(/github/workspace/e2e/browser/user-data-dir/SingletonLock) failed: Permission denied (13)
[118:118:0421/180114.050968:ERROR:process_singleton_posix.cc(317)] readlink(/github/workspace/e2e/browser/user-data-dir/SingletonLock) failed: Permission denied (13)
[118:118:0421/180114.052214:ERROR:process_singleton_posix.cc(341)] Failed to create /github/workspace/e2e/browser/user-data-dir/SingletonLock: Permission denied (13)
[118:118:0421/180114.052459:ERROR:process_singleton_posix.cc(465)] readlink failed: Permission denied (13)
[118:118:0421/180114.052588:ERROR:process_singleton_lock_posix.cc(20)] readlink(/github/workspace/e2e/browser/user-data-dir/SingletonLock) failed: Permission denied (13)
[118:118:0421/180114.052719:ERROR:chrome_browser_main.cc(1[43](https://github.com/XXX/runs/6117056204?check_suite_focus=true#step:12:43)2)] Failed to create a ProcessSingleton for your profile directory. This means that running multiple instances would start multiple browser processes rather than opening a new window in the existing process. Aborting now to avoid profile corruption.
[118:146:0421/180114.054023:ERROR:bus.cc(397)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[118:146:0421/180114.05[45](https://github.com/XXX/runs/6117056204?check_suite_focus=true#step:12:45)45:ERROR:bus.cc(397)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
at onClose (node_modules/puppeteer/src/node/BrowserRunner.ts:268:9)
at ChildProcess.<anonymous> (node_modules/puppeteer/src/node/BrowserRunner.ts:2[55](https://github.com/XXX/runs/6117056204?check_suite_focus=true#step:12:55):61)
This will help with versions of chrome and nodejs.
Right now I am using mujo-code/source as a test repo for this action. That being said it is huge and takes forever before I can even see if the e2e test runs successfully.
Hi all,
I am trying to run jest-puppeteer tests with docker-compose in github actions
Here is my yml file:
jobs:
test-e2e:
runs-on: ubuntu-latest
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true"
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Docker Compose
run: docker-compose -f ${{ env.DOCKER_COMPOSE_FILE }} up -d
- name: Run E2E Tests
uses: mujo-code/[email protected]
env:
CI: "true"
with:
args: docker exec -t app npm run test:e2e-admin
- name: Tear down Docker Compose
run: docker-compose -f ${{ env.DOCKER_COMPOSE_FILE }} down
I got this error for above github action
/entrypoint.sh: 13: /entrypoint.sh: docker: not found
Running 'docker exec -t app npm run test:e2e-admin'!
Hello,
Thank you for this docker.
However, I have a problem when I want to use your docker file, I have the following error :
(node:577) UnhandledPromiseRejectionWarning: Error: Unable to launch browser, error message: Could not find browser revision 782078
.
But If I create the instance of Xvfb manually inside the container, Puppeteer works! But not with the entrypoint.sh
Do you have any idea?
Thank you for your support.
I've noticed that e2e tests in my project stopped working recently.
Here is my config:
- name: End-to-end tests
uses: mujo-code/puppeteer-headful@master
env:
CI: 'true'
with:
args: npm run build:e2e && npm run test:e2e
You can see that it has npm run build:e2e && npm run test:e2e
command. The problem is that when I run the action only the npm run build:e2e
is being executed and the npm run test:e2e
produces no logs.
Could you please confirm if this is related to the puppeteer-headful action?
I have been having issues with how this docker container downloads Chrome. I get some fails in CI that say that we are running a version of Chrome that it fails to connect to. It is essentially this issue.
I feel like, from my experience, the Chrome download is not really being sped up via layer caching so I think we should just remove the Chrome download in this repo.
I think it should be actions/setup-node@v1
Thanks for this github action, btw! It's been super useful to test a chrome extension!
I was able to get it running, but when puppeteer attempted to launch, it reported this failure:
Error: Failed to launch chrome!
[70:70:1025/151225.400209:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
I was able to fix this by adding the --no-sandbox
arg, but I wondered if it is possible to run in sandbox mode.
According to the sandbox part of the troubleshooting docs, it looks like perhaps the Dockerfile needs to run sudo sysctl -w kernel.unprivileged_userns_clone=1
and then switch into a non-privileged user before it launches the puppeteer browser.
I tried adding the sysctl
command to my test script, and it appears that it works, but even so I was still unable to run without the --no-sandbox
arg.
Hello guys. My name is Sávio, I'm from Brazil and I'm using Plasmo for my graduation project. I'm using cucumber and puppeteer to perform the extension's e2e tests and locally I can make it work. But I would like to enable a Github action to run these tests at the time of pull requests. I tried to use this action but when entering the page this error is triggered: Error: net::ERR_BLOCKED_BY_CLIENT at chrome-extension://.
Thank you in advance for your attention and if you can help.
Repository: https://github.com/bingobongo-testing/extension.
Github Action Error: https://github.com/bingobongo-testing/extension/actions/runs/3315466559/jobs/5476094414
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.