Moving to offline mode using cypress returned a promise that never resolved

Viewed 464

Using official guideline from cypress how to go in offline mode

https://www.cypress.io/blog/2020/11/12/testing-application-in-offline-network-mode/

I got this error =>

Your callback function returned a promise that never resolved.

The callback function was:

() => {
    return Cypress.automation('remote:debugger:protocol', {
      command: 'Network.emulateNetworkConditions',
      params: {
        offline: true,
        latency: -1,
        downloadThroughput: -1,
        uploadThroughput: -1
      }
    });
  }

Maybe someone can help me?

2 Answers

just remove 'return', the code will look like this:

() => {
     Cypress.automation('remote:debugger:protocol', {
      command: 'Network.emulateNetworkConditions',
      params: {
        offline: true,
        latency: -1,
        downloadThroughput: -1,
        uploadThroughput: -1
      }
    });
  }
Related