how to compare actual and expected values in angul

2019-06-14 02:35发布

问题:

In angular protractor automation,am trying to compare the values using "expect" but am not able to do it. In our application, after clicking on submit button the page is navigating to welcome page, so i want to get the expected value from the welcome page. This is the welcome page Html code

<a class="link-btn ng-binding" title="new position" ng-click="openPositionModal($event)"><i class="icon-plus"></i> new position</a>

please help me..

Thanks, Raghavendra

回答1:

Just check if an element with the title "new position" is present.

it('should navigate to the welcome page', function() {
    // Code that clicks the submit button etc
    var newPositionLink = element(by.css('[title="new position"]'));
    expect(newPositionLink.isPresent()).toEqual(true);
})