Difference between revisions of "7CC005 Workshop w6"
From mi-linux
Jump to navigationJump to searchLine 1: | Line 1: | ||
[[Main Page]] >> [[7CC005|Web Technologies]] >> [[7CC005_-_Workbook|Workbook]] >> Week 07 - Automated Web Testing | [[Main Page]] >> [[7CC005|Web Technologies]] >> [[7CC005_-_Workbook|Workbook]] >> Week 07 - Automated Web Testing | ||
+ | |||
+ | == Official Google Angular testing guide == | ||
+ | |||
+ | * [ https://angular.io/docs/ts/latest/guide/testing.html https://angular.io/docs/ts/latest/guide/testing.html] | ||
+ | |||
+ | == Adding PhantomJS into the mix == | ||
This is how to get the QuickStart project to work with Karma and PhantomJS. | This is how to get the QuickStart project to work with Karma and PhantomJS. | ||
− | == Clone the repository == | + | === Clone the repository === |
<pre> | <pre> | ||
Line 10: | Line 16: | ||
</pre> | </pre> | ||
− | == Install phantomjs and phantomjs launcher == | + | === Install phantomjs and phantomjs launcher === |
<pre> | <pre> | ||
Line 17: | Line 23: | ||
</pre> | </pre> | ||
− | == Change karma.conf.js == | + | === Change karma.conf.js === |
<pre> | <pre> | ||
Line 27: | Line 33: | ||
</pre> | </pre> | ||
− | == Install Quickstart App == | + | === Install Quickstart App === |
$ npm install | $ npm install | ||
− | == Run tests == | + | === Run tests === |
$ npm test | $ npm test | ||
− | == TypeError: undefined is not a function error == | + | === TypeError: undefined is not a function error === |
If you get this error: | If you get this error: |
Revision as of 09:58, 1 March 2017
Main Page >> Web Technologies >> Workbook >> Week 07 - Automated Web Testing
Official Google Angular testing guide
- [ https://angular.io/docs/ts/latest/guide/testing.html https://angular.io/docs/ts/latest/guide/testing.html]
Adding PhantomJS into the mix
This is how to get the QuickStart project to work with Karma and PhantomJS.
Clone the repository
$ git clone https://github.com/angular/quickstart.git $ cd quickstart
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',