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

Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL #2963

Closed
tianyirao opened this issue Feb 19, 2016 · 26 comments

Comments

@tianyirao
Copy link

i use the example from "http://www.protractortest.org/#/tutorial"

// spec.js
describe('Protractor Demo App', function() {
  it('should have a title', function() {
    browser.get('http://juliemr.github.io/protractor-demo/');

    expect(browser.getTitle()).toEqual('Super Calculator');
  });
});

// conf.js
exports.config = {
  framework: 'jasmine',
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['spec.js']
}

Now run the test with

protractor conf.js

Then the console display:
image

@sallojusuresh
Copy link

You can find solution in below post: just go through whole post.

#2941 (comment)

@NickTomlin
Copy link
Contributor

Are you able to successfully start selenium? What happens if you use directConnect?

@juliemr
Copy link
Member

juliemr commented Apr 25, 2016

Closing stale issues.

@juliemr juliemr closed this as completed Apr 25, 2016
@dayanamcc
Copy link

dayanamcc commented Oct 25, 2016

im having same problem and the other post dont work for me.
@juliemr any solution for this? i tried allScriptsTimeout: 900000 but this dont solve the problem.

@capsule5
Copy link

Doesn't work for me either. increase defaultTimeoutInterval doesn't solve it

@annienguyen16
Copy link

@juliemr I'm having the same problem and increasing ScriptsTimeout does not work for me. Do you have any solution for this? Thank you.

@reddynr
Copy link

reddynr commented Dec 6, 2016

Hi All,

I am running a test case in protractor getting timed out error. Here is the details. Please advice. Thank you

Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.

sample_spec.js

describe('Mcac App testing', function() {
browser.get('http://localhost:3000/integrated/myWeb.html');
beforeEach(function (done) {
window.jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
setTimeout(function () {
console.log('inside timeout');
done();
}, 50000);
});
//browser.get(' http://localhost:3000/integrated/myWeb.html');
// browser.get('http://localhost:3000/integrated/myWeb.html').then(function() {
it('Email Address Validation', function()
{

        element(by.model('ctrl.formData.emailAddress')).sendKeys('').clear();
        element(by.model('ctrl.formData.emailAddress')).sendKeys('nancy@abc.com');
        element(by.model('ctrl.formData.emailAddress')).getAttribute('value').then(function (value) {
            expect(value).toEqual('narendra@abc.com');
        });


}, 10000);

// element(by.xpath("//button[text()='Confirm']")).click();
browser.sleep(5000);

});

config.js

// An example configuration file.
exports.config = {
directConnect: true,

// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},

// Framework to use. Jasmine is recommended.
framework: 'jasmine',

// Spec patterns are relative to the current working directory when
// protractor is called.
// specs: ['example_spec.js'],
//specs: ['mcac_spec.js'],
//specs: ['mcac_spec_mobile.js'],
specs: ['mcac_online.js'],
// Options to be passed to Jasmine.
jasmineNodeOpts: {
defaultTimeoutInterval: 5000
}

};

any help much appreciated.

@amyboyd
Copy link

amyboyd commented Dec 15, 2016

I had this issue and it was because of a repeating $timeout ($timeout blocks Protractor, while $interval doesn't).

To find the repeating $timeout, you can use Protractor's element explorer, for example:

$ protractor config/protractor.js --elementExplorer
Starting debugger agent.
Debugger listening on port 5858
> var body = element(by.css('body'))
> body.isPresent()
ScriptTimeoutError: Timed out waiting for asynchronous Angular tasks to finish after 15 seconds. This may be because the current page is not an Angular application. Please see the FAQ for more details: https://github.com/angular/protractor/blob/master/docs/timeouts.md#waiting-for-angular
While waiting for element with locator - Locator: By(css selector, body). 
The following tasks were pending:
 - $timeout: function () {
        // ......
    }

@reddynr
Copy link

reddynr commented Dec 15, 2016 via email

@Shibashis2016
Copy link

Hi All,

I am running a test case in protractor getting timed out error. Here is the details. Please advice. Thank you

Failed: Timed out waiting for asynchronous Angular tasks to finish after 30 seconds. This may be because the current page is not an Angular application.

@suswari
Copy link

suswari commented Apr 13, 2017

@sallojusuresh, the below solution worked.
jasmineNodeOpts: {
defaultTimeoutInterval: 2500000
},
Question - When we can set a default time as above, where comes the use of setTimeout function in 'beforeEach' and done callbacks in 'it'. Any idea?

brianritchie1312 added a commit to icatproject/topcat that referenced this issue Dec 12, 2017
The (sole!) Protractor e2e test was failing with a timeout, but
otherwise OK. Following a suggestion in
<angular/protractor#2963>, set a large default
timeout interval. The test now passes (at least, in vagrant development
env).
@zahiruldu
Copy link

zahiruldu commented Mar 12, 2018

I have fixed by the following way

 var originalTimeout;

    beforeEach(function() {
        originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
        jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
    });

    afterEach(function() {
      jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
    });

@reddynr
Copy link

reddynr commented Mar 12, 2018 via email

@stemkar123
Copy link

stemkar123 commented May 16, 2018

@NickTomlin You just made my day :) I have used directconnect & worked. It would be great if you shade some light on what directconnect actaully does

