Skip to content

fix(e2e): clear file input before setInputFiles to fix TC08#270

Merged
FSM1 merged 1 commit into
mainfrom
fix/e2e-tc08-reupload-same-file
Mar 5, 2026
Merged

fix(e2e): clear file input before setInputFiles to fix TC08#270
FSM1 merged 1 commit into
mainfrom
fix/e2e-tc08-reupload-same-file

Conversation

@FSM1

@FSM1 FSM1 commented Mar 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • TC08 (permanent delete of versioned file reclaims all quota) failed because the v2 re-upload of the same file path didn't trigger Chromium's change event on the <input type="file">
  • Fix: clear input.value = '' in UploadZonePage.uploadFile() before calling setInputFiles, ensuring the change event always fires even when re-selecting the same disk path
  • No production code changes — test infrastructure only

Test plan

  • TC08 passes locally with fresh account (was consistently failing before)
  • Full recycle-bin suite (TC01–TC08) passes with no regressions
  • CI E2E tests pass

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Fixed file upload functionality to properly handle re-uploading the same file, ensuring change events are triggered correctly on file input reset.

When TC08 uploads v2 of a file with the same disk path as v1, Chromium
skips the change event because the input value hasn't changed. Clearing
input.value before setInputFiles ensures the change event always fires.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: bd5084e0c4c4
@coderabbitai

coderabbitai Bot commented Mar 5, 2026

Copy link
Copy Markdown

Walkthrough

Modified the uploadFile method in the UploadZonePage test utility to reset the file input value before setting a new file path. This ensures that re-uploading the same file correctly triggers change events by clearing the input state first.

Changes

Cohort / File(s) Summary
Upload Zone Page Object
tests/e2e/page-objects/file-browser/upload-zone.page.ts
Added input reset step in uploadFile method to clear previous file value, ensuring change events are properly triggered when re-uploading identical files.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 3
✅ 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 accurately identifies the main fix: clearing the file input before setInputFiles to resolve test case TC08, which directly matches the change made to UploadZonePage.uploadFile.
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.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/e2e-tc08-reupload-same-file

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
tests/e2e/page-objects/file-browser/upload-zone.page.ts (1)

57-59: Consider applying the same pre-clear step to uploadFiles for consistency.

The uploadFiles method could encounter the same issue if a test re-uploads the same array of file paths. For consistency and to prevent future debugging headaches, consider adding the same el.value = '' clearing here.

♻️ Suggested fix
 async uploadFiles(filePaths: string[]): Promise<void> {
+  // Clear previous selection so re-uploading the same file paths triggers change
+  await this.fileInput().evaluate((el: HTMLInputElement) => {
+    el.value = '';
+  });
   await this.fileInput().setInputFiles(filePaths);
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/e2e/page-objects/file-browser/upload-zone.page.ts` around lines 57 -
59, The uploadFiles method can fail when re-uploading the same file paths
because the input value wasn't cleared; modify uploadFiles to first clear the
underlying input element (set el.value = '') before calling
this.fileInput().setInputFiles(filePaths) — locate the uploadFiles method and
the helper fileInput() in upload-zone.page.ts and add the same pre-clear step
used elsewhere to ensure repeated uploads work reliably.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@tests/e2e/page-objects/file-browser/upload-zone.page.ts`:
- Around line 57-59: The uploadFiles method can fail when re-uploading the same
file paths because the input value wasn't cleared; modify uploadFiles to first
clear the underlying input element (set el.value = '') before calling
this.fileInput().setInputFiles(filePaths) — locate the uploadFiles method and
the helper fileInput() in upload-zone.page.ts and add the same pre-clear step
used elsewhere to ensure repeated uploads work reliably.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 38af3696-d78c-4636-bfe7-6b16c99cbbaf

📥 Commits

Reviewing files that changed from the base of the PR and between 15a7ece and 5cbd784.

📒 Files selected for processing (1)
  • tests/e2e/page-objects/file-browser/upload-zone.page.ts

@FSM1 FSM1 merged commit ec34d0a into main Mar 5, 2026
20 checks passed
@FSM1 FSM1 deleted the fix/e2e-tc08-reupload-same-file branch March 5, 2026 03:33
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.

1 participant