Francesco
Francesco

Reputation: 435

How to debug "Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL"?

I have a test that passes locally but it fail during Gitlab CI pipeline due to timeout error.

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

Which way can I go through to debug this? I tried to increase defaultTimeoutInterval to 240000 in protractor configuratoin file, but nothing has changed.

Test

describe('Test', () => {

    beforeAll(async () => {
        console.log('1) start beforeAll');
        await api_wrapper.generateAllLatestMeasureToPatient(patient); // it breaks here
        console.log('2) API calls completed'); // it never gets here
        await page.navigateTo();
        console.log('3) end beforeAll');
    });

    it('should display map, edit fence button and toggle fence button', async () => {
        console.log('4) start test');
        // ...
    });

});

In generateAllLatestMeasureToPatient() I do ten HTTP POST requests to API endpoint. In CI it stops at fourth, locally works fine.

Console output

1) start beforeAll
4) start test

Upvotes: 1

Views: 418

Answers (1)

ssharma
ssharma

Reputation: 941

I use 2 types of timeouts :

defaultTimeoutInterval: 120000,

also in

exports.config = {
   allScriptsTimeout: 90000,
}

my test also used to timeout more in CI environment I started running them in headless mode with Browser window-size set and it really helped.

capabilities: {
    'browserName': 'chrome'
  },
    'chromeOptions': {
    'args': ["--headless", "--disable-gpu", "--window-size=1920,1080"]
    },
  }

Upvotes: 0

Related Questions