Skip to content

ci: refactor Cypress sharding due to cloud limits - #20119

Merged
martinothamar merged 3 commits into
mainfrom
ci/refactor-cypress-sharding
Aug 22, 2026
Merged

ci: refactor Cypress sharding due to cloud limits#20119
martinothamar merged 3 commits into
mainfrom
ci/refactor-cypress-sharding

Conversation

@martinothamar

@martinothamar martinothamar commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Description

For a good while we've been running into Cypress Cloud limits. Altinn architectural principles are based on open source. Long term we should migrate to Playwright, for now this seemed like a worthwhile alternative to explore.

Verification

  • Related issues are connected (if applicable)
  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)

Summary by CodeRabbit

  • Tests

    • End-to-end test runs can now be divided into balanced shards, helping parallel checks complete more efficiently.
    • Test distribution uses historical run times to assign longer-running checks appropriately, with sensible handling for tests without timing data.
    • Invalid shard settings now produce clear validation errors.
    • Parallel test runs report clearer shard information and produce separately identifiable failure logs.
  • Bug Fixes

    • Cypress failures now trigger more comprehensive diagnostic collection, while test environments are reliably stopped after each run.

@martinothamar
martinothamar requested a review from a team as a code owner August 22, 2026 10:23
@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b7158229-dbe4-4aef-8543-3c6456b1ac37

📥 Commits

Reviewing files that changed from the base of the PR and between 5bc39f2 and 6973a23.

📒 Files selected for processing (1)
  • src/App/frontend/test/e2e/cypress-timings.json

Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Cypress configuration now assigns specifications to duration-balanced shards. Internal and external workflows identify Cypress outcomes, collect conditional diagnostics, upload expanded failure logs, and always stop LocalTest. Timing metadata records updated specification durations.

Changes

Cypress workflows

Layer / File(s) Summary
Duration-based shard assignment
src/App/frontend/scripts/cypress-shard.js, src/App/frontend/test/e2e/cypress-timings.json
configureCypressShard validates shard settings, discovers .ts specifications, applies timing data, and assigns specifications with a greedy duration-balancing algorithm.
Cypress configuration wiring
src/App/frontend/cypress.config.js, .github/workflows/app-frontend-cypress.yml
The environment configuration preserves existing Cypress values and passes shard options to configureCypressShard. Internal runs provide shard metadata and use container-specific groups.
Conditional diagnostics and shutdown
.github/actions/app-stop-local-env/action.yaml, .github/workflows/app-frontend-cypress.yml
The LocalTest action collects optional diagnostics and always attempts shutdown. Internal and external jobs collect and upload additional logs when Cypress fails.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: ⚪ Minimal · up to 6973a

The current change has no actionable merge-blocking risk identified; it is merge-ready after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant GitHubActions
  participant CypressConfig
  participant configureCypressShard
  participant Cypress
  participant LocalTestAction
  GitHubActions->>CypressConfig: Set shard total and number
  CypressConfig->>configureCypressShard: Pass config, spec root, timings file, and shard values
  configureCypressShard->>Cypress: Set selected shard specPattern
  Cypress->>GitHubActions: Report Cypress step outcome
  GitHubActions->>LocalTestAction: Stop LocalTest and request diagnostics on failure
  LocalTestAction->>GitHubActions: Write diagnostic logs and complete shutdown
Loading
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: refactoring Cypress sharding to address cloud limits.
Description check ✅ Passed The description includes the required sections and explains the Cypress Cloud limit rationale, although the verification checklist remains unchecked.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/refactor-cypress-sharding

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the skip-releasenotes Issues that do not make sense to list in our release notes label Aug 22, 2026
@martinothamar
martinothamar force-pushed the ci/refactor-cypress-sharding branch from 92779de to 08a35f4 Compare August 22, 2026 12:30
@martinothamar
martinothamar force-pushed the ci/refactor-cypress-sharding branch from 08a35f4 to 8ac0d23 Compare August 22, 2026 17:36
@martinothamar martinothamar added the approve You approve this PR. Use when: - Small changes - Already agreed upon - Async review label Aug 22, 2026
@martinothamar
martinothamar merged commit d072a20 into main Aug 22, 2026
23 checks passed
@martinothamar
martinothamar deleted the ci/refactor-cypress-sharding branch August 22, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approve You approve this PR. Use when: - Small changes - Already agreed upon - Async review skip-releasenotes Issues that do not make sense to list in our release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant