mercredi 30 novembre 2016

implementation if and else in protractor

I have a scenario like this,when user select public there no problem but when selects a private,here modal should be popup and click on ok . HTML code:

<div ng-show="private" class="privateSetting">
      <h5>privacy Settings</h5>
      <div>
          <md-switch ng-model="privacySwitch" style="width:35%;" class="md-primary md-switch" ng-click="privacySettings()">
          </md-switch>
      </div>
      <p>privacy Msg</p>

    </div>

test code:

> element(by.css('aria-label=Private')).isDisplayed().then(function(result)
> {
>     if ( result ) {
>         element(by.css('[ng-click="privacySettings()"]')).click();
>         browser.sleep(5000);
>         element(by.className('btn btn-primary')).click();
>       browser.sleep(5000);
> 
>     } else {
>      
>         element(by.css('[ng-click="privacySettings()"]')).click();
>           browser.sleep(5000);
>     }

Aucun commentaire:

Enregistrer un commentaire