Skip to content

Conversation

@dhulke
Copy link
Contributor

@dhulke dhulke commented Nov 17, 2025

Proposed changes (including videos or screenshots)

This PR integrates federation matrix integration tests in our Qase test suite. Simply using jest-qase-reporter without any manual work caused our tests directory structure to be reported as well, not following the standard of test suite structure we currently have in Qase. The solution for that was to create a wrapper for describe/it/test that called qase.suite() internally.

In order to not monkey patch jest functions I could've called qase.suite inside of the tests, but this would have made our tests tightly coupled to qase, making it difficult to remove it if we ever decided to move to a different tool. What I did instead was to monkey patch these test functions inside of a jest setup config in a way that you just have to stop loading that config in jest.config.federation.ts and the integration with Qase is gone.

In order to get the pipeline to pass we need to create a production jest qase api token and add a secret to the github pipeline called QASE_TESTOPS_JEST_API_TOKEN.

Issue(s)

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • Tests

    • Integrated Qase test reporting to track federation matrix test results and improve test management visibility.
    • Removed debug console logging from test suites for cleaner output.
  • Chores

    • Added jest-qase-reporter dependency for test reporting functionality.
    • Updated CI pipeline to support test reporting integration when credentials are available.

@dhulke dhulke requested a review from a team as a code owner November 17, 2025 18:18
@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Nov 17, 2025

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is targeting the wrong base branch. It should target 7.14.0, but it targets 7.13.0

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Nov 17, 2025

⚠️ No Changeset found

Latest commit: d20425a

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
Contributor

coderabbitai bot commented Nov 17, 2025

Walkthrough

The changes add Qase TestOps integration to the federation matrix test suite by configuring Jest reporters, setting up environment variables, adding a Jest setup file for hierarchical test registration, installing the jest-qase-reporter dependency, and removing debug console.log statements from test files.

Changes

Cohort / File(s) Summary
Qase TestOps Integration Configuration
.github/workflows/ci.yml, ee/packages/federation-matrix/jest.config.federation.ts, package.json
Added QASE_TESTOPS_JEST_API_TOKEN environment variable to CI workflow, configured Jest reporters and setupFilesAfterEnv in federation Jest config to conditionally enable jest-qase-reporter when token is present, and added jest-qase-reporter ^2.1.3 as a devDependency
Qase Jest Setup
ee/packages/federation-matrix/tests/setup-qase.ts
New setup file that wraps Jest global describe/it/test functions to register test suites and cases hierarchically with Qase when QASE_TESTOPS_JEST_API_TOKEN is set; maintains ROOT_SUITE and suitePathStack to build hierarchical paths and restores original wrappers after each describe block execution
Debug Output Cleanup
ee/packages/federation-matrix/tests/end-to-end/room.spec.ts, ee/packages/federation-matrix/tests/helper/ddp-listener.ts
Removed console.log debug statements from room creation response test and ephemeral message checks in DDP listener helper

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Areas requiring extra attention:
    • ee/packages/federation-matrix/tests/setup-qase.ts — Review the Jest function wrapping logic and ensure the hierarchical path building for test suite registration is correct across nested describe blocks
    • ee/packages/federation-matrix/jest.config.federation.ts — Verify the conditional reporter configuration and Qase API token handling matches expected Qase documentation
    • .github/workflows/ci.yml — Confirm the secret reference and environment variable passing to the test runner is properly scoped

Suggested reviewers

  • ggazzo
  • rodrigok

Poem

🐰 Qase now logs our tests with care,
Jest describe and it leap through the air,
Debug noise is gone, the suite shines bright,
Federation matrix tests take flight!
Results flow upstream, all clear and fair ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore: qase integration' clearly summarizes the main change of adding Qase test suite integration to the federation matrix tests.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/qase-integration

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.

@dhulke
Copy link
Contributor Author

dhulke commented Nov 17, 2025

@ggazzo I'll probably be off for the next few days. Can you add the qase jest api token to the secret QASE_TESTOPS_JEST_API_TOKEN for the pipeline to pass, please?

@dhulke dhulke changed the base branch from develop to test/federation-media-messages November 17, 2025 18:25
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

🧹 Nitpick comments (2)
ee/packages/federation-matrix/tests/setup-qase.ts (1)

54-70: Improve type safety and async handling.

The wrapper uses any types and always wraps test functions in async wrappers, which could cause issues with synchronous tests or affect type checking.

Apply this diff to improve type safety and preserve async/sync behavior:

