python ruby-programming-language Smalltalk Vue.js Knockoutjs TypeScript JavaScript, OOPs JavaScript Angular 7, Interview Questions Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 4 Angular 2 AngularJs 1.x NodeJs Perl Programming R Programming RequireJs Rust Programming Backbonejs closure programming language go-programming-language kotlin-programming-language
e2e tests

How To Write End-to-End Tests for Your Angular 4 and 5 Applications? [e2e tests]

What is e2e (end-to-end) Testing?
The End to End Testing is used to testing the entire application looks like -
ü  All User Interactions
ü  All Service Calls
ü  Authentication/Authorization of app
ü  Everything of App
ü  And so on.

This is the actual testing of your apps. It is fast action.
Unit testing and Integrations testing will do as fake calls but e2e testing is done with your actual Services and APIs calls.
ü  Stayed Informed -   Angular Unit Test - Karma and Jasmine

Test functions–
ü  describe – Test suit (just a function)
ü  it  - The spec or test
ü  expect -  Expected outcome.

Triple Rule of Testing –
ü  Arrange - Create and Initialize the Components
ü  Act - Invoke the Methods/Functions of Components
ü  Assert - Assert the expected outcome/behaviour

Sample Test example -
app.po.ts –
import { browser, by, element } from 'protractor';

export class AppPage {
  navigateTo() {
    return browser.get('/');

  getParagraphText() {
    return element(by.css('app-root h1')).getText();

app.e2e-spec.ts –
import { AppPage } from './app.po';

describe('my-app App', () => {
  let page: AppPage;

  beforeEach(() => {
    page = new AppPage();

  it('should display welcome message', () => {

    expect(page.getParagraphText()).toEqual('Welcome to app!');

I hope you are enjoying with this post! Please share with you friends!! Thank you!!!

Hi there! Welcome to my blog. My name is Anil Singh. I'm a author of this blog. For more detail about me, kindly refer to this link..
My Blogs - and
My Books - Interview Questions and Answers Books- Get Your Book in 15+ Digital Stores Worldwide..

You Might Also Like Powered by Blogger.
ASK Questions