DevExpress / testcafe

A Node.js tool to automate end-to-end web testing.
https://testcafe.io
MIT License
9.82k stars 673 forks source link

Testcafe process does not terminate after tests #6992

Closed andrzej-woof closed 1 year ago

andrzej-woof commented 2 years ago

What is your Scenario?

I'm using testcafe@1.18.5 together with percy/testcafe@1.0.1 and programatic runner After tests are successfully completed the process never exits

Since I cannot provide any exact steps to reproduce I hope at least for some hints on how to debug this further on my side (to provide you with more details)

What is the Current behavior?

Test execution completes but the process does not terminate

What is the Expected behavior?

Process should terminate when tests are completed

What is your public website URL? (or attach your complete example)

.

What is your TestCafe test code?

Sample (incomplete) code extracted from a bigger project

(async () => {
  const testcafe = await createTestCafe(config);
  try {
    const runner = testcafe.createRunner();
    await runner
      .clientScripts({ path: './clientScripts.js' })
      .src(args.tests)
      .browsers(`chrome:headless --window-size=${defaultWindowSize.width},${defaultWindowSize.height}`)
      .concurrency(3)
      .reporter(['spec'])
      .run(runOptions);
  } finally {
    setTimeout(() => {
      console.log('Forcibly terminating process');
      process.exit();
    }, 60000);
    console.log('testcafe.close()');
    await testcafe.close();
    console.log('testcafe.close() completed');
  }
})();

Your complete configuration file

No response

Your complete test report

No response

Screenshots

No response

Steps to Reproduce

Unknown

TestCafe version

1.18.5

Node.js version

14.18.1

Command-line arguments

-c 3 -e -q attemptLimit=5,successThreshold=1 -V

Browser name(s) and version(s)

No response

Platform(s) and version(s)

No response

Other

Final part of debug log

 ✓ XXX page (screenshots: /Users/my-user/projects/project/e2e-tests/artifacts/screenshots)
 ✓ XXX view page (screenshots: /Users/my-user/projects/project/e2e-tests/artifacts/screenshots/XXX.png)
 ✓ YYY page (screenshots: /Users/my-user/projects/project/e2e-tests/artifacts/screenshots)
 ✓ YYY page with data (screenshots: /Users/my-user/projects/project/e2e-tests/artifacts/screenshots/YYY - with data.png)
 ✓ ZZZ page (screenshots: /Users/my-user/projects/project/e2e-tests/artifacts/screenshots)
  testcafe:browser:connection:4M7zZb5 status changed to 'closing' +44s
  testcafe:browser:connection:oxnSFmR status changed to 'closing' +43s
  testcafe:browser:connection:ChOkYv5 status changed to 'closing' +43s

 5 passed (42s)
  hammerhead:proxy Proxy request F0vTmlCrB POST /7QSBRyxL1*iqX8orswe/https://somehost/track/?verbose=1&ip=1&_=1650451024330 {"host":"192.168.1.18:62562","connection":"keep-alive","content-length":"2511","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/100.0.4896.127 Safari/537.36","content-type":"text/plain;charset=UTF-8","accept":"*/*","origin":"http://somehost","referer":"http://somehost/7QSBRyxL1*iqX8orswe/http://somehost/campaigns","accept-encoding":"gzip, deflate","accept-language":"en-US"} +2s
  hammerhead:destination:http2 Destination stream F0vTmlCrB {":method":"POST",":path":"/track/?verbose=1&ip=1&_=1650451024330",":authority":"api-js.mixpanel.com","content-length":2511,"user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/100.0.4896.127 Safari/537.36","content-type":"text/plain;charset=UTF-8","accept":"*/*","origin":"http://somehost","referer":"http://somehost/campaigns","accept-encoding":"gzip, deflate","accept-language":"en-US"} +2s
  hammerhead:destination Destination response F0vTmlCrB 200 {"access-control-allow-credentials":"true","access-control-allow-headers":"X-Requested-With","access-control-allow-methods":"GET, POST, OPTIONS","access-control-allow-origin":"http://somehost","access-control-expose-headers":"X-MP-CE-Backoff","access-control-max-age":"1728000","cache-control":"no-cache, no-store","content-type":"application/json","strict-transport-security":"max-age=604800; includeSubDomains","date":"Wed, 20 Apr 2022 10:37:04 GMT","content-length":"25","x-envoy-upstream-service-time":"15","server":"envoy","via":"1.1 google","alt-svc":"clear"} +2s
  hammerhead:proxy Proxy resource content info F0vTmlCrB { charset: iso-8859-1, encoding: , requireProcessing: false } +65ms
  hammerhead:proxy Proxy response F0vTmlCrB 200 {"access-control-allow-credentials":"true","access-control-allow-headers":"X-Requested-With","access-control-allow-methods":"GET, POST, OPTIONS","access-control-allow-origin":"http://somehost","access-control-expose-headers":"X-MP-CE-Backoff","access-control-max-age":"1728000","cache-control":"no-cache, no-store","content-type":"application/json","strict-transport-security":"max-age=604800; includeSubDomains","date":"Wed, 20 Apr 2022 10:37:04 GMT","content-length":"25","x-envoy-upstream-service-time":"15","server":"envoy","via":"1.1 google","alt-svc":"clear","set-cookie":[],"content-disposition":"attachment;undefined"} +1ms
  testcafe:browser:connection:oxnSFmR status changed to 'closed' +2s
  testcafe:browser:connection:4M7zZb5 status changed to 'closed' +2s
  testcafe:browser:connection:ChOkYv5 status changed to 'closed' +2s
