GithubHelp home page GithubHelp logo

karma-playwright-launcher's People

Contributors

endyjasmi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

karma-playwright-launcher's Issues

[Question] Code Coverage and Karma Configuration

Is it possible to have code coverage using Karma and playwright? I have latest playwright. How I configure Karma and playwright test? Currently, We use es-dev-server to launch our test-bed application and Mocha to run the test.

How to Configure?

Trying to install in an Angular environment.

I'm going to preface this by saying I don't know puppeteer well but as it seems like playwright was created to be its successor so I thought I'd just skip directly to using it. Using this guide I've attempted to configure Karma and Protractor just as I would puppeteer only substituting playwright wherever I was told to put puppeteer instead. This line

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

Doesn't work however as playwright doesn't have an exectablePath() function itself Instead I tried

 process.env.CHROME_BIN = require('playwright').chromium.executablePath()

--
Which seemed like it would do what I wanted. however I'm still getting the following error message. when trying to run ng test --watch=false

  40% building 84/84 modules 0 active15 02 2020 20:41:52.310:INFO [launcher]: Trying to start ChromeHeadless again (2/2). 15 02 2020 20:41:52.360:ERROR [launcher]: Cannot start ChromeHeadless         /workspace/vr2k2/node_modules/playwright-core/.local-chromium/linux-740847/chrome-linux/chrome: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory  15 02 2020 20:41:52.360:ERROR [launcher]: ChromeHeadless stdout:  15 02 2020 20:41:52.361:ERROR [launcher]: ChromeHeadless stderr: /workspace/vr2k2/node_modules/playwright-core/.local-chromium/linux-740847/chrome-linux/chrome: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory  15 02 2020 20:41:52.436:ERROR [launcher]: ChromeHeadless failed 2 times (cannot start). Giving up. ``` Anyone have a better resource on how to setup Angular with `playwright`? | ```  40% building 84/84 modules 0 active15 02 2020 20:41:52.310:INFO [launcher]: Trying to start ChromeHeadless again (2/2). 15 02 2020 20:41:52.360:ERROR [launcher]: Cannot start ChromeHeadless         /workspace/vr2k2/node_modules/playwright-core/.local-chromium/linux-740847/chrome-linux/chrome: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory  15 02 2020 20:41:52.360:ERROR [launcher]: ChromeHeadless stdout:  15 02 2020 20:41:52.361:ERROR [launcher]: ChromeHeadless stderr: /workspace/vr2k2/node_modules/playwright-core/.local-chromium/linux-740847/chrome-linux/chrome: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory  15 02 2020 20:41:52.436:ERROR [launcher]: ChromeHeadless failed 2 times (cannot start). Giving up.

My next attempt was to find a karma plugin for playwright (which brought me here) thank you much for that but to be honest I'm mostly guessing with out to use it. I began with this command

npm i karma-playwright-launcher --save-dev

Then I configured my karma.config like so

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

process.env.CHROME_BIN = require('playwright').chromium.executablePath()

module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular-devkit/build-angular'],
    plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('karma-playwright-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'),
      reports: ['html', 'lcovonly'],
      fixWebpackSourcePaths: true
    },
    reporters: ['progress', 'kjhtml'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['ChromeHeadlessNoSandbox','Chromium'],
    customLaunchers: {
        ChromeHeadlessNoSandbox: {
            base: 'ChromeHeadless',
            flags: ['--no-sandbox']
        }
    },
    singleRun: false
  });
};

but when I try to run the test

ng test --browsers ChromeHeadlessNoSandbox

Update to playwright 1.x as peerDep?

Would you be willing to move the playwright dep to a peer dependency of 1.x? This would let the consuming package rev the version of playwright (and browser engines) without bumping this lib.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.