-		global.it = ((testName: any, fn?: any, timeout?: number) => {
+		global.it = ((testName: string | number, fn?: jest.ProvidesCallback, timeout?: number) => {
 			// Handle qase-wrapped test names (qase returns a string)
 			if (typeof testName === 'string' && fn) {
 				return currentIt(
 					testName,
-					async () => {
-						// Set suite immediately at the start of the test
-						qase.suite(currentPath);
-						// Call the original test function and return the result
-						return fn();
-					},
+					function (this: any, ...args: any[]) {
+						qase.suite(currentPath);
+						return fn.apply(this, args);
+					},
 					timeout,
 				);
 			}
 			// Handle cases where testName might be a number or other type
 			return currentIt(testName, fn, timeout);
 		}) as typeof global.it;

This preserves the original function's async/sync behavior and maintains proper this binding.

ee/packages/federation-matrix/jest.config.federation.ts (1)

28-46: Make debug conditional to reduce CI log verbosity.

The reporters configuration is correctly structured and matches the jest-qase-reporter v2.1.3 API. All options used—mode: 'testops', testops.api.token, testops.project, and testops.run.complete—are valid according to v2.1.3 specifications. However, debug: true will produce verbose output in CI logs. Consider making it conditional:

 						debug: true,
+						debug: process.env.CI !== 'true',
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 7ed701b and d20425a.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (6)
  • .github/workflows/ci.yml (1 hunks)
  • ee/packages/federation-matrix/jest.config.federation.ts (1 hunks)
  • ee/packages/federation-matrix/tests/end-to-end/room.spec.ts (0 hunks)
  • ee/packages/federation-matrix/tests/helper/ddp-listener.ts (0 hunks)
  • ee/packages/federation-matrix/tests/setup-qase.ts (1 hunks)
  • package.json (1 hunks)
💤 Files with no reviewable changes (2)
  • ee/packages/federation-matrix/tests/helper/ddp-listener.ts
  • ee/packages/federation-matrix/tests/end-to-end/room.spec.ts
🔇 Additional comments (4)
.github/workflows/ci.yml (1)

657-657: LGTM!

The environment variable is correctly passed from secrets to enable Qase integration for federation tests.

ee/packages/federation-matrix/jest.config.federation.ts (1)

24-25: LGTM!

The setupFilesAfterEnv configuration correctly enables Qase integration via the new setup file. The comment clearly documents how to disable the integration.

ee/packages/federation-matrix/tests/setup-qase.ts (1)

1-107: Well-structured approach to Qase integration.

The monkey-patching strategy effectively addresses the test suite hierarchy reporting issue without modifying individual test files. The conditional activation and clear documentation make it easy to understand and disable if needed.

package.json (1)

24-24: No issues found with jest-qase-reporter version 2.1.3.

The package version is the latest available release and has no known security vulnerabilities according to Snyk and GitHub Advisories.

@github-actions
Copy link
Contributor

📦 Docker Image Size Report

📈 Changes

Service Current Baseline Change Percent
sum of all images 1.2GiB 1.2GiB +13MiB
rocketchat 368MiB 355MiB +13MiB
omnichannel-transcript-service 141MiB 141MiB +7.7KiB
queue-worker-service 141MiB 141MiB -1.3KiB
ddp-streamer-service 127MiB 127MiB +98B
account-service 114MiB 114MiB +263B
stream-hub-service 111MiB 111MiB +131B
authorization-service 111MiB 111MiB +427B
presence-service 111MiB 111MiB +2.6KiB

📊 Historical Trend

---
config:
  theme: "dark"
  xyChart:
    width: 900
    height: 400
---
xychart
  title "Image Size Evolution by Service (Last 30 Days + This PR)"
  x-axis ["11/15 19:34", "11/15 19:47", "11/15 20:39", "11/15 21:23", "11/15 21:37", "11/15 22:04", "11/15 22:28", "11/16 00:55", "11/16 01:28", "11/17 12:35", "11/17 12:48", "11/17 12:54", "11/17 14:13", "11/17 15:17", "11/17 16:07", "11/17 16:55", "11/17 19:01", "11/17 19:02 (PR)"]
  y-axis "Size (GB)" 0 --> 0.5
  line "account-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11]
  line "authorization-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11]
  line "ddp-streamer-service" [0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12]
  line "omnichannel-transcript-service" [0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14]
  line "presence-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11]
  line "queue-worker-service" [0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14, 0.14]
  line "rocketchat" [0.36, 0.36, 0.36, 0.36, 0.36, 0.36, 0.36, 0.36, 0.36, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.36]
  line "stream-hub-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11]
Loading

Statistics (last 17 days):

  • 📊 Average: 1.4GiB
  • ⬇️ Minimum: 1.2GiB
  • ⬆️ Maximum: 1.6GiB
  • 🎯 Current PR: 1.2GiB
ℹ️ About this report

This report compares Docker image sizes from this build against the develop baseline.

  • Tag: pr-37538
  • Baseline: develop
  • Timestamp: 2025-11-17 19:02:02 UTC
  • Historical data points: 17

Updated: Mon, 17 Nov 2025 19:02:02 GMT

@codecov
Copy link

codecov bot commented Nov 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (test/federation-media-messages@7ed701b). Learn more about missing BASE report.

Additional details and impacted files

Impacted file tree graph

@@                        Coverage Diff                        @@
##             test/federation-media-messages   #37538   +/-   ##
=================================================================
  Coverage                                  ?   69.03%           
=================================================================
  Files                                     ?     3358           
  Lines                                     ?   114228           
  Branches                                  ?    20569           
=================================================================
  Hits                                      ?    78852           
  Misses                                    ?    33288           
  Partials                                  ?     2088           
Flag Coverage Δ
e2e 57.45% <ø> (?)
e2e-api 43.80% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dhulke dhulke requested review from ggazzo and rodrigok November 25, 2025 20:01
@ggazzo ggazzo added this to the 7.14.0 milestone Nov 25, 2025
@ggazzo ggazzo added the stat: QA assured Means it has been tested and approved by a company insider label Nov 25, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Nov 25, 2025
@ggazzo ggazzo merged commit 975fd4f into test/federation-media-messages Nov 25, 2025
53 checks passed
@ggazzo ggazzo deleted the feat/qase-integration branch November 25, 2025 20:09
@dougfabris dougfabris modified the milestones: 7.14.0, 8.0.0 Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants