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

Using puppeteer Chrome bin broken with version 111 #265

Open
JeremySaanv opened this issue Mar 21, 2023 · 0 comments
Open

Using puppeteer Chrome bin broken with version 111 #265

JeremySaanv opened this issue Mar 21, 2023 · 0 comments

Comments

@JeremySaanv
Copy link

Hi !

In my Angular project, to improve Unit testing I use puppeteer Chromium binary as described in the doc.

Everything worked fine until I updated to Puppeteer 19.7.x, which updated Chromium from v110.x to v111.x. Nothing else change in our project as the only thing we use is the executablePath() method to run Chromium instead of windows installed Chrome.
I did try some cross test, changed the puppeteer version, only versions before 19.7.x, cleared all cache and deleted puppeteer chromium.
I also did some tests with the chromium itself, everything works fine, running it headless in the same context does not have the same issue.

I use the latest karma-chrome-launcher version so I don't think it's a know compatibility issue.

To reproduce I generated an empty Angular project and synchronised dependencies with my project, generated a karma.conf.js file which I modified to include puppeteer a described in the documentation, which has the same issue.

Here's the files:

Package.json

{
  "name": "angular-tour-of-heroes",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test --no-watch"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "15.2.1",
    "@angular/common": "15.2.1",
    "@angular/compiler": "15.2.1",
    "@angular/core": "15.2.1",
    "@angular/forms": "15.2.1",
    "@angular/platform-browser": "15.2.1",
    "@angular/platform-browser-dynamic": "15.2.1",
    "@angular/router": "15.2.1",
    "rxjs": "7.8.0",
    "tslib": "2.5.0",
    "zone.js": "0.12.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "15.2.1",
    "@angular/cli": "15.2.1",
    "@angular/compiler-cli": "15.2.1",
    "@types/jasmine": "4.3.1",
    "jasmine-core": "4.5.0",
    "karma": "6.4.1",
    "karma-chrome-launcher": "3.1.1",
    "karma-coverage": "2.2.0",
    "karma-jasmine": "5.1.0",
    "karma-jasmine-html-reporter": "2.0.0",
    "puppeteer": "19.7.5",
    "typescript": "4.8.4"
  }
}

karma.conf.js

// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

process.env.CHROME_BIN = require('puppeteer').executablePath();

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'),
      require('@angular-devkit/build-angular/plugins/karma')
    ],
    client: {
      jasmine: {
        // you can add configuration options for Jasmine here
        // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
        // for example, you can disable the random execution with `random: false`
        // or set a specific seed with `seed: 4321`
      },
      clearContext: false // leave Jasmine Spec Runner output visible in browser
    },
    jasmineHtmlReporter: {
      suppressAll: true // removes the duplicated traces
    },
    coverageReporter: {
      dir: require('path').join(__dirname, './coverage/angular-karma-puppeteer-issue'),
      subdir: '.',
      reporters: [
        { type: 'html' },
        { type: 'text-summary' }
      ]
    },
    reporters: ['progress', 'kjhtml'],
    browsers: ['ChromeHeadless'],
    restartOnFileChange: true
  });
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant