Synthetixio / synpress

Synpress is e2e testing framework based on Cypress.io and playwright with support for metamask.
https://synpress.io
609 stars 194 forks source link

`cy.task('setupMetamask')` failed with the following error: > Cannot read properties of undefined (reading 'waitForTimeout') #370

Open dev2021-ctrl opened 2 years ago

dev2021-ctrl commented 2 years ago

My test script is below.the issue is random so sometimes the tests are passed and sometimes it fails. I am running on ubuntu with latetst verion of synpress. I can share the synpress json file fi needed. Please advise anyone .A bit urgent.

describe('Metamask', () => { context('Test11 commands', () => {

it(`Try to connect to website`, () => {
  cy.visit('/');
  cy.contains('Welcome')

});

}); });

Below are the error logs:

1) "before all" hook for "Try to connect to website"

0 passing (379ms) 1 failing

1) Metamask Test11 commands "before all" hook for "Try to connect to website": CypressError: cy.task('setupMetamask') failed with the following error:

Cannot read properties of undefined (reading 'waitForTimeout')

https://on.cypress.io/api/task

Because this error occurred during a before all hook we are skipping all of the remaining tests. at http://localhost/__cypress/runner/cypress_runner.js:161147:78 at tryCatcher (http://localhost/__cypress/runner/cypress_runner.js:13196:23) at Promise._settlePromiseFromHandler (http://localhost/__cypress/runner/cypress_runner.js:11131:31) at Promise._settlePromise (http://localhost/__cypress/runner/cypress_runner.js:11188:18) at Promise._settlePromise0 (http://localhost/__cypress/runner/cypress_runner.js:11233:10) at Promise._settlePromises (http://localhost/__cypress/runner/cypress_runner.js:11309:18) at _drainQueueStep (http://localhost/__cypress/runner/cypress_runner.js:7903:12) at _drainQueue (http://localhost/__cypress/runner/cypress_runner.js:7896:9) at Async.../../node_modules/bluebird/js/release/async.js.Async._drainQueues (http://localhost/__cypress/runner/cypress_runner.js:7912:5) at Async.drainQueues (http://localhost/__cypress/runner/cypress_runner.js:7782:14)

From Node.js Internals: TypeError: Cannot read properties of undefined (reading 'waitForTimeout') at Object.initialSetup (/main/node_modules/@synthetixio/synpress/commands/metamask.js:557:37) at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5) at setupMetamask (/main/node_modules/@synthetixio/synpress/plugins/index.js:211:7)

kwdikeman commented 2 years ago

We actually commented out the before all call in the support/index.js file. It seems to still go through the setup and unlocks.

pcardosolei commented 2 years ago

what command are you running?

Eveelin commented 1 year ago

I have the same issue, using synpress open command

Christopher-Stevers commented 1 year ago

I have the same issue as well, only when I use synpress open.

quiet-node commented 1 week ago

@drptbl Hello this seems to happen again

I use it in a support.js file import '@synthetixio/synpress/support/index';

And I got this same error image

Currently using latest synpress "@synthetixio/synpress": "^3.7.3",