polis icon indicating copy to clipboard operation
polis copied to clipboard

Fix flaky Cypress CI tests

Open metasoarous opened this issue 3 years ago • 6 comments

Our Cypress CI tests have been getting increasingly flaky of late:

https://github.com/compdemocracy/polis/pull/1341#discussion_r837944450 https://github.com/compdemocracy/polis/pull/1354#issuecomment-1094284857

They seem to sporadically pass, then fail in a random manner, making useless (or worse).

metasoarous avatar Apr 19 '22 05:04 metasoarous

FWIW, now the tests aren't even running at all because of a npm ci issue that I haven't been able to sort out.

https://github.com/compdemocracy/polis/runs/6072601477?check_suite_focus=true#step:10:32

metasoarous avatar Apr 19 '22 07:04 metasoarous

There are some notes on running the cypress tests locally here, which may be helpful:

https://github.com/compdemocracy/polis/wiki/Running-E2E-tests-locally

There's also some steps which might be taken to run the workflows manually on a GitHub fork, if that proves easier.

https://github.com/compdemocracy/polis/pull/1341#discussion_r831463067

metasoarous avatar Apr 19 '22 20:04 metasoarous

What are the sporadic failures:

  1. emails.spec.js log proof.
    • log error:
      http://localhost:1080/email/all
      
      We attempted to make an http request to this URL but the request failed without a response.
      
      We received this error at the network level:
      
        > Error: connect ECONNREFUSED 127.0.0.1:1080
      
      -----------------------------------------------------------
      
      The request we sent was:
      
      Method: DELETE
      URL: http://localhost:1080/email/all
      
    • maybe helpful fix? https://stackoverflow.com/a/27601038/504018
  2. [others?]

patcon avatar Sep 06 '22 02:09 patcon

I'm also getting emails.spec.js errors on github but the tests pass locally. My logs:

Running:  polis/emails.spec.js                                                          (14 of 14)
  Emails

RangeError: Maximum call stack size exceeded

    at _deconstructPacket (/home/runner/.cache/Cypress/6.8.0/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/binary.js:21:28)

    at _deconstructPacket (/home/runner/.cache/Cypress/6.8.0/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/binary.js:40:32)

    at _deconstructPacket (/home/runner/.cache/Cypress/6.8.0/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/binary.js:40:32)

I'm not sure why it is a different error than what @patcon was getting.

SebastianRuan avatar Sep 07 '22 17:09 SebastianRuan

ooo that's a fun one. seems pretty general, but i don't recall seeing it elsewhere. If you have a sec, there should be a button to "re-run" on the logs page, and I'd be curious to know if it shows up again 🤔

patcon avatar Sep 07 '22 17:09 patcon

Potential fix over here: https://github.com/compdemocracy/polis/pull/1521

patcon avatar Sep 12 '22 04:09 patcon

@patcon, @metasoarous, @ballPointPenguin,

Hi all, I've recently retired and am planning to work on polis a lot more.

I am having my own problems with cypress in that I can't even run npm install in the e2e directory successfully.

m ERR! > [email protected] build
npm ERR! > rm -rf dist && tsc --project ./tsconfig-build.json
npm ERR! 
npm ERR! node_modules/@types/express-serve-static-core/index.d.ts(99,68): error TS1110: Type expected.

I've tried using both the edge and stable branches on OSX and amazon linux. I found a post suggesting to use a more recent version of Cypress, but the simple hack of updating to Cypress version 9.7.0 did not work.

Do you all have suggestions or a workaround for this? I'm guessing that it is a node and/or typescript version incompatibility.

ec2-user:~/environment/polis/e2e (stable) $ tsc --version
Version 3.7.5
ec2-user:~/environment/polis/e2e (stable) $ node --version
v16.18.1

If not, I can work on it more systematically.

Thanks!

-Chris

crkrenn avatar Dec 06 '22 15:12 crkrenn

@crkrenn congrats on the retirement! 😊

patcon avatar Dec 07 '22 19:12 patcon

Fixed here https://github.com/compdemocracy/polis/commit/18a0e486389c5d4ce49479b0c6869acc10a63de4

xeeg avatar Apr 06 '23 17:04 xeeg