test: add tests for image upload with rotation and EXIF#39252
test: add tests for image upload with rotation and EXIF#39252jessicaschelly wants to merge 3 commits intodevelopfrom
Conversation
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
|
WalkthroughAdds a new end-to-end test validating image upload rotation, EXIF stripping, and thumbnail generation using an EXIF-orientation image; tests both when FileUpload_RotateImages is enabled and disabled, and restores settings and cleans up created user/room. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts (1)
92-94: Restore per-test setting changes in afinallyblock.This test mutates a global setting and relies on suite teardown to restore it. Restoring inside the test keeps cases more isolated and safer for future test additions.
♻️ Suggested isolation improvement
it('should NOT rotate pixels when FileUpload_RotateImages is disabled', async () => { - await updateSetting('FileUpload_RotateImages', false); - - const requestConfig: IRequestConfig = { request, credentials: userCredentials }; - const { message } = await uploadFileToRC(testRoom._id, testImagePath, 'no-rotation-test', requestConfig); - const uploadMessage = message as IMessage; - - expect(uploadMessage).to.have.property('attachments'); - const attachment = uploadMessage.attachments?.find((item) => item.title === testImageName); - expect(attachment).to.be.an('object'); - - const fileUrl = (attachment as { title_link?: string }).title_link; - expect(fileUrl).to.be.a('string'); - - const originalBuffer = await downloadBuffer(fileUrl as string, userCredentials); - const originalMetadata = await sharp(originalBuffer).metadata(); - - expect(originalMetadata.width).to.equal(719); - expect(originalMetadata.height).to.equal(479); + await updateSetting('FileUpload_RotateImages', false); + try { + const requestConfig: IRequestConfig = { request, credentials: userCredentials }; + const { message } = await uploadFileToRC(testRoom._id, testImagePath, 'no-rotation-test', requestConfig); + const uploadMessage = message as IMessage; + + expect(uploadMessage).to.have.property('attachments'); + const attachment = uploadMessage.attachments?.find((item) => item.title === testImageName); + expect(attachment).to.be.an('object'); + + const fileUrl = (attachment as { title_link?: string }).title_link; + expect(fileUrl).to.be.a('string'); + + const originalBuffer = await downloadBuffer(fileUrl as string, userCredentials); + const originalMetadata = await sharp(originalBuffer).metadata(); + + expect(originalMetadata.width).to.equal(719); + expect(originalMetadata.height).to.equal(479); + } finally { + await updateSetting('FileUpload_RotateImages', true); + } });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts` around lines 92 - 94, Save the current value of the FileUpload_RotateImages setting before mutating it, perform the test with updateSetting('FileUpload_RotateImages', false) inside a try block, and then restore the original value in a finally block using updateSetting(...) so the global setting is always reverted; reference the test "should NOT rotate pixels when FileUpload_RotateImages is disabled" and the updateSetting call to locate where to add const original = await getSetting('FileUpload_RotateImages') (or equivalent) and the try/finally wrapper.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts`:
- Around line 49-56: The after() teardown should be made resilient to partial
failures: replace the Promise.all([...]) with Promise.allSettled([...]) and only
call deleteRoom({ type: 'p', roomId: testRoom._id }) if testRoom is defined and
deleteUser(user) if user is defined; keep the updateSetting(...) calls
unconditional but include them in the settled array so a rejected cleanup does
not short-circuit other teardowns and errors are reported without masking the
original failure.
---
Nitpick comments:
In `@apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts`:
- Around line 92-94: Save the current value of the FileUpload_RotateImages
setting before mutating it, perform the test with
updateSetting('FileUpload_RotateImages', false) inside a try block, and then
restore the original value in a finally block using updateSetting(...) so the
global setting is always reverted; reference the test "should NOT rotate pixels
when FileUpload_RotateImages is disabled" and the updateSetting call to locate
where to add const original = await getSetting('FileUpload_RotateImages') (or
equivalent) and the try/finally wrapper.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
apps/meteor/tests/mocks/files/exif-orientation-6.jpgis excluded by!**/*.jpg
📒 Files selected for processing (1)
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
📜 Review details
⏰ 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: 📦 Build Packages
- GitHub Check: cubic · AI code reviewer
- GitHub Check: CodeQL-Build
- GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
🧠 Learnings (13)
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : All test files must be created in `apps/meteor/tests/e2e/` directory
Applied to files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (`test`, `page`, `expect`) for consistency in test files
Applied to files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Group related tests in the same file
Applied to files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure tests run reliably in parallel without shared state conflicts
Applied to files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure clean state for each test execution in Playwright tests
Applied to files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/page-objects/**/*.ts : Utilize existing page objects pattern from `apps/meteor/tests/e2e/page-objects/`
Applied to files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Maintain test isolation between test cases in Playwright tests
Applied to files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.beforeAll()` and `test.afterAll()` for setup/teardown in Playwright tests
Applied to files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.step()` for complex test scenarios to improve organization in Playwright tests
Applied to files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `expect` matchers for assertions (`toEqual`, `toContain`, `toBeTruthy`, `toHaveLength`, etc.) instead of `assert` statements in Playwright tests
Applied to files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
📚 Learning: 2026-02-12T15:39:28.416Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 32703
File: apps/meteor/client/lib/chats/flows/uploadFiles.ts:52-58
Timestamp: 2026-02-12T15:39:28.416Z
Learning: In `apps/meteor/client/lib/chats/flows/uploadFiles.ts`, when E2E encryption is required but not allowed (e.g., `E2E_Enable_Encrypt_Files` setting is disabled), the function intentionally abandons the entire upload queue and displays a toast error. This fail-fast behavior prevents partial uploads when encryption requirements cannot be met and is the expected behavior, not a bug.
Applied to files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.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/file-upload-image-rotation.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 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/file-upload-image-rotation.ts
🧬 Code graph analysis (1)
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts (3)
packages/core-typings/src/ISetting.ts (1)
SettingValue(11-20)apps/meteor/tests/data/file.helper.ts (1)
uploadFileToRC(18-58)packages/core-typings/src/IMessage/MessageAttachment/Files/ImageAttachmentProps.ts (1)
ImageAttachmentProps(5-15)
🪛 Biome (2.4.4)
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
[error] 35-47: Duplicate before hook found.
(lint/suspicious/noDuplicateTestHooks)
🔇 Additional comments (1)
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts (1)
59-90: Strong coverage for the rotation + EXIF + thumbnail path.The assertions validate source metadata, uploaded file transformation, EXIF removal, and thumbnail orientation in one flow. Nice end-to-end coverage.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #39252 +/- ##
===========================================
+ Coverage 70.73% 70.86% +0.13%
===========================================
Files 3195 3208 +13
Lines 113108 113426 +318
Branches 20460 20546 +86
===========================================
+ Hits 80009 80384 +375
+ Misses 31056 30991 -65
- Partials 2043 2051 +8
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
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/file-upload-image-rotation.ts">
<violation number="1" location="apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts:50">
P2: Using Promise.allSettled here hides cleanup failures, which can leave settings/rooms/users in a bad state and cause cross-test contamination. Prefer failing the test when cleanup fails, or explicitly handle failures.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
♻️ Duplicate comments (1)
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts (1)
49-56:⚠️ Potential issue | 🟠 MajorUse
Promise.allSettledin teardown to prevent cleanup errors from masking root failures.At Line 50,
Promise.allcan fail fast when one cleanup promise rejects, which makes teardown less resilient and can hide the primary failure signal.Promise.allSettledis safer for teardown hooks.💡 Proposed hardening
after(async () => { - await Promise.all([ - updateSetting('FileUpload_RotateImages', rotateImagesSetting), - updateSetting('Message_Attachments_Strip_Exif', stripExifSetting), - updateSetting('Message_Attachments_Thumbnails_Enabled', thumbnailsEnabledSetting), - testRoom ? deleteRoom({ type: 'p', roomId: testRoom._id }) : Promise.resolve(), - user ? deleteUser(user) : Promise.resolve(), - ]); + const cleanup: Promise<unknown>[] = [ + updateSetting('FileUpload_RotateImages', rotateImagesSetting), + updateSetting('Message_Attachments_Strip_Exif', stripExifSetting), + updateSetting('Message_Attachments_Thumbnails_Enabled', thumbnailsEnabledSetting), + ]; + + if (testRoom?._id) { + cleanup.push(deleteRoom({ type: 'p', roomId: testRoom._id })); + } + if (user) { + cleanup.push(deleteUser(user)); + } + + await Promise.allSettled(cleanup); });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts` around lines 49 - 56, The teardown currently uses Promise.all which will reject-fast and can let a single cleanup error mask the original test failure; replace the Promise.all call in the after hook with Promise.allSettled so updateSetting, deleteRoom, and deleteUser calls (and the conditional testRoom/user branches referring to rotateImagesSetting, stripExifSetting, thumbnailsEnabledSetting, testRoom, and user) all run to completion and you still await their settled results, optionally logging or ignoring individual rejections rather than throwing.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts`:
- Around line 49-56: The teardown currently uses Promise.all which will
reject-fast and can let a single cleanup error mask the original test failure;
replace the Promise.all call in the after hook with Promise.allSettled so
updateSetting, deleteRoom, and deleteUser calls (and the conditional
testRoom/user branches referring to rotateImagesSetting, stripExifSetting,
thumbnailsEnabledSetting, testRoom, and user) all run to completion and you
still await their settled results, optionally logging or ignoring individual
rejections rather than throwing.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
📜 Review details
⏰ 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: 📦 Build Packages
- GitHub Check: cubic · AI code reviewer
- GitHub Check: CodeQL-Build
- GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
🧠 Learnings (17)
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : All test files must be created in `apps/meteor/tests/e2e/` directory
Applied to files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (`test`, `page`, `expect`) for consistency in test files
Applied to files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Group related tests in the same file
Applied to files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure tests run reliably in parallel without shared state conflicts
Applied to files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Ensure clean state for each test execution in Playwright tests
Applied to files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Maintain test isolation between test cases in Playwright tests
Applied to files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/page-objects/**/*.ts : Utilize existing page objects pattern from `apps/meteor/tests/e2e/page-objects/`
Applied to files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.beforeAll()` and `test.afterAll()` for setup/teardown in Playwright tests
Applied to files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `test.step()` for complex test scenarios to improve organization in Playwright tests
Applied to files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use `expect` matchers for assertions (`toEqual`, `toContain`, `toBeTruthy`, `toHaveLength`, etc.) instead of `assert` statements in Playwright tests
Applied to files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
📚 Learning: 2026-02-12T15:39:28.416Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 32703
File: apps/meteor/client/lib/chats/flows/uploadFiles.ts:52-58
Timestamp: 2026-02-12T15:39:28.416Z
Learning: In `apps/meteor/client/lib/chats/flows/uploadFiles.ts`, when E2E encryption is required but not allowed (e.g., `E2E_Enable_Encrypt_Files` setting is disabled), the function intentionally abandons the entire upload queue and displays a toast error. This fail-fast behavior prevents partial uploads when encryption requirements cannot be met and is the expected behavior, not a bug.
Applied to files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Implement proper wait strategies for dynamic content in Playwright tests
Applied to files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
📚 Learning: 2026-03-02T16:31:30.612Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 39250
File: apps/meteor/tests/end-to-end/api/livechat/07-queue.ts:1084-1094
Timestamp: 2026-03-02T16:31:30.612Z
Learning: In E2E API tests at apps/meteor/tests/end-to-end/api/livechat/, using sleep(1000) after updateSetting() or updateEESetting() calls in test setup hooks is acceptable and intentional to allow omnichannel settings to propagate their side effects.
Applied to files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,spec.ts} : Follow Page Object Model pattern consistently in Playwright tests
Applied to files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
📚 Learning: 2025-12-10T21:00:54.909Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37091
File: ee/packages/abac/jest.config.ts:4-7
Timestamp: 2025-12-10T21:00:54.909Z
Learning: Rocket.Chat monorepo: Jest testMatch pattern '<rootDir>/src/**/*.spec.(ts|js|mjs)' is valid in this repo and used across multiple packages (e.g., packages/tools, ee/packages/omnichannel-services). Do not flag it as invalid in future reviews.
Applied to files:
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.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/file-upload-image-rotation.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 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/file-upload-image-rotation.ts
🪛 Biome (2.4.4)
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
[error] 35-47: Duplicate before hook found.
(lint/suspicious/noDuplicateTestHooks)
🔇 Additional comments (1)
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts (1)
59-111: Good coverage on rotation behavior and metadata expectations.The assertions around fixture orientation, post-upload dimensions, EXIF stripping, thumbnail orientation, and disabled-rotation behavior are solid and aligned with the PR objective.
| stripExifSetting = await getSettingValueById('Message_Attachments_Strip_Exif'); | ||
| thumbnailsEnabledSetting = await getSettingValueById('Message_Attachments_Thumbnails_Enabled'); | ||
|
|
||
| await updateSetting('FileUpload_RotateImages', true); |
There was a problem hiding this comment.
Just a question, do we need the debounce for updateSetting?
Or await updateSetting('FileUpload_RotateImages', true, false); would work as well?
There was a problem hiding this comment.
hmm, i think using updateSetting('FileUpload_RotateImages', true, false) could work, but could be a risk for flaky tests if the setting doesn't propagate before the file upload runs, wdyt?
Proposed changes
Add tests for image rotation on file upload to verify the
FileUpload_RotateImagessetting works correctly.Test coverage:
Test fixture:
exif-orientation-6.jpg(18KB) - lightweight test image with EXIF orientation metadataIssue(s)
CORE-1563
QA-112
Steps to test or reproduce
Further comments
The test uses
sharpto verify image metadata before and after upload, ensuring the server correctly handles EXIF orientation data.Summary by CodeRabbit