Skip to content

Making cypress log collector opt-in#4087

Merged
olemartinorg merged 1 commit intomainfrom
chore/cypress-logs-opt-in
Mar 31, 2026
Merged

Making cypress log collector opt-in#4087
olemartinorg merged 1 commit intomainfrom
chore/cypress-logs-opt-in

Conversation

@olemartinorg
Copy link
Copy Markdown
Contributor

@olemartinorg olemartinorg commented Mar 30, 2026

Description

The cypress log collector is a bit too verbose for the github workflow, at least when we reach the end of the month and all tests are running serially in one runner instead of a 6-runner-matrix. Since the cypress cloud dashboard is unreachable at this point as well, it's very difficult to tell exactly which tests have failed (you'll have to parse through the plain logs).

Making the logs collector opt-in gives us simpler log output, while still making it easy to enable when running locally if you want it there.

Related Issue(s)

  • closes #{issue number}

Verification/QA

  • Manual functionality testing
    • I have tested these changes manually
    • Creator of the original issue (or service owner) has been contacted for manual testing (or will be contacted when released in alpha)
    • No testing done/necessary
  • Automated tests
    • Unit test(s) have been added/updated
    • Cypress E2E test(s) have been added/updated
    • No automatic tests are needed here (no functional changes/additions)
    • I want someone to help me make some tests
  • UU/WCAG (follow these guidelines until we have our own)
    • I have tested with a screen reader/keyboard navigation/automated wcag validator
    • No testing done/necessary (no DOM/visual changes)
    • I want someone to help me perform accessibility testing
  • User documentation @ altinn-studio-docs
    • Has been added/updated
    • No functionality has been changed/added, so no documentation is needed
    • I will do that later/have created an issue
  • Support in Altinn Studio
    • Issue(s) created for support in Studio
    • This change/feature does not require any changes to Altinn Studio
  • Sprint board
    • The original issue (or this PR itself) has been added to the Team Apps project and to the current sprint board
    • I don't have permissions to do that, please help me out
  • Labels
    • I have added a kind/* and backport* label to this PR for proper release notes grouping
    • I don't have permissions to add labels, please help me out

Summary by CodeRabbit

  • Chores
    • Updated test environment configuration to make logs collection optional. Logs collection now requires explicit enablement via environment variable configuration, defaulting to disabled state for improved performance.

…s are too verbose in the github workflow, and will pollute the output so much that it's difficult to read the gist of what actually happened.
@olemartinorg olemartinorg added ignore-for-release Pull requests to be ignored in release notes backport-ignore This PR is a new feature and should not be cherry-picked onto release branches labels Mar 30, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 30, 2026

📝 Walkthrough

Walkthrough

The change adds environment variable loading via dotenv and makes the logs collector initialization conditional based on the CYPRESS_LOGS_COLLECTOR environment variable. A fallback empty object prevents undefined access to environment properties.

Changes

Cohort / File(s) Summary
Environment-based conditional setup
test/e2e/support/index.ts
Added dotenv import and environment variable loading. Made installLogsCollector() execution conditional on CYPRESS_LOGS_COLLECTOR env var. Added fallback to empty object to prevent undefined property access.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: making the Cypress log collector opt-in rather than unconditionally enabled.
Description check ✅ Passed The description provides a clear rationale for the change and follows the template structure with all required sections, though the Related Issue section uses a placeholder and no specific testing checkboxes are marked.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/cypress-logs-opt-in

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@test/e2e/support/index.ts`:
- Around line 62-63: Replace direct dotenv usage with Cypress.env to allow
CLI/CI/config values: remove the dotenv.config().parsed lookup and instead call
Cypress.env('CYPRESS_LOGS_COLLECTOR') (or assign to a local variable like const
cypressLogs = Cypress.env('CYPRESS_LOGS_COLLECTOR')) and use that value in the
existing conditional (e.g., check cypressLogs === 'true' or truthiness as
before). Update any references to env.CYPRESS_LOGS_COLLECTOR to use the new
variable so the support code picks up CLI/CI/Cypress-config values.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 161b52d3-54fe-4faf-86e4-d3e3a9a76b7c

📥 Commits

Reviewing files that changed from the base of the PR and between 3ca3cd8 and c914d25.

📒 Files selected for processing (1)
  • test/e2e/support/index.ts

@phlipsterit phlipsterit self-requested a review March 30, 2026 13:22
@olemartinorg olemartinorg changed the title Making cypress log collector opt-in Making cypress logs collector opt-in for those who want it. These logs are too verbose in the github workflow, and will pollute the output so much that it's difficult to read the gist of what actually happened. Mar 31, 2026
@olemartinorg olemartinorg merged commit 63ce678 into main Mar 31, 2026
13 of 15 checks passed
@olemartinorg olemartinorg deleted the chore/cypress-logs-opt-in branch March 31, 2026 07:15
@olemartinorg olemartinorg changed the title Making cypress logs collector opt-in for those who want it. These logs are too verbose in the github workflow, and will pollute the output so much that it's difficult to read the gist of what actually happened. Making cypress log collector opt-in Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-ignore This PR is a new feature and should not be cherry-picked onto release branches ignore-for-release Pull requests to be ignored in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants