angular / protractor

E2E test framework for Angular apps
http://www.protractortest.org
MIT License
8.75k stars 2.31k forks source link

Protractor 2.0.0 can't sync with page without ng-app #2095

Closed erikdonohoo closed 9 years ago

erikdonohoo commented 9 years ago

Not sure if this was a design change for 2.0.0 or not, but 1.8.0 and previous worked in our situation.

Basically, our app triggers a login to a 3rd party Oauth2 provider. We have been using an onPrepare block in our protractor.conf.js to login and trigger the flow back to the app. But now protractor dies as soon as it arrives there because it can't find the ng-app attribute. Any suggestions or workarounds to achieve the old behavior on 2.0.0?

JonDuffy commented 9 years ago

Are you setting ingnoreSynchronisation to true when on the login page?

This will stop protractor looking for an angular app. I'm assuming here that login page is not an angular app.

erikdonohoo commented 9 years ago

It is indeed not an angular app. Where do you tell protractor to use ignoreSyncronisation? In protractor.conf.js? I just browsed through the docs site and didn't see how to use that option

UPDATE

Found browser.ignoreSyncronization = true;

Will try that

erikdonohoo commented 9 years ago

My onPrepare looks like this now...

onPrepare: function () {
        // This will navigate to the project and sign on through lds auth
        browser.ignoreSyncronization = true;
        browser.get('/');
        browser.sleep(250);
        var loginUsername = browser.driver.findElement(by.id('IDToken1'));
        loginUsername.sendKeys(browser.params.login.username);
        var loginPassword = browser.driver.findElement(by.id('IDToken2'));
        loginPassword.sendKeys(browser.params.login.password);
        var signInButton = browser.driver.findElement(by.name('Login.Submit'));
        signInButton.click();
        browser.sleep(1000);
        browser.ignoreSyncronization = false;
    }

Still having same issue

JonDuffy commented 9 years ago

What is the error message that you get?

erikdonohoo commented 9 years ago

screenshot 2015-04-28 10 36 45

erikdonohoo commented 9 years ago

Our onPrepare is sending the app to / to trigger the app to redirect to authenticate. After clicking sign in from the onPrepare code, it goes back to the app and runs the tests, being fully authenticated. This worked on 1.8.0. All I have to change is the version and it works again.

JonDuffy commented 9 years ago

When the tests run do you see the login happen? and / or do you see the login screen appear?

erikdonohoo commented 9 years ago

Yes, the login screen appears, and then the window dies immediately with that error.

felixbillon commented 9 years ago

+1 Same issue,

onPrepare function is not execute correctly before my specs. My code works on protractor 1.8.0 but not with 2.0.0.

felixbillon commented 9 years ago

Something was missing in my conf file, sorry.

erikdonohoo commented 9 years ago

@felixbillon what was missing?

felixbillon commented 9 years ago

I change my html and forgot to change 'rootElement' in my protractor file conf. Not related to your issue.

sjelin commented 9 years ago

It's spelled ignoreSynchronization. Let me know if that fixes the problem

juliemr commented 9 years ago

Closing stale issues. Please open a new issue if you feel there is still a general bug.

antoniodimaio commented 8 years ago

having the same, is this because I am bootstrapping angularjs manually (no ng-app in page)?