Your First Test

We are going to start writing your first test. To begin lets say we have a scenario where we want to make sure that there is an image with the certain class present on the screen.

describe('Your first test', function() {

  it('should have angular image', function(){
    browser.get('http://www.angularjs.org');
    expect($('.AngularJS-large').isPresent()).toBeTruthy();
  });

});

By default Protractor uses Jasmine as the test runner of choice. You can select other frameworks but for this lesson we will stick with the default.

Jasmine uses test descriptive functions like "describe" and "it", to describe your scenarios.

The "it" block is the specific test that you want to validate.

In our test scenario the first thing we need to accomplish is to go to the AngularJS website. To make this happen we use browser.get().

Once we get to the Angular website then we write an expectation that says element with class "AngularJS-large" is to be present.

To run your test...

$ npm run ptr

results matching ""

    No results matching ""