Skip to content

Conversation

@priscilladeroode
Copy link
Contributor

@priscilladeroode priscilladeroode commented Jul 8, 2025

Fix component tests

Summary by CodeRabbit

  • New Features

    • Added test utility components for easier and more consistent testing of navigation and layout components.
    • Introduced a test identifier to the navigation mini component for improved test targeting.
  • Refactor

    • Streamlined test setups by replacing direct theme provider usage with specialized testing components.
    • Enhanced test provider utilities to support additional UI settings configuration.
    • Updated authentication test providers to explicitly handle initial profile values.
    • Improved test data mocking by pre-queuing GraphQL responses for comments, notifications, and profile members components.
  • Chores

    • Downgraded the version of simplebar-react for compatibility.
    • Removed unnecessary TypeScript error suppression comments.

@changeset-bot
Copy link

changeset-bot bot commented Jul 8, 2025

⚠️ No Changeset found

Latest commit: 7e4d99e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Jul 8, 2025

Walkthrough

This update refactors test utilities and test suites for navigation and authentication components. It introduces new test wrapper components for easier context provisioning, standardizes initial profile/context passing, adds test IDs, and updates provider composition in the design system tests. Additionally, it downgrades the simplebar-react package and removes TypeScript error suppression comments.

Changes

File(s) Change Summary
.../modules/tests/utils/providers/withAuthenticationTestProviders/index.tsx Refactored import for CookieProvider, standardized initial profile handling, and explicit prop passing.
.../navigations/web/Header/AccountMenu/AccountPopover/tests/AccountPopover.cy.tsx Updated test context prop structure for initial profile; removed old test prop usage.
.../navigations/web/NavCentered/tests/NavCentered.cy.tsx Switched to NavCenteredForTesting with new theme prop; removed direct ThemeProvider usage.
.../navigations/web/NavCentered/tests/NavCenteredForTesting/index.tsx Added NavCenteredForTesting test utility component wrapped with providers.
.../navigations/web/NavMini/tests/NavMini.cy.tsx Switched to NavMiniForTesting with theme prop; renamed theme function; removed explicit ThemeProvider.
.../navigations/web/NavMini/tests/NavMiniForTesting/index.tsx Added NavMiniForTesting test utility component wrapped with providers.
.../navigations/web/NavMini/index.tsx Added data-testid="nav-mini" to root element for testing.
.../navigations/web/NavigationLayout/tests/NavigationLayout.cy.tsx Switched to NavigationLayoutForTesting with theme prop; removed unused settings; updated assertions.
.../navigations/web/NavigationLayout/tests/NavigationLayoutForTesting/index.tsx Added NavigationLayoutForTesting test utility component wrapped with providers.
.../scrollbars/Scrollbar/styled.ts, .../scrollbars/Scrollbar/types.ts Removed TypeScript error suppression comments for simplebar-react imports.
.../tests/web/utils/providers/withDesignSystemTestProviders/index.tsx Enhanced HOC to include UISettingsProvider and new prop handling.
.../tests/web/utils/providers/withDesignSystemTestProviders/types.ts Extended props interface to include UISettingsProviderProps.
pnpm-workspace.yaml Downgraded simplebar-react from 3.3.1 to 3.2.5.

Sequence Diagram(s)

sequenceDiagram
    participant TestSuite
    participant ForTestingComponent
    participant withComponentCompleteTestProviders
    participant ContextProviders
    participant TargetComponent

    TestSuite->>ForTestingComponent: Mount with props (theme, context, etc.)
    ForTestingComponent->>withComponentCompleteTestProviders: Wrap TargetComponent
    withComponentCompleteTestProviders->>ContextProviders: Provide contexts (theme, UISettings, etc.)
    ContextProviders->>TargetComponent: Render with provided contexts
    TargetComponent-->>TestSuite: Expose test IDs, state, etc.
Loading

Possibly related PRs

Suggested labels

approved

Suggested reviewers

  • deboracosilveira
  • anicioalexandre

