【问题标题】:How to debug "Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL"?如何调试“错误:超时 - 在 jasmine.DEFAULT_TIMEOUT_INTERVAL 指定的超时内未调用异步回调”?
【发布时间】:2020-05-28 06:05:49
【问题描述】:

我有一个测试在本地通过,但在 Gitlab CI 管道期间由于超时错误而失败。

错误:超时 - 在 jasmine.DEFAULT_TIMEOUT_INTERVAL 指定的超时内未调用异步回调。

我可以通过哪种方式进行调试?我尝试在量角器配置文件中将defaultTimeoutInterval 增加到 240000,但没有任何改变。

测试

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');
        // ...
    });

});

generateAllLatestMeasureToPatient() 中,我向 API 端点发送了十个 HTTP POST 请求。在 CI 中它停在第四位,本地工作正常。

控制台输出

1) start beforeAll
4) start test

【问题讨论】:

  • 我会从 console.log 开始看看它挂在哪里

标签: jasmine protractor gitlab-ci angular-e2e


【解决方案1】:

我使用 2 种类型的超时:

defaultTimeoutInterval: 120000,

也在

exports.config = {
   allScriptsTimeout: 90000,
}

我的测试也曾经在 CI 环境中超时,我开始在设置浏览器窗口大小的无头模式下运行它们,这真的很有帮助。

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

【讨论】:

  • 感谢您的提示,但不幸的是错误仍然存​​在。
猜你喜欢
  • 2016-05-30
  • 1970-01-01
  • 1970-01-01
  • 2017-07-24
  • 2016-04-21
  • 2019-01-07
  • 1970-01-01
  • 2019-09-21
相关资源
最近更新 更多