Hi there,
I am getting the below pipeline error while using ChromeHeadless browser.
karma.conf.js
autoWatch: true,
browsers: ['ChromeHeadlessNoSandbox'],
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: [
'--no-sandbox',
'--user-data-dir=/tmp/chrome-test',
'--disable-web-security'
]
}
},
singleRun: false
Community moderators have prevented the ability to post new answers.
@kumarpr I've put together an example repository demonstrating Puppeteer with Chromium in pipelines - https://bitbucket.org/bitbucketpipelines/example-chromium-headless-puppeteer/src/master/. In your case, it looks like there were additional dependencies that need edto be installed into the node:8.9.4 image in order to have Puppeteer be able to launch a Chromium browser instance.
In the linked example, the bitbucket-pipelines.yml file installs these required dependencies, then uses Puppeteer to start a Chromium instance and take a screenshot, saving it as a build artifact.
Trying to use the example script in your repository does not work for me.
I get:
E: Unable to locate package libgconf-2-4
E: Unable to locate package update
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @kumarpr I just ended up here as I was having the same problem.
Using @Graham Gatus pipeline as inspiration and after some research I discovered that puppeteer node package installs a bundled chromium binary, so installing chromium again seems a bit redundant.
Instead, try to:
Here's how my solution looks like:
```
image: node:10.16.3
pipelines:
default:
- step:
name: Install dependencies and test the app
caches:
- node
script:
- apt update && apt install -yq libgconf-2-4 libatk1.0-0 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libgbm-dev libnss3-dev libxss-dev libasound2
- npm ci
- export CHROME_BIN="./node_modules/puppeteer/.local-chromium/linux-884014/chrome-linux/chrome"
- npm run testci
```
Where testci is the following custom command:
```
node node_modules/@angular/cli/bin/ng test --no-progress --no-watch --reporters junit --browsers ChromeHeadlessCI
```
PS: @PhilippHabele see if this solves your issue too :)
Hope this help someone!
Cheers!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How do you know which binary version to use in CI environment? I installed the puppeteer package locally and since my computer is a Mac, it has the Mac binary.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I guess I don't have a straight answer to that @Daniel . See which version are you using locally and if every release is done for every platform. In that case, whatever your local Mac environment is using should work for the base image of the CI container/pipeline.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I also have the same issue.
Currently I made a new Angular application and try to setup the default pipeline.
karma.conf.js
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/frontenddevnet'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
bitbucket-pipelines.yml
image: node
pipelines:
default:
- step:
name: Lint and Test
caches:
- node
script:
- npm install
- npm run lint
- npm run test
error
21 08 2019 10:58:42.349:WARN [karma]: No captured browser, open http://localhost:9876/
21 08 2019 10:58:42.399:INFO [karma-server]: Karma v4.1.0 server started at http://0.0.0.0:9876/
21 08 2019 10:58:42.399:INFO [launcher]: Launching browsers Chrome with concurrency unlimited
21 08 2019 10:58:42.408:INFO [launcher]: Starting browser Chrome
21 08 2019 10:58:42.409:ERROR [launcher]: No binary for Chrome browser on your platform.
Please, set "CHROME_BIN" env variable.
21 08 2019 10:58:47.381:WARN [karma]: No captured browser, open http://localhost:9876/
how to configure the Chrome browser? Any ideas?
Kind regards,
Phil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@kumarpr , are you able to provide your bitbucket-pipelines.yml file?
Based on the error, it sounds like you may need to install chromium browser first.
You can test this by running `which chromium-browser` in your pipeline, which should give the location of chromium.
If chromium is not present, for an Ubuntu based build image (e.g when using the default pipelines image), you can install this via:
```
apt-get update && apt-get install -y chromium-browser
```
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Graham,
Thanks for your reply.
bitbucket-pipelines.yml
image: node:8.9.4
options:
max-time: 20
pipelines:
default:
- step:
name: Build and test
caches:
- node
script:
- npm install
- npm run lint
- npm run test
- npm run build
I have treid to install the puppeteer as well to use the ChromeHeadless
image: node:8.9.4
options:
max-time: 20
pipelines:
default:
- step:
name: Build and test
caches:
- node
script:
- npm install
- npm install -D puppeteer
- npm run lint
- npm run test
- npm run build
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
Did you catch the news at Team ‘25? With Loom, Confluence, Atlassian Intelligence, & even Jira 👀, you won’t have to worry about taking meeting notes again… unless you want to. Join us to explore the beta & discover a new way to boost meeting productivity.
Register today!Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.