Poem

A rabbit hops through code so neat,
Wrapping tests in context sweet.
IDs for navs, providers anew,
Themes and profiles passing through.
Downgraded bars, no errors in sight—
This patch makes testing feel just right!
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/components/modules/comments/web/Comments/__tests__/__mocks__/requests.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

Error: Cannot read config file: /packages/components/.eslintrc.js
Error: Cannot find module '@baseapp-frontend/config/.eslintrc-with-restricted-paths.js'
Require stack:

  • /packages/components/.eslintrc.js
  • /node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/cli-engine/cli-engine.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/eslint/eslint.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/eslint/index.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/cli.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/bin/eslint.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1369:15)
    at defaultResolveImpl (node:internal/modules/cjs/loader:1025:19)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1030:22)
    at Module._load (node:internal/modules/cjs/loader:1179:37)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Module.require (node:internal/modules/cjs/loader:1449:12)
    at require (node:internal/modules/helpers:135:16)
    at Object. (/packages/components/.eslintrc.js:1:18)
    at Module._compile (node:internal/modules/cjs/loader:1692:14)
packages/authentication/modules/tests/utils/providers/withAuthenticationTestProviders/index.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

Error: Cannot read config file: /packages/authentication/.eslintrc.js
Error: Cannot find module '@baseapp-frontend/config/.eslintrc.js'
Require stack:

  • /packages/authentication/.eslintrc.js
  • /node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/cli-engine/cli-engine.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/eslint/eslint.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/eslint/index.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/cli.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/bin/eslint.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1369:15)
    at defaultResolveImpl (node:internal/modules/cjs/loader:1025:19)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1030:22)
    at Module._load (node:internal/modules/cjs/loader:1179:37)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Module.require (node:internal/modules/cjs/loader:1449:12)
    at require (node:internal/modules/helpers:135:16)
    at Object. (/packages/authentication/.eslintrc.js:1:18)
    at Module._compile (node:internal/modules/cjs/loader:1692:14)
packages/components/modules/comments/web/Comments/__tests__/Comments.cy.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

Error: Cannot read config file: /packages/components/.eslintrc.js
Error: Cannot find module '@baseapp-frontend/config/.eslintrc-with-restricted-paths.js'
Require stack:

  • /packages/components/.eslintrc.js
  • /node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/cli-engine/cli-engine.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/eslint/eslint.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/eslint/index.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/cli.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/bin/eslint.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1369:15)
    at defaultResolveImpl (node:internal/modules/cjs/loader:1025:19)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1030:22)
    at Module._load (node:internal/modules/cjs/loader:1179:37)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Module.require (node:internal/modules/cjs/loader:1449:12)
    at require (node:internal/modules/helpers:135:16)
    at Object. (/packages/components/.eslintrc.js:1:18)
    at Module._compile (node:internal/modules/cjs/loader:1692:14)
  • 13 others

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 078ff65 and 7e4d99e.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (28)
  • packages/authentication/CHANGELOG.md (1 hunks)
  • packages/authentication/modules/tests/utils/providers/withAuthenticationTestProviders/index.tsx (3 hunks)
  • packages/authentication/package.json (1 hunks)
  • packages/components/CHANGELOG.md (1 hunks)
  • packages/components/modules/comments/web/Comments/__tests__/Comments.cy.tsx (5 hunks)
  • packages/components/modules/comments/web/Comments/__tests__/__mocks__/requests.ts (1 hunks)
  • packages/components/modules/comments/web/Comments/__tests__/__mocks__/resolvers.ts (0 hunks)
  • packages/components/modules/navigations/web/Header/AccountMenu/AccountPopover/__tests__/AccountPopover.cy.tsx (3 hunks)
  • packages/components/modules/navigations/web/NavCentered/__tests__/NavCentered.cy.tsx (4 hunks)
  • packages/components/modules/navigations/web/NavCentered/__tests__/NavCenteredForTesting/index.tsx (1 hunks)
  • packages/components/modules/navigations/web/NavMini/__tests__/NavMini.cy.tsx (5 hunks)
  • packages/components/modules/navigations/web/NavMini/__tests__/NavMiniForTesting/index.tsx (1 hunks)
  • packages/components/modules/navigations/web/NavMini/index.tsx (1 hunks)
  • packages/components/modules/navigations/web/NavigationLayout/__tests__/NavigationLayout.cy.tsx (8 hunks)
  • packages/components/modules/navigations/web/NavigationLayout/__tests__/NavigationLayoutForTesting/index.tsx (1 hunks)
  • packages/components/modules/notifications/web/NotificationsPopover/__tests__/NotificationsPopover.cy.tsx (7 hunks)
  • packages/components/modules/profiles/web/ProfileMembers/__tests__/Members.cy.tsx (4 hunks)
  • packages/components/modules/profiles/web/ProfileMembers/__tests__/__mocks__/requests.ts (1 hunks)
  • packages/components/package.json (1 hunks)
  • packages/design-system/CHANGELOG.md (1 hunks)
  • packages/design-system/components/web/scrollbars/Scrollbar/styled.ts (0 hunks)
  • packages/design-system/components/web/scrollbars/Scrollbar/types.ts (0 hunks)
  • packages/design-system/package.json (1 hunks)
  • packages/design-system/tests/web/utils/providers/withDesignSystemTestProviders/index.tsx (2 hunks)
  • packages/design-system/tests/web/utils/providers/withDesignSystemTestProviders/types.ts (1 hunks)
  • packages/wagtail/CHANGELOG.md (1 hunks)
  • packages/wagtail/package.json (1 hunks)
  • pnpm-workspace.yaml (1 hunks)
