Cypress Plugin - Tests Timing Out

Problem

When using the Sealights Cypress Plugin (sealights-cypress-plugin for Node.js), your Cypress test runs may fail because of timeouts.

Typical symptoms:

  • Tests may hang indefinitely or stop after reaching the timeout limit.

  • You might see messages like "Timed out waiting for..." in the test output.

  • The Cypress dashboard may show incomplete or stuck test runs.

Solution

Follow these steps to troubleshoot and resolve the issue:

  1. Are tests timing out only when coverage is enabled?

    • If yes, continue to the next step.

    • If no, the problem is likely unrelated to Sealights. Please check general Cypress timeout settings.

  2. Have you set the environment variable SL_reduceInstrumentedFileSize=true before running the scan/instrumentation command?

    • If not, set SL_reduceInstrumentedFileSize=true before running slnodejs scan. This reduces the size of instrumented files and improves performance. Re-run your tests. If they are still timing out, go to the next step.

    • If yes, continue to the next step.

  3. Are ‘Enable Remote Agent’ and 'Optimize Coverage Collection' environment variables set for the Cypress plugin?

    • If not, set both variables before running Cypress.

      • They improve performance by enabling the remote agent and optimizing coverage collection.

        • CYPRESS_SL_ENABLE_REMOTE_AGENT=true

        • CYPRESS_SL_OPTIMIZE_COVERAGE_COLLECTION=true

      • Re-run your tests. If they are still timing out, continue to the next step.

    • If yes, continue to the next step.

  4. Does the Cypress process have write permissions to the current working directory?

    • If not, make sure the Cypress process has permission to write to the current working directory. This is necessary for optimized coverage collection. Re-run your tests. If they still time out, continue to the next step.

    • If yes, continue to the next step.

  5. Are tests timing out only in your CI environment but not locally?

    • If yes, check your CI runners for resource limits (CPU, memory). Increase resources if possible and verify that all required environment variables and permissions are correctly set in CI. If the issue continues, collect logs and contact Sealights Support.

    • If no, continue to the next step.

  6. Are you using the latest version of the Cypress plugin and the agent?

    • If not, upgrade to the latest versions and re-run your tests.

    • If yes, and tests are still failing, collect all relevant information (test logs, output, environment details) and contact Sealights Support.

Last updated

Was this helpful?