2

This test does a login on a non-angular site, then switches to angular app and performs the testing. I found that regular bindings by.css work, but custom ones like by.binding don't.

describe('show-rights: TC15269-restrictions', function () {

    var page = new Page();

    it('should display the restrictions', function () {
        //login on a non-angular site
        browser.ignoreSynchronization = true;
        browser.get('channel/moonlight-1202275');
        //redirects to the user login
        element(by.css('#username')).sendKeys = 'User1';
        ...
        //this click will do 2 redirects, the last one being the angular app 
        signIn.click();
        browser.wait(function () {
            return browser.getCurrentUrl().then(function (currentUrl) {
                return currentUrl.indexOf('channel/moonlight-1202275') > -1;
            });
           }, 15000));
        //mark app as Angular
        browser.ignoreSynchronization = false;
        //this will fail
        expect(element(by.binding('formattedType')).isPresent()).toBe(true);

    });
});

the html

<div>
    <p>{{ formattedType }}</p>
</div>

(Protractor version 2.5.1, angular 1.3.17)

To fix it, I'm refreshing the page:

//mark app as Angular
browser.ignoreSynchronization = false;

//this fixes the custom selectors issue:
browser.refresh();
//this now works
expect(element(by.binding('formattedType')).isPresent()).toBe(true);

Is there another solution?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.