---restore content starts---
Angularjs's official website provides a sample project for learning: Phonecat. This is a web app where users can browse some Android phones, learn more about them, and perform search and sort operations.
Get Source code
The source code for the Phonecat project is hosted on GitHub, so you need to install git before you get the source, and after you install Git, you can download it from git clone:
git clone--depth= https://github.com/angular/angular-phonecat.git
The –DEPTH=14 option means that only the last 14 code submissions are downloaded, which reduces the size of the downloaded file and speeds up the download.
Install dependent packages
Phonecat is a Web application, so it's best to run it in a Web server for best results. Official recommended installation of node. js
The run and test of the Phonecat project relies on a number of other tools that can be installed with the NPM command after installing node. js. The following commands need to be run under the Angular-phonecat project path:
Install
After you run the command, the following dependency packages are installed under the ANGULAR-PHONECAT project path:
- Bower . Package Manager
- http-server . Lightweight Web server
- Karma . For running Unit tests
- protractor . For running end-to-end testing
Run the Phonecat project
After doing this, running the PHONECAT project is simple, run the following command under the ANGULAR-PHONECAT project path:
NPM start
Once Phonecat is running, you can open http://localhost:8000/app/index.html in your browser to access the Web App.
Run unit tests
Unit tests in the PHONECAT project are done using Karma, and all unit test cases are stored in the Test/unit directory. You can run unit tests by executing the following command:
NPM Test
Note: You must have Google Chrome installed on your computer before you run unit tests.
run end-to-end testing
The PHONECAT project uses end-to-end testing to ensure the operability of Web applications, and this end-to-end testing is done by using protractor, where all end-to-end test cases are stored in the TEST/E2E directory. You can run an end-to-end test by performing the following steps:
// update webdriver, this command only runs once NPM run update-webdriver// run Phonecatnpm start
Open another command-line window in which to run:
NPM Run Protractor
The realization of the ANGULAR-PHONECAT project of angular learning