Skip to content

Improve Cypress teardown#7745

Merged
martinjagodic merged 19 commits intomainfrom
cypress-teardown
Mar 9, 2026
Merged

Improve Cypress teardown#7745
martinjagodic merged 19 commits intomainfrom
cypress-teardown

Conversation

@martinjagodic
Copy link
Member

@martinjagodic martinjagodic commented Mar 5, 2026

Improve logging for various Cypress tasks and streamline API request handling. Adjust timeout settings to enhance test reliability and performance. This update addresses issues with task timeouts and logging verbosity, ensuring a more efficient testing process.

@martinjagodic martinjagodic requested a review from a team as a code owner March 5, 2026 14:09
@yanthomasdev
Copy link
Contributor

Tests are hanging for no apparent reason.

I think it might be related to GitHub itself, there's some ungoing issues with Actions, I'll see if there's any issues happening locally

image

yanthomasdev
yanthomasdev previously approved these changes Mar 5, 2026
Copy link
Contributor

@yanthomasdev yanthomasdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, I have a small nit but not blocking.

Co-authored-by: Yan <61414485+yanthomasdev@users.noreply.github.com>
@martinjagodic
Copy link
Member Author

martinjagodic commented Mar 6, 2026

@yanthomasdev I think this was not a GA problem, because the pattern is always the same - the last of 4 parallel machines hangs at teardown. This has been happening for a while now, but not on every run.

If you have any other proposal on how to run tests, I would be glad to hear it

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to reduce Cypress CI hangs (especially around git-gateway setup/teardown) by adding diagnostics, tightening timeouts, and adjusting Cypress time/clock behavior.

Changes:

  • Added CI logging and reduced the execa() Cypress runner timeout.
  • Added request timeouts + retry adjustments for Netlify API calls used by the git-gateway Cypress plugin.
  • Skipped cy.clock() for git-gateway tests to avoid hangs during page load.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
cypress/utils/steps.js Refactors several Cypress command sequences; adds an eslint disable and changes some chained commands to repeated queries.
cypress/run.mjs Adds fork/machine debug logging and changes Cypress runner timeout behavior.
cypress/plugins/gitGateway.js Consolidates Netlify API calls into a timed fetch helper and adjusts deploy polling + teardown delete behavior.
cypress/e2e/common/spec_utils.js Changes hook exports to functions, lowers task timeout, and conditionally skips cy.clock() for git-gateway.
cypress.config.ts Removes/adjusts comments around retries/plugins configuration.
.github/workflows/nodejs.yml Adds a clarifying comment for fork-only env usage.
Comments suppressed due to low confidence (1)

cypress/run.mjs:25

  • Manual sharding can break when specs.length < machineCount: Math.floor(specs.length / machineCount) becomes 0, causing most machines to run 0 specs and the last machine to run everything. Consider using Math.ceil (and clamping start/end) or guarding specsPerMachine to be at least 1 to keep shards balanced.
  if (isFork && machineIndex && machineCount) {
    const specsPerMachine = Math.floor(specs.length / machineCount);
    const start = (machineIndex - 1) * specsPerMachine;
    const machineSpecs =
      machineIndex === machineCount
        ? specs.slice(start)
        : specs.slice(start, start + specsPerMachine);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@yanthomasdev yanthomasdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have one small comment but I think it's close to getting merged

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we want to fetch this with fetchWithTimeout too?

@martinjagodic martinjagodic merged commit 312cb8d into main Mar 9, 2026
9 checks passed
@martinjagodic martinjagodic deleted the cypress-teardown branch March 9, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants