Test your customizations

Every time that you change the source files to customize your site, you can test your changes by running unit tests and end to end tests. Unit tests are run by using Karma and the End-to-End tests are run by using Protractor.

Unit tests

Run the command npm test.
The command compiles the application and test code and starts karma, which opens a browser and displays the test result. Both processes watch pertinent files, write messages to the console, and rerun when they detect changes.
Unit tests are written in Jasmine, which are called specs. Each spec is located in the same folder as the component they are testing. The filename extension must be .spec.ts, the convention adhered to by karma.conf.js. For more information on writing specs, look at the Angular Testing guide.

End to end tests

End-to-end tests explore the application as users experience it. In end-to-end testing, one process runs the real application and a second process runs protractor tests that simulate user behavior and assert that the application responds in the browser as expected. Before you run the end-to-end tests, make sure that you are serving the application through npm start.
Run the command npm run e2e.`

End-to-end tests are located in the test/e2e folder. The filename extension must be .e2e-spec.js the convention adhered to by protractor.conf.js. The end-to-End test uses page objects, which are located in the test\pageobjects folder. Page objects help you write cleaner tests by encapsulating information about the elements on your application page. A page object can be reused across multiple tests, and if the template of your application changes, you need to update only the page object. For more information on writing e2e-specs, look at the Protractor docs.


//function openLang(evt, cityName) { // Declare all variables //var i, tabcontent, tablinks; // Get all elements with class="tabcontent" and hide them //tabcontent = document.getElementsByClassName("tabcontent"); //for (i = 0; i < tabcontent.length; i++) { // tabcontent[i].style.display = "none"; //} // Get all elements with class="tablinks" and remove the class "active" //tablinks = document.getElementsByClassName("tablinks"); //for (i = 0; i < tablinks.length; i++) { // tablinks[i].className = tablinks[i].className.replace(" active", ""); //} // Show the current tab, and add an "active" class to the button that opened the tab // document.getElementById(cityName).style.display = "block"; // evt.currentTarget.className += " active"; //} //$('a[data-toggle="pill"]').on('shown.bs.tab', function (e) { // $(e.target).removeClass( "light-blue" ); // $(e.relatedTarget).addClass( "light-blue" ); //}) // collapsible blocks // var coll = document.getElementsByClassName("collapsible"); // var i; // for (i = 0; i < coll.length; i++) { // coll[i].addEventListener("click", function() { // this.classList.toggle("active"); // var content = this.nextElementSibling; // if (content.style.maxHeight){ // content.style.maxHeight = null; // } else { // content.style.maxHeight = content.scrollHeight + "px"; } // }); // }