Skip to content

Conversation

@Aathish101
Copy link

@Aathish101 Aathish101 commented Oct 9, 2025

Feature Preview


PR Checklist

  • My code adheres to AppFlowy's Conventions
  • I've listed at least one issue that this PR fixes in the description above.
  • I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes.
  • All existing tests are passing.

Summary by Sourcery

Add comprehensive integration tests for the template feature, covering UI presence, export file generation, and import behavior for both document and grid templates.

Enhancements:

  • Remove outdated document alignment tests and refactor test structure into focused groups
  • Replace manual alignment interactions with higher-level template feature tests

Tests:

  • Verify template option appears in share menu and add view dropdown
  • Test exporting a template creates template.zip and config.json in documents folder
  • Ensure CSV export for grid views when exporting templates
  • Validate importing a document template loads it into the editor with correct view structure
  • Validate importing a grid template reconstructs nested views with document and grid layouts

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 9, 2025

Reviewer's Guide

This PR completely refactors the integration test suite in document_alignment_test.dart by removing legacy alignment tests, updating imports to support localization and file system operations, and introducing new test groups that validate template UI options, export functionality (template.zip, config.json, CSV), and import behavior with view hierarchy verification.

File-Level Changes

Change Details Files
Updated imports and dependencies for localization, file system, and workspace services
  • Removed alignment-specific plugin and svg imports
  • Added locale_keys, workspace view_service, path, path_provider, mock_file_picker imports
  • Refactored imports to use easy_localization and backend protobuf
frontend/appflowy_flutter/integration_test/desktop/document/document_alignment_test.dart
Replaced old alignment tests with new template layout and functionality tests
  • Removed 'document alignment' group and related test cases
  • Added 'Template Layout Tests' group validating UI options in share and add dropdowns
  • Added 'Template Functionality Tests' group covering export and import workflows
frontend/appflowy_flutter/integration_test/desktop/document/document_alignment_test.dart
Added export tests for template generation
  • Test export of template.zip and config.json to application documents directory
  • Test export of CSV when a grid layout is present
  • Use path_provider to locate output paths and File/Directory APIs for assertions
frontend/appflowy_flutter/integration_test/desktop/document/document_alignment_test.dart
Added import tests for template zip and view hierarchy verification
  • Test importing document and database templates via mock file picker
  • Verify imported views and layouts in the editor and backend service
  • Introduced _initTest helper to initialize the test context, open pages, and prepare editor
frontend/appflowy_flutter/integration_test/desktop/document/document_alignment_test.dart

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-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.

Hey there - I've reviewed your changes - here's some feedback:

  • Ensure that files and directories created in getApplicationDocumentsDirectory are cleaned up between tests (or use a temporary directory) to avoid side-effects and flaky runs.
  • Consider mocking the file system or injecting a fake path_provider to isolate tests from the real device storage and speed up I/O operations.
  • You can reduce boilerplate by moving repeated _initTest calls and common setup into a setUp function at the top of each test group.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Ensure that files and directories created in getApplicationDocumentsDirectory are cleaned up between tests (or use a temporary directory) to avoid side-effects and flaky runs.
- Consider mocking the file system or injecting a fake path_provider to isolate tests from the real device storage and speed up I/O operations.
- You can reduce boilerplate by moving repeated _initTest calls and common setup into a setUp function at the top of each test group.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@LucasXu0 LucasXu0 closed this Oct 10, 2025
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.

3 participants