@AFigueroa
Copy link

In my case, this error was caused by improper use of "fixture.detectChanges()" It seems this method is a event listener (async) which will only respond a callback when changes are detected. If no changes are detected it will not invoke the callback, resulting in a timeout error. Hope this helps :)

@satyendrabhan
Copy link

@juliemr Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL. this error coming in my test again n again i used before each, after each, browser.sleep, increased the jasmine timeout iterval upto 100000. but my code is not run so please suggest me what could I do.

@binhvtle
Copy link

I got this issue and cannot resolve while increased the jasmine timeout up to 300000. So pls suggest me what should I do for it.

@CrispusDH
Copy link
Contributor

Could you provide simple example?

@abhikhan25
Copy link

Solution to this is, if you are trying to write tests for non-angular app, goto runner.js at node_modules/protractor/built
Edit line # 210 to waitForAngularEnabled: false //true

@juliemr a suggestion to make this setting configurable.

@CrispusDH
Copy link
Contributor

you could do it in onPrepare() section:

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

@hermanfransen
Copy link

I got the same problem, but the solutions provided here did not work for me. If you have time, please have a look to my question on Stack Overflow. The problem can easily be reproduced and I have a repo. I guess it is possible a bug.
https://stackoverflow.com/questions/53786401/error-debugging-protractor-with-node-8-async-await-and-angular-6

@gshahin
Copy link

gshahin commented Aug 16, 2019

Expected false to equal true Because: Error logs present in console:Entry {
level: Level { name_: 'SEVERE', value_: 1000 },
message:
"ERROR" Error: formGroup expects a FormGroup instance. Please pass one in.\n\n Example:\n\n \n <div [formGroup]="myGroup">\n \n \n\n In your class:\n\n this.myGroup = new FormGroup({\n firstName: new FormControl()\n });\n at Function.e.missingFormException

@gshahin
Copy link

gshahin commented Aug 16, 2019

getting issue while click on pop up button , any solution?

@lightdi
Copy link

lightdi commented Nov 21, 2019

I has a similar problem with post and I have solved my problem adding HttpClientModule on imports:

beforeEach(() => {

TestBed.configureTestingModule({

    declarations: [],

    providers: [ CookieService, HttpClient],  

    imports: [HttpClientModule],
});

});

@sanathfp
Copy link

I has a similar problem with post and I have solved my problem adding HttpClientModule on imports:

beforeEach(() => {

TestBed.configureTestingModule({

    declarations: [],

    providers: [ CookieService, HttpClient],  

    imports: [HttpClientModule],
});

});

I personally had problems importing the HttpClientModule inside a testbed. It tries running your APIs in your unit tests and as a result, they fail. The right approach would be to use HttpClientTestingModule

@anilshivanna1919
Copy link

@sallojusuresh, the below solution worked.
jasmineNodeOpts: {
defaultTimeoutInterval: 2500000
},
Question - When we can set a default time as above, where comes the use of setTimeout function in 'beforeEach' and done callbacks in 'it'. Any idea?

This is best solution just paste this piece of code in ur confing file it should resolve ur problem.

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

No branches or pull requests