Skip to content

[Part 2][TF-4479] Add integration tests for clear trash subfolders#4577

Open
dab246 wants to merge 8 commits into
enhancement/tf-4479-remove-trash-sub-folders-r3from
enhancement/tf-4479-e2e-clear-trash-subfolders
Open

[Part 2][TF-4479] Add integration tests for clear trash subfolders#4577
dab246 wants to merge 8 commits into
enhancement/tf-4479-remove-trash-sub-folders-r3from
enhancement/tf-4479-e2e-clear-trash-subfolders

Conversation

@dab246

@dab246 dab246 commented Jun 2, 2026

Copy link
Copy Markdown
Member

Summary

  • Add e2e scenarios for clearing trash subfolders via context menu and via empty-trash banner
  • Extend robots (MailboxMenuRobot, ThreadRobot, web variants) with clear-trash actions
  • Add scenario utils for trash subfolder setup

Result

✅ Should delete trash subfolders when emptying trash via banner (/tests/mailbox/clear_trash_subfolders_via_banner_test.dart) (9s)
✅ Should delete trash subfolders when emptying trash via context menu (/tests/mailbox/clear_trash_subfolders_via_context_menu_test.dart) (8s)

Test summary:
📝 Total: 2
✅ Successful: 2
❌ Failed: 0
⏩ Skipped: 0
📊 Report: /Users/datvu/WorkingSpace/tmail-flutter/playwright-report
⏱️  Duration: 39s

Summary by CodeRabbit

  • Tests
    • Added comprehensive integration test coverage for trash management features, including clearing trash subfolders via banner and context menu interactions on mobile and web platforms.

@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b2675390-8ebc-4e6c-95a8-bac150854c25

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch enhancement/tf-4479-e2e-clear-trash-subfolders

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.

codescene-delta-analysis[bot]

This comment was marked as outdated.

@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown

This PR has been deployed to https://linagora.github.io/tmail-flutter/4577.

@dab246 dab246 force-pushed the enhancement/tf-4479-remove-trash-sub-folders-r3 branch 2 times, most recently from 75716c3 to 06d87d2 Compare June 4, 2026 03:34
@dab246 dab246 force-pushed the enhancement/tf-4479-e2e-clear-trash-subfolders branch from f28fbe6 to 3d2b65d Compare June 9, 2026 09:20
@dab246 dab246 marked this pull request as ready for review June 9, 2026 09:20
codescene-delta-analysis[bot]

This comment was marked as outdated.

@coderabbitai coderabbitai 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.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@integration_test/mixin/scenario_utils_mixin.dart`:
- Around line 308-310: The current guard uses "isMissingRequiredData" (session,
accountId, trashMailboxId) and returns silently, which can allow false-positive
tests; replace the early return with a failing setup exception (e.g., throw a
StateError or test failure) that includes which of
session/accountId/trashMailboxId is missing and a clear message referencing the
clear-trash provisioning step so test harnesses immediately fail rather than
continuing without the trash subfolder.

In `@integration_test/robots/web/web_thread_robot.dart`:
- Around line 54-63: The fireOnTap helper is brittle because it force-casts
span.recognizer to TapGestureRecognizer and silently does nothing when no
tappable span matches; update fireOnTap (and the analogous method around lines
67–72) to: iterate only over TextSpan children, check that span.text == text,
then check recognizer is non-null and is a TapGestureRecognizer (using an
is-type check) before calling onTap; if the recognizer is not the expected type
or no matching tappable span is found, surface a clear failure (throw a
descriptive exception or assert) so tests fail fast and the runtime cast cannot
throw unexpectedly.

In
`@integration_test/scenarios/mailbox/clear_trash_subfolders_via_banner_scenario.dart`:
- Around line 20-30: After provisioning the trash subfolder with
provisionTrashSubfolder(_subfolderName) and navigating to the Trash, add a
pre-action assertion that the subfolder exists (the counterpart to
expectSubfolderNotExist) before performing the delete flow; locate the
setup/navigation around provisionTrashSubfolder, threadRobot.openMailbox,
mailboxMenuRobot.openFolderByName and threadRobot.expectTrashBannerVisible and
insert a call to the existing positive assertion (e.g., expectSubfolderExist or
expectSubfolderVisible that mirrors expectSubfolderNotExist) using
_subfolderName, then continue with the delete and final expectSubfolderNotExist
assertion.

In
`@integration_test/scenarios/mailbox/clear_trash_subfolders_via_context_menu_scenario.dart`:
- Around line 20-30: Add an explicit precondition assertion that the provisioned
trash subfolder exists before invoking the context-menu "empty trash" flow:
after calling provisionTrashSubfolder(_subfolderName) and before triggering the
context menu actions (e.g., before
threadRobot.openMailbox()/mailboxMenuRobot.openFolderByName and before the
corresponding section at lines 39-41), call the existing assertion helper (e.g.,
expectSubfolderExists or a mailboxRobot method that checks folder presence) to
verify _subfolderName is present; this ensures the test fails if setup didn't
create the subfolder rather than silently passing and only relying on the later
expectSubfolderNotExist check.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 76db336a-894d-4997-8857-590a741399cc

📥 Commits

Reviewing files that changed from the base of the PR and between 034ee22 and 3d2b65d.

📒 Files selected for processing (14)
  • integration_test/mixin/scenario_utils_mixin.dart
  • integration_test/robots/abstract/abstract_mailbox_menu_robot.dart
  • integration_test/robots/abstract/abstract_thread_robot.dart
  • integration_test/robots/mailbox_menu_robot.dart
  • integration_test/robots/mobile/mobile_thread_robot.dart
  • integration_test/robots/thread_robot.dart
  • integration_test/robots/web/web_mailbox_menu_robot.dart
  • integration_test/robots/web/web_thread_robot.dart
  • integration_test/scenarios/mailbox/clear_trash_subfolders_via_banner_scenario.dart
  • integration_test/scenarios/mailbox/clear_trash_subfolders_via_context_menu_scenario.dart
  • integration_test/tests/mailbox/clear_trash_subfolders_via_banner_test.dart
  • integration_test/tests/mailbox/clear_trash_subfolders_via_context_menu_test.dart
  • lib/features/base/model/ui_keys.dart
  • lib/features/mailbox/presentation/widgets/label_mailbox_item_widget.dart

Comment thread integration_test/mixin/scenario_utils_mixin.dart Outdated
Comment thread integration_test/robots/web/web_thread_robot.dart
codescene-delta-analysis[bot]

This comment was marked as outdated.

@dab246 dab246 force-pushed the enhancement/tf-4479-remove-trash-sub-folders-r3 branch from 034ee22 to cf6f0a6 Compare June 11, 2026 08:59
@dab246 dab246 force-pushed the enhancement/tf-4479-e2e-clear-trash-subfolders branch from c9c2e4e to a0a4d00 Compare June 11, 2026 09:09
codescene-delta-analysis[bot]

This comment was marked as outdated.

codescene-delta-analysis[bot]

This comment was marked as outdated.

dab246 added 2 commits June 11, 2026 16:41
…r placeholder

Web dashboard rendered SizedBox.shrink() without the key when no banner is shown,
causing WebThreadRobot.expectTrashBannerInvisible() to hang on waitUntilExists().
codescene-delta-analysis[bot]

This comment was marked as outdated.

@codescene-delta-analysis codescene-delta-analysis 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.

Our agent can fix these. Install it.

Gates Passed
3 Quality Gates Passed

Quality Gate Profile: The Bare Minimum
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

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.

2 participants