Jasmine specification timeout when running Protractor tests on a remote selenium server

I have Protractor tests that work fine locally (directConnect: true), but when I try to run them on a remote Selenium server (Grid), I always get the following message.

A Jasmine spec timed out. Resetting the WebDriver Control Flow. 

Looking for errors, Message and Stack display the following for all my test cases:

 Message: Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL. Stack: Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL. at Timer.listOnTimeout (timers.js:92:15) 

I tried a number of things, such as increasing the jasmine timeout interval, adding earlier timeouts such as getPageTimeout and allScriptsTimeout to conf, but it still causes a jasmine timeout error. The following error is displayed in the log:

 00:03:18.328 INFO - Done: [execute async script: try { return (function (rootSelector, ng12Hybrid, callback) { var el = document.querySelector(rootSelector); try { if (!ng12Hybrid && window.getAngularTestability) { window.getAngularTestability(el).whenStable(callback); return; } if (!window.angular) { throw new Error('window.angular is 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\ ' + 'bootstrapping. See http://git.io/v4gXM for details'); } if (angular.getTestability) { angular.getTestability(el).whenStable(callback); } else { if (!angular.element(el).injector()) { throw new Error('root element (' + rootSelector + ') has no injector.' + ' this may mean it is not inside ng-app.'); } angular.element(el).injector().get('$browser'). notifyWhenNoOutstandingRequests(callback); } } catch (err) { callback(err.message); } }).apply(this, arguments); } catch(e) { throw (e instanceof Error) ? e : new Error(e); }, [body, false]]) 

I know for sure that my application is angular and it runs successfully when launched locally. I tried setting

 browser.ignoreSynchronization = true 

and also set

 rootElement='html#ng-app' 

in conf (bc my ng-app is not in the body, but rather in the html tag). The frame is set to jasmine, although I tried jasmine2, but none of them have any meaning. On a remote server, I can start firefox, and the user interface shows me a started firefox session. However, he just sits there until a timeout occurs. Any input would be appreciated!

+7
angularjs selenium selenium-grid selenium-rc protractor
source share
1 answer

Jasmine should know that it starts the asynchronous process and when this process should be completed (to continue any other test that you can run).

This is obtained by passing done callback to the Jasmine asynchronous process method and calling done() to resolve the async operation.

If you do not call done() , Jasmine shows a timeout error. I think this should solve your problem.

Read more here: Mocking ngResource in Angular unit tests .

Hope this helps!

+2
source share

All Articles