testcafe.close()
testcafe.close() completed
  hammerhead:destination Destination request timeout s2SPzL2Du (25000 ms) +20s
  hammerhead:destination Destination request timeout TkYdwsWmL (25000 ms) +2s
  hammerhead:destination:http2 Destination session is unused more than 1 min and will be closed https://somehost +47s
  hammerhead:destination:http2 Destination session closed o001R3Kd7 https://somehost (cache size 7 of 100) +6ms
  hammerhead:destination:http2 Destination session is unused more than 1 min and will be closed https://somehost +2s
  hammerhead:destination:http2 Destination session closed nQU9wyNvZ https://somehost (cache size 6 of 100) +1ms
  hammerhead:destination:http2 Destination session is unused more than 1 min and will be closed https://somehost +6s
  hammerhead:destination:http2 Destination session closed rEUwGwhTd https://somehost (cache size 5 of 100) +1ms
  hammerhead:destination:http2 Destination session is unused more than 1 min and will be closed https://somehost +357ms
  hammerhead:destination:http2 Destination session is unused more than 1 min and will be closed https://somehost +1ms
  hammerhead:destination:http2 Destination session closed k11QHzBoa https://somehost (cache size 3 of 100) +0ms
  hammerhead:destination:http2 Destination session closed BYsvyNDSO https://somehost (cache size 3 of 100) +1ms
  hammerhead:destination:http2 Destination session is unused more than 1 min and will be closed https://somehost +915ms
  hammerhead:destination:http2 Destination session is unused more than 1 min and will be closed https://somehost +2s
  hammerhead:destination:http2 Destination session closed MeU2t228M https://somehost (cache size 1 of 100) +1ms
  hammerhead:destination:http2 Destination session is unused more than 1 min and will be closed https://somehost +2s
  hammerhead:destination:http2 Destination session closed Le2sRnuAS https://somehost (cache size 0 of 100) +0ms
Forcibly terminating process

As you can see await testcafe.close() is executed correctly, and that's it. Later process is terminated after 60 seconds by setTimeout that I've added as on CI it would just stay that way for another 20 minutes (until build timed out)

Artem-Babich commented 2 years ago

Hi @andrzej-kodify! I cannot reproduce this issue locally. And to be honest, I have no idea why it may occur on your side. To determine the cause of this issue, we need a minimal working example illustrating it: How To: Create a Minimal Working Example When You Submit an Issue. Would you please share it and the steps required to reproduce the issue?

andrzej-woof commented 2 years ago

Well, took a while but can you try reproducing with this repo https://github.com/andrzej-kodify/testcafe-percy-hangs

nvm use
yarn install --frozen-lockfile
yarn test
Artem-Babich commented 2 years ago

Thank you for the sample. I was able to reproduce the issue without using third-party libraries. We will update this thread once we have news.

gixlg commented 2 years ago

Hi any update on this issue? I'm experimenting the same behavior.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had any activity for a long period. It will be closed and archived if no further activity occurs. However, we may return to this issue in the future. If it still affects you or you have any additional information regarding it, please leave a comment and we will keep it open.

github-actions[bot] commented 1 year ago

We're closing this issue after a prolonged period of inactivity. If it still affects you, please add a comment to this issue with up-to-date information. Thank you.