synpress icon indicating copy to clipboard operation
synpress copied to clipboard

tests hang up with SIGTRAP error message in the browser and core dump

Open ivelin opened this issue 3 years ago • 13 comments

Seems related to a known cypress issue.

This is the test that leads to core dump and SIGTRAP error in the browser. This is the line that triggers it.

    it(`Should proceed to contract write via wallet`, () => {
       cy.get('input[name="goalTitle"]').type('Complete Milestone 10')
       cy.get('input[name="deadline"]').type('2222-12-31')
       cy.get('[data-cy="submit-button"]').click()          <<<<<<<< causes synpress/cypress to hang up

https://user-images.githubusercontent.com/2234901/186439294-7aeae609-d576-4743-b265-5caa60a3b903.mov

ivelin avatar Aug 24 '22 14:08 ivelin

It appears that after wagmi useContractWrite is initiated, metamask stops communicating with wagmi, while the dapp keeps leaking memory while waiting until its browser tab crashes with SIGTERM and core dump.

This issue does not occur when testing the same flow manually.

ivelin avatar Aug 24 '22 20:08 ivelin

I'm facing the exact same issue. Tested it with different browsers and it's all the same crash.

JohnSmithyy avatar Aug 28 '22 16:08 JohnSmithyy

Also added a discussion in the wagmi repo to see if it can be resolved on their end: https://github.com/wagmi-dev/wagmi/discussions/897

JohnSmithyy avatar Aug 28 '22 20:08 JohnSmithyy

Upon further testing, I've discovered that my issue actually stems from the cy.acceptMetamaskAccess().should("be.true") command. My chrome crashes while waiting for this to be true for some reason. I suspect this has something to do with wagmi under the hood since it only crashes on pages where wagmi is loaded. Other pages without any wagmi code, work just fine.

JohnSmithyy avatar Aug 31 '22 00:08 JohnSmithyy

My error log:

We stopped running your tests because a plugin crashed.
 
Your pluginsFile threw an error from: /home/pootpoot/Desktop/dapp/FrontEnd/node_modules/@synthetixio/synpress/plugins/index.js
 
Error: Execution Context has already been set.
    at assert (/home/pootpoot/Desktop/dapp/FrontEnd/node_modules/puppeteer-core/lib/cjs/puppeteer/common/assert.js:26:15)
    at DOMWorld.<anonymous> (/home/pootpoot/Desktop/dapp/FrontEnd/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.js:63:36)
    at step (/home/pootpoot/Desktop/dapp/FrontEnd/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.js:33:23)
    at Object.next (/home/pootpoot/Desktop/dapp/FrontEnd/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.js:14:53)
    at /home/pootpoot/Desktop/dapp/FrontEnd/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/home/pootpoot/Desktop/dapp/FrontEnd/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.js:4:12)
    at DOMWorld._setContext (/home/pootpoot/Desktop/dapp/FrontEnd/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.js:107:16)
    at FrameManager._onExecutionContextCreated (/home/pootpoot/Desktop/dapp/FrontEnd/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FrameManager.js:343:19)
    at /home/pootpoot/Desktop/dapp/FrontEnd/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FrameManager.js:77:18
    at /home/pootpoot/Desktop/dapp/FrontEnd/node_modules/puppeteer-core/lib/cjs/vendor/mitt/src/index.js:51:62
    at Array.map (<anonymous>)
    at Object.emit (/home/pootpoot/Desktop/dapp/FrontEnd/node_modules/puppeteer-core/lib/cjs/vendor/mitt/src/index.js:51:43)
    at CDPSession.EventEmitter.emit (/home/pootpoot/Desktop/dapp/FrontEnd/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EventEmitter.js:72:22)
    at CDPSession._onMessage (/home/pootpoot/Desktop/dapp/FrontEnd/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:249:18)
    at Connection.<anonymous> (/home/pootpoot/Desktop/dapp/FrontEnd/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:117:25)
    at step (/home/pootpoot/Desktop/dapp/FrontEnd/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:48:23)
    at Object.next (/home/pootpoot/Desktop/dapp/FrontEnd/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:29:53)
    at /home/pootpoot/Desktop/dapp/FrontEnd/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:23:71
    at new Promise (<anonymous>)
    at __awaiter (/home/pootpoot/Desktop/dapp/FrontEnd/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:19:12)
    at Connection._onMessage (/home/pootpoot/Desktop/dapp/FrontEnd/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:147:16)

@drptbl

JohnSmithyy avatar Aug 31 '22 01:08 JohnSmithyy

@ivelin can you retry with @synthetixio/[email protected]?

drptbl avatar Sep 06 '22 22:09 drptbl

cc @JohnSmithyy

drptbl avatar Sep 06 '22 22:09 drptbl

@drptbl

Not sure what changed but now it cannot pick up the synpress.json file for whatever reason.

My log:

env-cmd -f .env npx synpress run -b firefox -cf tests/e2e/synpress.json

Could not find a Cypress configuration file.

We looked but did not find a synpress.json file in this folder: /home/pootpoot/Desktop/dapp/Frontend/tests/e2e
Failed to run Cypress
Could not find Cypress test run results

This is what my synpress.json looks like and it does exist in the directory it's looking.

{
  "baseUrl": "http://localhost:3000",
  "userAgent": "synpress",
  "retries": { "runMode": 0, "openMode": 0 },
  "integrationFolder": "tests/e2e/specs",
  "screenshotsFolder": "screenshots",
  "videosFolder": "videos",
  "video": true,
  "chromeWebSecurity": true,
  "viewportWidth": 1366,
  "viewportHeight": 850,
  "component": {
    "componentFolder": ".",
    "testFiles": "**/*spec.{js,jsx,ts,tsx}"
  },
  "env": {
    "coverage": false
  },
  "defaultCommandTimeout": 30000,
  "pageLoadTimeout": 30000,
  "requestTimeout": 30000,
  "supportFile": "tests/e2e/support.js"
}

JohnSmithyy avatar Sep 06 '22 23:09 JohnSmithyy

Using the synpress.config.js from the repo itself: https://github.com/Synthetixio/synpress/blob/dev/synpress.config.js

gives the following error:

Your configFile is invalid: /home/pootpoot/Desktop/dapp/Frontend/tests/e2e/synpress.config.js

It threw an error when required, check the stack trace below:

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/pootpoot/Desktop/dapp/Frontend/node_modules/colorette/index.js from /home/pootpoot/Desktop/dapp/Frontend/node_modules/listr2/dist/utils/colorette.js not supported.
Instead change the require of index.js in /home/pootpoot/Desktop/dapp/Frontend/node_modules/listr2/dist/utils/colorette.js to a dynamic import() which is available in all CommonJS modules.
    at require.extensions.<computed> [as .js] (/home/pootpoot/.cache/Cypress/10.7.0/Cypress/resources/app/node_modules/ts-node/dist/index.js:785:20)
    at Object.<anonymous> (/home/pootpoot/Desktop/dapp/Frontend/node_modules/listr2/dist/utils/colorette.js:4:21)
    at require.extensions.<computed> [as .js] (/home/pootpoot/.cache/Cypress/10.7.0/Cypress/resources/app/node_modules/ts-node/dist/index.js:785:20)
    at Object.<anonymous> (/home/pootpoot/Desktop/dapp/Frontend/node_modules/listr2/dist/renderer/default.renderer.js:8:21)
    at require.extensions.<computed> [as .js] (/home/pootpoot/.cache/Cypress/10.7.0/Cypress/resources/app/node_modules/ts-node/dist/index.js:785:20)
    at Object.<anonymous> (/home/pootpoot/Desktop/dapp/Frontend/node_modules/listr2/dist/utils/renderer.js:4:28)
    at require.extensions.<computed> [as .js] (/home/pootpoot/.cache/Cypress/10.7.0/Cypress/resources/app/node_modules/ts-node/dist/index.js:785:20)
    at Object.<anonymous> (/home/pootpoot/Desktop/dapp/Frontend/node_modules/listr2/dist/lib/task.js:11:20)
    at require.extensions.<computed> [as .js] (/home/pootpoot/.cache/Cypress/10.7.0/Cypress/resources/app/node_modules/ts-node/dist/index.js:785:20)
    at Object.<anonymous> (/home/pootpoot/Desktop/dapp/Frontend/node_modules/listr2/dist/listr.js:7:16)
    at require.extensions.<computed> [as .js] (/home/pootpoot/.cache/Cypress/10.7.0/Cypress/resources/app/node_modules/ts-node/dist/index.js:785:20)
    at Object.<anonymous> (/home/pootpoot/Desktop/dapp/Frontend/node_modules/listr2/dist/index.js:13:14)
    at require.extensions.<computed> [as .js] (/home/pootpoot/.cache/Cypress/10.7.0/Cypress/resources/app/node_modules/ts-node/dist/index.js:785:20)
    at Object.<anonymous> (/home/pootpoot/Desktop/dapp/Frontend/node_modules/cypress/lib/tasks/verify.js:9:5)
    at require.extensions.<computed> [as .js] (/home/pootpoot/.cache/Cypress/10.7.0/Cypress/resources/app/node_modules/ts-node/dist/index.js:785:20)
    at Object.<anonymous> (/home/pootpoot/Desktop/dapp/Frontend/node_modules/cypress/lib/exec/spawn.js:23:16)
    at require.extensions.<computed> [as .js] (/home/pootpoot/.cache/Cypress/10.7.0/Cypress/resources/app/node_modules/ts-node/dist/index.js:785:20)
    at Object.<anonymous> (/home/pootpoot/Desktop/dapp/Frontend/node_modules/cypress/lib/exec/open.js:7:15)
    at require.extensions.<computed> [as .js] (/home/pootpoot/.cache/Cypress/10.7.0/Cypress/resources/app/node_modules/ts-node/dist/index.js:785:20)
    at Object.<anonymous> (/home/pootpoot/Desktop/dapp/Frontend/node_modules/cypress/lib/cypress.js:10:14)
    at require.extensions.<computed> [as .js] (/home/pootpoot/.cache/Cypress/10.7.0/Cypress/resources/app/node_modules/ts-node/dist/index.js:785:20)
    at Object.<anonymous> (/home/pootpoot/Desktop/dapp/Frontend/node_modules/cypress/index.js:35:22)
    at require.extensions.<computed> [as .js] (/home/pootpoot/.cache/Cypress/10.7.0/Cypress/resources/app/node_modules/ts-node/dist/index.js:785:20)
    at Object.<anonymous> (/home/pootpoot/Desktop/dapp/Frontend/tests/e2e/synpress.config.js:1:20)
    at m._compile (/home/pootpoot/.cache/Cypress/10.7.0/Cypress/resources/app/node_modules/ts-node/dist/index.js:791:29)
    at require.extensions.<computed> [as .js] (/home/pootpoot/.cache/Cypress/10.7.0/Cypress/resources/app/node_modules/ts-node/dist/index.js:793:16)
    at async Promise.all (index 0)
    at async loadFile (/home/pootpoot/.cache/Cypress/10.7.0/Cypress/resources/app/node_modules/@packages/server/lib/plugins/child/run_require_async_child.js:106:14)
    at async EventEmitter.<anonymous> (/home/pootpoot/.cache/Cypress/10.7.0/Cypress/resources/app/node_modules/@packages/server/lib/plugins/child/run_require_async_child.js:116:32)
Failed to run Cypress
Could not find Cypress test run results

JohnSmithyy avatar Sep 06 '22 23:09 JohnSmithyy

Not sure what I did but got it working. The tests run however the same issue persists as detailed earlier: @drptbl

It appears that after wagmi useContractWrite is initiated, metamask stops communicating with wagmi, while the dapp keeps leaking memory while waiting until its browser tab crashes with SIGTERM and core dump.

This issue does not occur when testing the same flow manually.

JohnSmithyy avatar Sep 06 '22 23:09 JohnSmithyy

@ivelin can you retry with @synthetixio/[email protected]?

Yes, definitely would like to try that with 2.0.1. I am traveling for MCon this week. Will update here as soon as I settle down and test.

ivelin avatar Sep 07 '22 01:09 ivelin

@ivelin can you retry with @synthetixio/[email protected]?

Ok, I just retried and still resulting in core dumps. The video recording is a little different this time. See attached.

With synpress 1.0.2 it appeared that wagmi contractWrite hook was not communicating back with the app. However with synpress 2.0.1 the app pop-up is updating which is evidence that contractWrite is talking to the app. This time appears that synpress is unable to interact with metamask.

The easiest way to reproduce is to open this gitpod environment:

https://gitpod.io/#https://github.com/SporosDAO/sweat-token/pull/134

then

cd e2e-tests
yarn test --spec "tests/e2e/specs/project-tribute-spec.js"

The command will run the first 3 checks quickly and then hang up on the 4th here:

cy.rejectMetamaskTransaction()

The behavior is similar if I replace rejectMetamaskTransaction() with

cy.confirmMetamaskTransaction()

Screen Shot 2022-09-06 at 9 03 07 PM

This video is with reject tx:

https://user-images.githubusercontent.com/2234901/188772198-10047eae-7844-435d-b664-ab0b4dae75e9.mp4

This video is with confirm tx:

https://user-images.githubusercontent.com/2234901/188773534-ec66cc9c-7e96-459a-be0f-aee411a4c202.mp4

ivelin avatar Sep 07 '22 02:09 ivelin

Synpress 2.2.0 test results

I tested the specs with synpress 2.2.0. The specs now error earlier on switchMetamaskAccount and disconnectMetamaskWallet. Details below:

Dev Environment

PR branch: https://github.com/SporosDAO/sweat-token/pull/135

To launch in Gitpod (Codespaces but better :) open this link: https://gitpod.io/#https://github.com/SporosDAO/sweat-token/pull/135

home-spec.js

https://github.com/ivelin/sweat-token/blob/test-synpress220/e2e-tests/tests/e2e/specs/home-spec.js

synpress-run-home-spec.log

https://user-images.githubusercontent.com/2234901/189711017-3438cd81-a03e-4e09-aef9-60835b4b728c.mp4

project-tribute-spec.js

https://github.com/ivelin/sweat-token/blob/test-synpress220/e2e-tests/tests/e2e/specs/project-tribute-spec.js

synpress-run-project-tribute-spec.log

https://user-images.githubusercontent.com/2234901/189711103-8d59fffa-80c6-44be-b5c0-c87384c337fb.mp4

ivelin avatar Sep 12 '22 16:09 ivelin

This issue is not related to synpress, but cypress and chromium itself.

You can follow original issue here and find some workarounds until it's fixed in next Chrome version (107): https://github.com/cypress-io/cypress/issues/23391#issuecomment-1266895628

One of the workarounds is to use older version of Chrome until it's fixed in new one. Not perfect, I know. However I went ahead and downgraded Chrome inside docker-e2e, so if you're using this container, feel free to try and run your tests again to see if it fixes your issue.

drptbl avatar Oct 07 '22 13:10 drptbl

This issue is not related to synpress, but cypress and chromium itself.

You can follow original issue here and find some workarounds until it's fixed in next Chrome version (107): cypress-io/cypress#23391 (comment)

One of the workarounds is to use older version of Chrome until it's fixed in new one. Not perfect, I know. However I went ahead and downgraded Chrome inside docker-e2e, so if you're using this container, feel free to try and run your tests again to see if it fixes your issue.

Thank you for tracking this down. Can you please link to the exact docker-e2e image with the patch?

ivelin avatar Oct 07 '22 13:10 ivelin

This issue is not related to synpress, but cypress and chromium itself. You can follow original issue here and find some workarounds until it's fixed in next Chrome version (107): cypress-io/cypress#23391 (comment) One of the workarounds is to use older version of Chrome until it's fixed in new one. Not perfect, I know. However I went ahead and downgraded Chrome inside docker-e2e, so if you're using this container, feel free to try and run your tests again to see if it fixes your issue.

Thank you for tracking this down. Can you please link to the exact docker-e2e image with the patch?

https://github.com/Synthetixio/docker-e2e https://hub.docker.com/r/synthetixio/docker-e2e

Fix is applied on these images: synthetixio/docker-e2e:14.20-debian synthetixio/docker-e2e:14.20-ubuntu synthetixio/docker-e2e:16.17-debian synthetixio/docker-e2e:16.17-ubuntu synthetixio/docker-e2e:18.8-debian synthetixio/docker-e2e:18.8-ubuntu

drptbl avatar Oct 07 '22 14:10 drptbl

Awesome! Thank you! Will test right after devcon.

On Fri, Oct 7, 2022 at 9:23 AM drptbl @.***> wrote:

This issue is not related to synpress, but cypress and chromium itself. You can follow original issue here and find some workarounds until it's fixed in next Chrome version (107): cypress-io/cypress#23391 (comment) https://github.com/cypress-io/cypress/issues/23391#issuecomment-1266895628 One of the workarounds is to use older version of Chrome until it's fixed in new one. Not perfect, I know. However I went ahead and downgraded Chrome inside docker-e2e, so if you're using this container, feel free to try and run your tests again to see if it fixes your issue.

Thank you for tracking this down. Can you please link to the exact docker-e2e image with the patch?

https://github.com/Synthetixio/docker-e2e

synthetixio/docker-e2e:14.20-debian synthetixio/docker-e2e:14.20-ubuntu synthetixio/docker-e2e:16.17-debian synthetixio/docker-e2e:16.17-ubuntu synthetixio/docker-e2e:18.8-debian synthetixio/docker-e2e:18.8-ubuntu

— Reply to this email directly, view it on GitHub https://github.com/Synthetixio/synpress/issues/472#issuecomment-1271664761, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARBUFJYSSA5QVAOKBMJLLLWCAW6FANCNFSM57PPJWNA . You are receiving this because you were mentioned.Message ID: @.***>

ivelin avatar Oct 07 '22 14:10 ivelin