Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix(Snapshots): Fix snapshots + improve snapshot update process #4148

Merged
merged 3 commits into from
May 23, 2024

Conversation

Thebarda
Copy link
Contributor

Description

This fixes snapshots and makes snapshots process update more seamless.

Type of change

  • Patch fixing an issue (non-breaking change)
  • New functionality (non-breaking change)
  • Breaking change (patch or feature) that might cause side effects breaking part of the Software

Target serie

  • 22.04.x
  • 22.10.x
  • 23.04.x
  • 23.10.x
  • 24.04.x (master)

How this pull request can be tested ?

Please describe the procedure to verify that the goal of the PR is matched. Provide clear instructions so that it can be correctly tested.

Any relevant details of the configuration to perform the test should be added.

Checklist

Community contributors & Centreon team

  • I have followed the coding style guidelines provided by Centreon
  • I have commented my code, especially new classes, functions or any legacy code modified. (docblock)
  • I have commented my code, especially hard-to-understand areas of the PR.
  • I have rebased my development branch on the base branch (master, maintenance).

@Thebarda Thebarda requested a review from a team as a code owner May 21, 2024 08:35
Copy link
Contributor

coderabbitai bot commented May 21, 2024

Important

Review Skipped

Review was skipped due to path filters

Files ignored due to path filters (1)
  • centreon/package.json is excluded by !**/*.json

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The recent update involves modifying the enableVisualTesting function to dynamically set the failureThreshold based on the value of Cypress.env('updateSnapshots'). This change allows for more flexible visual testing configurations, adapting the failure threshold depending on whether snapshot updates are enabled.

Changes

File Path Change Summary
centreon/packages/js-config/cypress/component/enableVisualTesting.ts Updated enableVisualTesting function to dynamically set failureThreshold based on Cypress.env('updateSnapshots') value.

🌸 In code we trust, with thresholds we play,
Visual tests adapt to the snapshot's way.
Dynamic as the breeze, in the Cypress sky,
Our tests now flex, as updates pass by.
Hopping through code, with a rabbit's delight,
Ensuring our visuals, are always just right. 🌸


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 84b27dd and 58f83de.
Files ignored due to path filters (17)
  • centreon/cypress/visual-testing-snapshots/www/front_src/src/Dashboards/SingleInstancePage/Dashboard/Dashboard.cypress.spec.tsx/Dashboard -- Add widget -- adds a widget when a widget type is selected and the submission button is clicked.snap.png is excluded by !**/*.png, !**/*.png
  • centreon/cypress/visual-testing-snapshots/www/front_src/src/Dashboards/SingleInstancePage/Dashboard/Dashboard.cypress.spec.tsx/Dashboard -- Dataset -- displays header link to Business activity when the widget has only business activities.snap.png is excluded by !**/*.png, !**/*.png
  • centreon/cypress/visual-testing-snapshots/www/front_src/src/Dashboards/SingleInstancePage/Dashboard/Dashboard.cypress.spec.tsx/Dashboard -- Dataset -- displays header link to Resources Status when the widget has resources compatible with Resource Status.snap.png is excluded by !**/*.png, !**/*.png
  • centreon/cypress/visual-testing-snapshots/www/front_src/src/Dashboards/SingleInstancePage/Dashboard/Dashboard.cypress.spec.tsx/Dashboard -- Delete widget -- deletes a widget when the corresponding button is clicked.snap.png is excluded by !**/*.png, !**/*.png
  • centreon/cypress/visual-testing-snapshots/www/front_src/src/Dashboards/SingleInstancePage/Dashboard/Dashboard.cypress.spec.tsx/Dashboard -- Delete widget -- does not display the name of the widget when the corresponding button is clicked.snap.png is excluded by !**/*.png, !**/*.png
  • centreon/cypress/visual-testing-snapshots/www/front_src/src/Dashboards/SingleInstancePage/Dashboard/Dashboard.cypress.spec.tsx/Dashboard -- Delete widget -- does not displays the name of the widget a widget when the corresponding button is clicked.snap.png is excluded by !**/*.png, !**/*.png
  • centreon/cypress/visual-testing-snapshots/www/front_src/src/Dashboards/SingleInstancePage/Dashboard/Dashboard.cypress.spec.tsx/Dashboard -- Duplicate -- duplicates the widget when the corresponding button is clicked.snap.png is excluded by !**/*.png, !**/*.png
  • centreon/cypress/visual-testing-snapshots/www/front_src/src/Dashboards/SingleInstancePage/Dashboard/Dashboard.cypress.spec.tsx/Dashboard -- Edit widget -- edits a widget when the corresponding button is clicked and the widget type is changed the edit button is clicked.snap.png is excluded by !**/*.png, !**/*.png
  • centreon/cypress/visual-testing-snapshots/www/front_src/src/Dashboards/SingleInstancePage/Dashboard/Dashboard.cypress.spec.tsx/Dashboard -- Route blocking -- blocks the redirection when a dashboard is being edited, a dashboard is updated, the user goes to another page and the close button is clicked.snap.png is excluded by !**/*.png, !**/*.png
  • centreon/cypress/visual-testing-snapshots/www/front_src/src/Dashboards/SingleInstancePage/Dashboard/Dashboard.cypress.spec.tsx/Dashboard -- Route blocking -- does not save changes when a dashboard is being edited, a dashboard is updated, the user goes to another page and the corresponding button is clicked.snap.png is excluded by !**/*.png, !**/*.png
  • centreon/cypress/visual-testing-snapshots/www/front_src/src/Dashboards/SingleInstancePage/Dashboard/Dashboard.cypress.spec.tsx/Dashboard -- Route blocking -- saves changes when a dashboard is being edited, a dashboard is updated, the user goes to another page and the corresponding button is clicked.snap.png is excluded by !**/*.png, !**/*.png
  • centreon/cypress/visual-testing-snapshots/www/front_src/src/Dashboards/SingleInstancePage/Dashboard/Dashboard.cypress.spec.tsx/Dashboard -- View mode -- displays the refresh button when the more actions button is clicked.snap.png is excluded by !**/*.png, !**/*.png
  • centreon/cypress/visual-testing-snapshots/www/front_src/src/Dashboards/SingleInstancePage/Dashboard/Dashboard.cypress.spec.tsx/Dashboard -- View mode -- displays the widget form in editor mode when the user has editor role and the user is not editing the dashboard.snap.png is excluded by !**/*.png, !**/*.png
  • centreon/cypress/visual-testing-snapshots/www/front_src/src/Dashboards/SingleInstancePage/Dashboard/Dashboard.cypress.spec.tsx/Dashboard -- View mode -- displays the widget form in view mode when the user has viewer role.snap.png is excluded by !**/*.png, !**/*.png
  • centreon/cypress/visual-testing-snapshots/www/front_src/src/Dashboards/SingleInstancePage/Dashboard/Dashboard.cypress.spec.tsx/Dashboard -- displays a warning message indicating unsaved changes in the dashboard when updating it.snap.png is excluded by !**/*.png, !**/*.png
  • centreon/cypress/visual-testing-snapshots/www/front_src/src/Dashboards/SingleInstancePage/Dashboard/Dashboard.cypress.spec.tsx/Dashboard -- sends a shares update request when the shares are update and the corresponding button is clicked.snap.png is excluded by !**/*.png, !**/*.png
  • centreon/package.json is excluded by !**/*.json
Files selected for processing (1)
  • centreon/packages/js-config/cypress/component/enableVisualTesting.ts (1 hunks)

Copy link

Code coverage report for centreon component 🚀

Coverage after merging MON-fix-snapshots into develop will be
91.94%
Coverage Report for Changed Files
FileStmtsBranchesFuncsLinesUncovered Lines

@Thebarda Thebarda merged commit ad41761 into develop May 23, 2024
175 checks passed
@Thebarda Thebarda deleted the MON-fix-snapshots branch May 23, 2024 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants