Environment Setup Back
Firstly, clone the angular-phonecat repository located at GitHub by running the following command:
git clone --depth=16 https://github.com/angular/angular-phonecat.git
--depth=16option tells Git to pull down only the last 16 commits, which make it faster to download
After then, install all dependencies through
npm install -g bower `
npm install will also automatically use bower to download the AngularJS framework into the directory
2. Running the Development Web Server
Start the web server by running:
Then it will create a local web server that is listening to the port 8000 of the local machine.
If you want to serve the app on a different IP address or port, edit the "start" script within
package.json, and use
-ato set up another address, and
-pto set up the port. At the same time, you also need to upade the
baseUrlconfiguration property in
3. Running Unit Tests
Unit tests focus on testing small isolated parts of application. The angular-phonecat project use Karma to run the unit tests for the application. Start it by running:
With running Karma, it will read the configuration file
karma.conf.js located at the root of the project directory, which tells Karma to:
- Open up instances of the Chrome and Firefox browsers and connect them to Karma
- Execute all the unite tests in these browsers
- Report the result of tests in the terminal
4. Running E2E Tests
E2E (end-to-end) tests are used to ensure that the application behaves as expected. How? It will simulate real user interactions in the browser.
E2E tests are kept in the
e2e-tests directory, run by Protractor.
Before running applications, we may need to install some drivers relied by Protractor:
npm run update-webdriver
Then, make sure we have started up a running application:
Then, run it:
npm run protractor
With running Protractor, it will read the configuration file at
e2e-tests/protractor.conf.js, which tells Protractor to:
- Open up a Chrome browser to connect to the application
- Execute all the E2E tests in this browser
- Report the result of tests in the the terminal
- Close the browser and exit
As the plugin is integrated with a code management system like GitLab or GitHub, you may have to auth with your account before leaving comments around this article.
Notice: This plugin has used Cookie to store your token with an expiration.