Skip to content

test: add tests for image upload with rotation and EXIF#39252

Open
jessicaschelly wants to merge 3 commits intodevelopfrom
test/image-rotation
Open

test: add tests for image upload with rotation and EXIF#39252
jessicaschelly wants to merge 3 commits intodevelopfrom
test/image-rotation

Conversation

@jessicaschelly
Copy link
Member

@jessicaschelly jessicaschelly commented Mar 2, 2026

Proposed changes

Add tests for image rotation on file upload to verify the FileUpload_RotateImages setting works correctly.

Test coverage:

  • Uploads image with EXIF orientation 6 (90° CW rotation metadata)
  • Verifies pixels are rotated when setting is enabled (719x479 → 479x719)
  • Verifies EXIF data is stripped
  • Verifies thumbnail maintains correct orientation
  • Verifies pixels are NOT rotated when setting is disabled

Test fixture:

  • Added exif-orientation-6.jpg (18KB) - lightweight test image with EXIF orientation metadata

Issue(s)

CORE-1563
QA-112

Steps to test or reproduce

Further comments

The test uses sharp to verify image metadata before and after upload, ensuring the server correctly handles EXIF orientation data.

Summary by CodeRabbit

  • Tests
    • Added end-to-end tests for file uploads that validate image rotation behavior, EXIF removal, and thumbnail generation.
    • Tests cover both rotation-enabled and rotation-disabled scenarios, verify image dimensions and orientation changes, and confirm thumbnail aspect handling.
    • Tests create and clean up test users/rooms and restore settings after run.

@jessicaschelly jessicaschelly requested a review from a team as a code owner March 2, 2026 17:31
@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Mar 2, 2026

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

changeset-bot bot commented Mar 2, 2026

⚠️ No Changeset found

Latest commit: bff902d

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 Mar 2, 2026

Walkthrough

Adds 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

Cohort / File(s) Summary
Image Rotation E2E Tests
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts
New E2E test file: creates test user and private room, toggles settings (rotate images, strip EXIF, generate thumbnails), verifies source image metadata via sharp, uploads exif-orientation-6.jpg, asserts attachment/title/URLs, downloads and inspects original and thumbnail for rotation and EXIF removal, tests rotation-disabled behavior, and cleans up/restores settings.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

community

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and specifically describes the main change: adding tests for image upload with rotation and EXIF handling.
Linked Issues check ✅ Passed The code changes fully implement the test requirements from both linked issues: CORE-1563 and QA-112, verifying image rotation behavior, EXIF stripping, thumbnail generation, and both enabled/disabled states.
Out of Scope Changes check ✅ Passed All changes are directly aligned with the linked issue objectives; the new test file solely addresses image rotation and EXIF handling validation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

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

Choose a reason for hiding this comment

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

No issues found across 2 files

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 (1)
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts (1)

92-94: Restore per-test setting changes in a finally block.

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

📥 Commits

Reviewing files that changed from the base of the PR and between e7807d0 and 8d10bb5.

⛔ Files ignored due to path filters (1)
  • apps/meteor/tests/mocks/files/exif-orientation-6.jpg is 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
Copy link

codecov bot commented Mar 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.86%. Comparing base (92a3e47) to head (bff902d).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             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     
Flag Coverage Δ
e2e 60.40% <ø> (+0.02%) ⬆️
e2e-api 47.83% <ø> (-1.01%) ⬇️
unit 71.55% <ø> (+0.18%) ⬆️

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.

Copy link
Contributor

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

Choose a reason for hiding this comment

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

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.

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.

♻️ Duplicate comments (1)
apps/meteor/tests/end-to-end/api/file-upload-image-rotation.ts (1)

49-56: ⚠️ Potential issue | 🟠 Major

Use Promise.allSettled in teardown to prevent cleanup errors from masking root failures.

At Line 50, Promise.all can fail fast when one cleanup promise rejects, which makes teardown less resilient and can hide the primary failure signal. Promise.allSettled is 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

📥 Commits

Reviewing files that changed from the base of the PR and between bcabff3 and bff902d.

📒 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);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a question, do we need the debounce for updateSetting?
Or await updateSetting('FileUpload_RotateImages', true, false); would work as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

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?

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