Skip to content

test: move integer settings validation coverage to component and API tests - #42048

Open
jessicaschelly wants to merge 3 commits into
developfrom
test/e2e-settings-int-flakiness
Open

test: move integer settings validation coverage to component and API tests#42048
jessicaschelly wants to merge 3 commits into
developfrom
test/e2e-settings-int-flakiness

Conversation

@jessicaschelly

@jessicaschelly jessicaschelly commented Sep 4, 2026

Copy link
Copy Markdown
Member

Proposed changes (including videos or screenshots)

Replaces the flaky browser E2E test for empty integer settings with focused coverage at the component and API levels.

  • Adds a SettingsGroupPage component test covering the UI flow: clear an integer input, attempt to save it, and request an error toast when the save is rejected.
  • Adds bulk REST API coverage confirming that the serialized empty integer value is rejected and the stored setting remains unchanged.
  • Activates the existing NaN, Infinity, and -Infinity method API tests by awaiting their Supertest requests, then verifies the observable failure response.
  • Removes settings-int.spec.ts, avoiding an unrelated dependency on loading the full Message settings page.

Why the existing method tests appeared to pass

The method tests previously used void request... inside synchronous Mocha callbacks. Because the Supertest request chains were neither returned nor awaited, Mocha completed the tests immediately without executing and enforcing their response assertions. Their passing status was therefore a false positive.

Awaiting the requests exposed the actual endpoint contract: all three invalid values return HTTP 400 with success: false and a DDP error frame. The legacy method.call REST wrapper serializes the nested Meteor.Error object as {}, so these tests assert only the response fields that the endpoint actually exposes. The intended empty-integer rejection and preservation of the stored setting are additionally covered through the modern settings API test.

Issue(s)

FLAKY-1395

Steps to test or reproduce

  1. Run the focused component test:
    yarn .testunit:jest client/views/admin/settings/SettingsGroupPage/SettingsGroupPage.spec.tsx --runInBand
  2. Run the settings API tests against a test server:
    yarn testapi tests/end-to-end/api/settings.ts tests/end-to-end/api/methods.ts --grep 'saveSettings|empty integer value'
  3. Confirm the component test requests an error toast after the cleared integer setting fails to save.
  4. Confirm the API tests reject invalid integer values without changing the stored setting.

Further comments

Review in cubic

@dionisio-bot

dionisio-bot Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

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

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot

changeset-bot Bot commented Sep 4, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 1b73a89

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

coderabbitai Bot commented Sep 4, 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: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 62f9b55d-937a-4c17-86e2-5574e587659b

📥 Commits

Reviewing files that changed from the base of the PR and between bc411ab and 1b73a89.

📒 Files selected for processing (4)
  • apps/meteor/client/views/admin/settings/SettingsGroupPage/SettingsGroupPage.spec.tsx
  • apps/meteor/tests/e2e/settings-int.spec.ts
  • apps/meteor/tests/end-to-end/api/methods.ts
  • apps/meteor/tests/end-to-end/api/settings.ts
💤 Files with no reviewable changes (1)
  • apps/meteor/tests/e2e/settings-int.spec.ts

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

📜 Recent review details
⏰ Context from checks skipped due to timeout. (19)
  • GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (1/5)
  • GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (3/5)
  • GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (2/5)
  • GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (5/5)
  • GitHub Check: 🔨 Test API Livechat (FIPS) / MongoDB 8.0 (1/1)
  • GitHub Check: 🔨 Test API (FIPS) / MongoDB 8.0 (1/1)
  • GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (4/5)
  • GitHub Check: 🔨 Test API Livechat (EE) / MongoDB 8.0 coverage (1/1)
  • GitHub Check: 🔨 Test UI (CE) / MongoDB 8.0 (1/4)
  • GitHub Check: 🔨 Test API (EE) / MongoDB 8.0 coverage (1/1)
  • GitHub Check: 🔨 Test UI (CE) / MongoDB 8.0 (3/4)
  • GitHub Check: 🔨 Test API Livechat (CE) / MongoDB 8.0 (1/1)
  • GitHub Check: 🔨 Test UI (CE) / MongoDB 8.0 (4/4)
  • GitHub Check: 🔨 Test UI (CE) / MongoDB 8.0 (2/4)
  • GitHub Check: 🔨 Test API Apps (deno-runtime - EE) / MongoDB 8.0 coverage (1/1)
  • GitHub Check: 🔨 Test API (CE) / MongoDB 8.0 (1/1)
  • GitHub Check: 🔨 Test Federation Matrix
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Hacktron Security Check
🧰 Additional context used
📓 Path-based instructions (1)
Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests Avoid code comments in the implementation

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

Files:

  • apps/meteor/tests/end-to-end/api/settings.ts
  • apps/meteor/tests/end-to-end/api/methods.ts
  • apps/meteor/client/views/admin/settings/SettingsGroupPage/SettingsGroupPage.spec.tsx