💤 Files with no reviewable changes (3)
  • packages/design-system/components/web/scrollbars/Scrollbar/styled.ts
  • packages/design-system/components/web/scrollbars/Scrollbar/types.ts
  • packages/components/modules/comments/web/Comments/tests/mocks/resolvers.ts
✅ Files skipped from review due to trivial changes (3)
  • packages/design-system/CHANGELOG.md
  • packages/authentication/package.json
  • packages/components/modules/comments/web/Comments/tests/mocks/requests.ts
🚧 Files skipped from review as they are similar to previous changes (21)
  • pnpm-workspace.yaml
  • packages/components/modules/navigations/web/NavMini/index.tsx
  • packages/wagtail/package.json
  • packages/components/package.json
  • packages/design-system/package.json
  • packages/components/modules/navigations/web/NavigationLayout/tests/NavigationLayoutForTesting/index.tsx
  • packages/authentication/CHANGELOG.md
  • packages/components/modules/navigations/web/NavCentered/tests/NavCenteredForTesting/index.tsx
  • packages/components/modules/navigations/web/NavMini/tests/NavMiniForTesting/index.tsx
  • packages/components/CHANGELOG.md
  • packages/design-system/tests/web/utils/providers/withDesignSystemTestProviders/types.ts
  • packages/components/modules/navigations/web/Header/AccountMenu/AccountPopover/tests/AccountPopover.cy.tsx
  • packages/components/modules/notifications/web/NotificationsPopover/tests/NotificationsPopover.cy.tsx
  • packages/components/modules/comments/web/Comments/tests/Comments.cy.tsx
  • packages/authentication/modules/tests/utils/providers/withAuthenticationTestProviders/index.tsx
  • packages/components/modules/profiles/web/ProfileMembers/tests/mocks/requests.ts
  • packages/components/modules/navigations/web/NavCentered/tests/NavCentered.cy.tsx
  • packages/components/modules/navigations/web/NavigationLayout/tests/NavigationLayout.cy.tsx
  • packages/components/modules/profiles/web/ProfileMembers/tests/Members.cy.tsx
  • packages/components/modules/navigations/web/NavMini/tests/NavMini.cy.tsx
  • packages/design-system/tests/web/utils/providers/withDesignSystemTestProviders/index.tsx
