Timed out waiting for Protractor to synchronize wi

2019-06-13 19:09发布

问题:

I have a login form, and I want to set input to both inputs, but the test doesn't go through in Chrome, Safari, but with Firefox it works.

Initially I have a $http request and it is done, and as I know, protractor continues when $http is done, so this should not be the issue, or is it?

Error:

Uncaught exception: Timed out waiting for Protractor to synchronise with the page after 11 seconds. Please see https://github.com/angular/protractor/blob/master/docs/faq.md

This is my test:

describe('ADM login page', function () {
	beforeEach(function () {
		browser.get('http://127.0.0.1:8383/v2');
	});

	it('login', function () {
		var username = element(by.css('div.e2e-adm-username-input input.Input-Holder')),
			password = element(by.css('div.e2e-adm-password-input input.Input-Holder'));

		username.sendKeys('test');
		expect(username.getText()).toBe('test');

		password.click();

		password.sendKeys(',,test');
		expect(password.getText()).toBe(',,test');

		element(by.css('div.Login-ActionHolder a.Big-Action')).click();
	});
});

回答1:

you could add allScriptsTimeout: milliseconds in protractor configuration file. I was having a $http request in the background that was taking too long.

exports.config = {
    ...
    allScriptsTimeout: 50000,
    ...
};