🧠 Learnings (2)
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/tests/end-to-end/api/settings.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/tests/end-to-end/api/settings.ts
🔇 Additional comments (3)
apps/meteor/tests/end-to-end/api/methods.ts (1)

3372-3373: LGTM!

Also applies to: 3392-3393, 3404-3410, 3412-3413, 3424-3426

apps/meteor/tests/end-to-end/api/settings.ts (1)

132-147: LGTM!

apps/meteor/client/views/admin/settings/SettingsGroupPage/SettingsGroupPage.spec.tsx (1)

1-72: LGTM!


Walkthrough

The changes add UI coverage for failed cleared-integer saves, update API tests for invalid numeric and null values, and remove the former settings integration test.

Changes

Integer setting validation

Layer / File(s) Summary
API rejection and persistence checks
apps/meteor/tests/end-to-end/api/methods.ts, apps/meteor/tests/end-to-end/api/settings.ts
Invalid NaN, Infinity, -Infinity, and null values now use awaited requests and expect HTTP 400 responses. Bulk-update coverage verifies that a rejected null value does not change the stored setting.
UI error handling test
apps/meteor/client/views/admin/settings/SettingsGroupPage/SettingsGroupPage.spec.tsx, apps/meteor/tests/e2e/settings-int.spec.ts
The component test verifies the NaN dispatch and error toast for a failed cleared-integer save. The former settings integration test is removed.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 1b73a

This change strengthens coverage for rejected invalid integer settings, including UI error feedback and unchanged persisted values after failed bulk updates. No current merge-readiness risk is identified.

Suggested labels: type: chore

Suggested reviewers: ggazzo, kevl ehman, ricardogarim, cardoso

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3…
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: moving integer settings validation coverage to component and API tests while removing the flaky browser test.

Warning

Errors were encountered while retrieving linked issues.

Errors (1)
  • JIRA integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.

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.

@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.42%. Comparing base (bc411ab) to head (1b73a89).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #42048      +/-   ##
===========================================
+ Coverage    69.30%   69.42%   +0.11%     
===========================================
  Files         4289     4291       +2     
  Lines       171486   171840     +354     
  Branches     31062    31193     +131     
===========================================
+ Hits        118847   119297     +450     
+ Misses       47463    47392      -71     
+ Partials      5176     5151      -25     
Flag Coverage Δ
e2e 59.03% <ø> (+0.05%) ⬆️
e2e-api 46.32% <ø> (+0.03%) ⬆️
unit 71.10% <ø> (+0.14%) ⬆️

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.

@jessicaschelly jessicaschelly changed the title test: decouple integer settings validation from Message page performance test: move integer settings validation coverage to component and API tests Sep 4, 2026
@jessicaschelly
jessicaschelly marked this pull request as ready for review September 4, 2026 19:32
@jessicaschelly
jessicaschelly requested review from a team as code owners September 4, 2026 19:32

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 4 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/meteor/tests/end-to-end/api/methods.ts">

<violation number="1" location="apps/meteor/tests/end-to-end/api/methods.ts:3404">
P3: These three tests only assert that a generic `error` property exists, so they pass even when the save is rejected for an unrelated reason (e.g. a permission error or a missing setting). The server rejects NaN/Infinity/-Infinity via `checkInteger` in saveSettingsBulk.ts which throws `Meteor.Error('error-invalid-setting-value', ...)`, so assert `parsedBody.error` has `error` equal to `'error-invalid-setting-value'` to actually lock in the invalid-integer contract instead of merely that some error occurred.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

}),
})
.expect(200)
.expect(400)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P3: These three tests only assert that a generic error property exists, so they pass even when the save is rejected for an unrelated reason (e.g. a permission error or a missing setting). The server rejects NaN/Infinity/-Infinity via checkInteger in saveSettingsBulk.ts which throws Meteor.Error('error-invalid-setting-value', ...), so assert parsedBody.error has error equal to 'error-invalid-setting-value' to actually lock in the invalid-integer contract instead of merely that some error occurred.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/meteor/tests/end-to-end/api/methods.ts, line 3404:

<comment>These three tests only assert that a generic `error` property exists, so they pass even when the save is rejected for an unrelated reason (e.g. a permission error or a missing setting). The server rejects NaN/Infinity/-Infinity via `checkInteger` in saveSettingsBulk.ts which throws `Meteor.Error('error-invalid-setting-value', ...)`, so assert `parsedBody.error` has `error` equal to `'error-invalid-setting-value'` to actually lock in the invalid-integer contract instead of merely that some error occurred.</comment>

<file context>
@@ -3402,17 +3401,16 @@ describe('Meteor.methods', () => {
 					}),
 				})
-				.expect(200)
+				.expect(400)
 				.expect((res) => {
-					expect(res.body).to.have.property('success', true);
</file context>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I checked this against a running server. Although saveSettingsBulk throws error-invalid-setting-value, the legacy method.call wrapper serializes the nested error as {}, so this assertion would fail. Changing that deprecated wrapper is outside this test-only PR. The new /v1/settings test covers the UI’s actual path and verifies the invalid value is rejected without changing the setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants