Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabling flow control generates error: "Error while waiting for Protractor to sync with the page: "both angularJS testability and angular testability are undefined." #5150

Open
glemiere opened this issue Feb 12, 2019 · 5 comments

Comments

@glemiere
Copy link

glemiere commented Feb 12, 2019

Here is my config:

exports.config = {
  capabilities: {
    'browserName': 'chrome'
  },
  seleniumAddress: 'http://localhost:4444/wd/hub',
  framework: 'jasmine',
  specs: ['test.spec.ts'],
  SELENIUM_PROMISE_MANAGER: false,
  jasmineNodeOpts: {
    defaultTimeoutInterval: 30000
  },	
  beforeLaunch: function () {
    require('ts-node/register')
  }
};

And here is my simple test:

import {
    browser,
    ExpectedConditions,
    $
} from 'protractor';

describe('When user click \"Test\" button', async () => {
  beforeAll(async () => {
    expect(browser.getCurrentUrl()).toContain('myawesomewebsite');
  });

  it ("should click the button", async () => {
    var button = $(".button");
    button.click();
  });
});

This throws me the following error:

UnhandledPromiseRejectionWarning: Error: Error while waiting for Protractor to sync with the page: "both angularJS testability and angular testability are undefined.  This could be either because this is a non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping.  See http://git.io/v4gXM for details"

However it works great if I set SELENIUM_PROMISE_MANAGER to true.

According to the simplicity of this test, this seems to be a bug with protractor itself, am I wrong?

@CrispusDH
Copy link
Contributor

you have to add .waitForAngularEnabled(false) in the onPrepare property of protractor.conf:

onPrepare: async () => {
    await browser.waitForAngularEnabled(false);
    ...
}

@glemiere
Copy link
Author

@CrispusDH indeed this makes the error go away, but then protractor does not find the Element b/c it does not wait for Angular. Is this supposed to happen ?

@CrispusDH
Copy link
Contributor

You should use explicit waiters before interaction with element. For example before click wait that element is clickable. It might be better to find answer how it implement in Stack Overflow.

@Kurt29
Copy link

Kurt29 commented Apr 21, 2019

you have to add .waitForAngularEnabled(false) in the onPrepare property of protractor.conf:

onPrepare: async () => {
    await browser.waitForAngularEnabled(false);
    ...
}

is that really the intended behavior?
I thought it should be more intuitive to use async/await and more stable.

@Cornchips007
Copy link

@Kurt29 is the page per chance Unicode encoded somehow and has the setting in the head?

I'm sitting with the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants