lundi 8 août 2016

click on hyperlinks in unit testing using protactor in angularjs

I am new in unit testing in angularjs. I read the tutorial from:

http://ift.tt/1snzUqt.

I want to click on hyperlink but i dont know how can i achieve this.

Here is my code:

<li ng-repeat="menu in sidebarLinks" ng-if="menu.visible == true " ng-class="{active: isActive('/')}">
                    <a ng-href="#/" title="" ng-click="loadSubmenus(menu.action)"  ng-class="{active: isActive('/')}">
                        <div class="icon " ng-class="{active: isActive('/')}"></div> 
                           <span> </span>
                    </a>
                </li>   

In unit testing:

describe('Protractor Demo App', function() {
    browser.driver.get('https://localhost:8443/login.html');

browser.driver.findElement(by.id('name')).sendKeys('test');
browser.driver.findElement(by.id('password')).sendKeys('test');
browser.driver.findElement(by.id('login')).click();

});

After login url is https://localhost:8443/#/dash

After click on link url should be https://localhost:8443/#/hypera

Aucun commentaire:

Enregistrer un commentaire