GithubHelp home page GithubHelp logo

quramy / angular-puppeteer-demo Goto Github PK

View Code? Open in Web Editor NEW
58.0 2.0 16.0 89 KB

A demonstration repository explains how to using Puppeteer in unit testing

TypeScript 48.48% JavaScript 25.70% HTML 25.27% CSS 0.56%
angular puppeteer automated-testing

angular-puppeteer-demo's Introduction

Angular Puppeteer Demo CircleCI

๐Ÿ˜Ž A demonstration repository explains how to replace from Karma to Puppeteer.

Running unit tests

Run npm test to execute the unit tests via Karma Puppeteer. And captures screenshot viewport after each spec. The captured images are here(by reg-suit).

How to replace test runner

In summary, I did:

  1. Create a webpack-dev-middleware instance using angualr-cli's karma plugin.
  2. Boot an Express server using thi middleware
  1. Expose Puppeteer's screenshot function and use it via afterEach.
  2. Let the Puppeteer's page object go to the html file served by the Express app.

If you want more details, please see puppeteer-test.js.

angular-puppeteer-demo's People

Contributors

angular-cli avatar budnix avatar quramy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

angular-puppeteer-demo's Issues

Update to readme

Also worth to mention in the readme, that you should remember to install

npm install jasmine-spec-name-patch --save-dev

Not working in Angular 6+

Karma can no longer be executed outside angular, so I am getting this error:

Error: The '@angular-devkit/build-angular/plugins/karma' karma plugin is meant to be used from within Angular CLI and will not work correctly outside of it

after changing the location of Karma as required in newer versions of angular

Recommandations is to use a command like

ng test --karma-config karma.somestuff.conf.js

to run Karma, but I can't find any samples of how to do that from an express server like the one you have created for calling Karma

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.