Difference between revisions of "7CC005 Workshop w6"
From mi-linux
Jump to navigationJump to searchLine 13: | Line 13: | ||
=== Clone the repository === | === Clone the repository === | ||
+ | |||
+ | First you need to get the quickstart project: | ||
<pre> | <pre> | ||
Line 18: | Line 20: | ||
$ cd quickstart | $ cd quickstart | ||
</pre> | </pre> | ||
+ | |||
+ | '''Important: Obviously don't do this again if you already have it.''' | ||
=== Install phantomjs and phantomjs launcher === | === Install phantomjs and phantomjs launcher === |
Revision as of 10:01, 1 March 2017
Main Page >> Web Technologies >> Workbook >> Week 07 - Automated Web Testing
Official Google Angular testing guide
The main Angular testing guide is located here:
You should probably read up to "Test a component with an async service". Please note that there are links to all live working examples near the beginning of the tutorial.
Adding PhantomJS into the mix
This is how to get the QuickStart project to work with Karma and PhantomJS.
Clone the repository
First you need to get the quickstart project:
$ git clone https://github.com/angular/quickstart.git $ cd quickstart
Important: Obviously don't do this again if you already have it.
Install phantomjs and phantomjs launcher
$ npm install --save-dev phantomjs $ npm install --save-dev karma-phantomjs-launcher
Change karma.conf.js
// First change require('karma-chrome-launcher') => require('karma-phantomjs-launcher') // Second change browsers: ['Chrome'] => browsers: ['PhantomJS']
Install Quickstart App
$ npm install
Run tests
$ npm test
TypeError: undefined is not a function error
If you get this error:
PhantomJS 2.1.1 (Linux 0.0.0) ERROR TypeError: undefined is not a function (evaluating 'System.config') at karma-test-shim.js:30
Append system-polyfills.js to karma.conf.js:
files: [ // System.js for module loading 'node_modules/systemjs/dist/system.src.js', 'node_modules/systemjs/dist/system-polyfills.js',