🧰 Additional context used
🪛 LanguageTool
packages/wagtail/CHANGELOG.md

[grammar] ~5-~5: Use correct spacing
Context: ...-frontend/wagtail ## 1.0.32 ### Patch Changes - Updated dependencies - @baseapp-front...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~7-~7: Use colons correctly
Context: ...## 1.0.32 ### Patch Changes - Updated dependencies - @baseapp-frontend/design-system@1.0...

(QB_NEW_EN_OTHER_ERROR_IDS_30)


[grammar] ~8-~8: There might be a problem here.
Context: ...tch Changes - Updated dependencies - @baseapp-frontend/design-system@1.0.19 ## 1.0.31 ### Patch Changes - Update reactdependen...

(QB_NEW_EN_MERGED_MATCH)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Component Test Packages
  • GitHub Check: Build and Lint Packages
  • GitHub Check: Unit Test Packages
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 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>, please review it.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

@priscilladeroode priscilladeroode force-pushed the feature/BA-2560-fe-packages-component-test-fix branch from d10e460 to 2cd7f52 Compare July 8, 2025 03:27
Copy link

@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: 2

🧹 Nitpick comments (3)
packages/authentication/CHANGELOG.md (2)

3-4: Consider adding a release date to keep the changelog machine- and human-friendly
Previous entries don’t always include dates, but adding one here improves traceability and aligns with Keep a Changelog recommendations.

-## 5.0.1
+## 5.0.1 — 2025-07-XX

7-7: Minor wording tweak for clarity
“dependencies update” reads a bit awkwardly; pluralising “dependency” keeps the phrasing consistent with other entries.

-- Fix component tests after dependencies update.
+- Fix component tests after dependency updates.
packages/wagtail/CHANGELOG.md (1)

1-4: Minor markdown spacing / style nit

For readability, insert a blank line between the package header (# @baseapp-frontend/wagtail) and the version heading to match the spacing used in older entries.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f9ca966 and 078ff65.

📒 Files selected for processing (8)
  • packages/authentication/CHANGELOG.md (1 hunks)
  • packages/authentication/package.json (1 hunks)
  • packages/components/CHANGELOG.md (1 hunks)
  • packages/components/package.json (1 hunks)
  • packages/design-system/CHANGELOG.md (1 hunks)
  • packages/design-system/package.json (1 hunks)
  • packages/wagtail/CHANGELOG.md (1 hunks)
  • packages/wagtail/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (5)
  • packages/wagtail/package.json
  • packages/components/package.json
  • packages/authentication/package.json
  • packages/design-system/package.json
  • packages/components/CHANGELOG.md
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
packages/design-system/CHANGELOG.md

9-9: Multiple headings with the same content

(MD024, no-duplicate-heading)

🪛 LanguageTool
packages/wagtail/CHANGELOG.md

[grammar] ~3-~3: Use proper spacing conventions.
Context: # @baseapp-frontend/wagtail ## 1.0.32 ### Patch Changes - Updated dependencies ...

(QB_NEW_EN_OTHER_ERROR_IDS_000007)


[grammar] ~5-~5: Use proper spacing conventions.
Context: ...nd/wagtail ## 1.0.32 ### Patch Changes - Updated dependencies - @baseapp-fronte...

(QB_NEW_EN_OTHER_ERROR_IDS_000007)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build and Lint Packages
  • GitHub Check: Component Test Packages

@priscilladeroode priscilladeroode force-pushed the feature/BA-2560-fe-packages-component-test-fix branch from 078ff65 to 7e4d99e Compare July 9, 2025 14:42
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jul 9, 2025

@priscilladeroode priscilladeroode merged commit a744c3f into master Jul 9, 2025
8 checks passed
@priscilladeroode priscilladeroode deleted the feature/BA-2560-fe-packages-component-test-fix branch July 9, 2025 14:47
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.

4 participants