Skip to content

test(examples): add end-to-end test for the database CRUD example - #1622

Merged
spydon merged 1 commit into
mainfrom
examples/database-crud-e2e-test
Jul 20, 2026
Merged

spydon merged 1 commit into
mainfrom
examples/database-crud-e2e-test

Conversation

@spydon

@spydon spydon commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

What

Adds a full end-to-end integration test for the database_crud example, matching the one added for realtime_room. It drives the actual app widgets against the local Supabase stack rather than calling the repository directly.

The test

integration_test/tasks_test.dart uses testWidgets to:

  1. Pump CrudExampleApp and wait for the seeded tasks to load (select).
  2. Filter by title through the search field and assert the list narrows, then clears (ilike).
  3. Create a task through the new-task dialog and assert it appears (insert).
  4. Complete it by ticking the checkbox in its tile and assert the checkbox becomes checked (update).
  5. Rename it through the edit dialog and assert the new title replaces the old (update).
  6. Delete it and assert it leaves the list (delete).

Because reads and writes go over the network, the UI can't be settled with pumpAndSettle; a small _pumpUntil helper polls the widget tree with a timeout instead. The test uses a unique task title and a tearDown that removes any E2E % rows, so it runs repeatably and leaves the seed data untouched.

Also adds the integration_test dev dependency and an "Integration test" section to the example README.

Testing

  • flutter analyze: no issues; dart format: clean.
  • Ran end to end against a local stack, twice, both green. Integration tests need a device, so run it with -d macos, an emulator or a real device.

@spydon
spydon requested a review from a team as a code owner July 20, 2026 11:31
@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ad05978e-89bc-48d3-8805-30cb9820b9f1

📥 Commits

Reviewing files that changed from the base of the PR and between 7b7953e and 259b583.

⛔ Files ignored due to path filters (1)
  • pubspec.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • examples/database_crud/README.md
  • examples/database_crud/integration_test/tasks_test.dart
  • examples/database_crud/pubspec.yaml

📝 Walkthrough

Summary by CodeRabbit

  • Documentation

    • Added instructions for running the database CRUD integration test against a local Supabase instance.
  • Tests

    • Added end-to-end coverage for viewing, filtering, creating, completing, renaming, and deleting tasks.
    • Added validation that UI updates correctly reflect each task operation.

Walkthrough

The database CRUD example now includes a Flutter integration test against a local Supabase instance. The test verifies seeded task reads, filtering, creation, completion, renaming, deletion, and cleanup. Polling helpers handle asynchronous UI updates. The README documents the test flow and command-line configuration, and integration_test is added as a development dependency.

Sequence Diagram(s)

sequenceDiagram
  participant IntegrationTest
  participant FlutterApp
  participant Supabase
  IntegrationTest->>Supabase: Initialize local client
  IntegrationTest->>FlutterApp: Exercise task UI
  FlutterApp->>Supabase: Read and modify tasks
  Supabase-->>FlutterApp: Return updated task data
  FlutterApp-->>IntegrationTest: Render asserted state
Loading

Possibly related PRs

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Checkov (3.3.8)
examples/database_crud/pubspec.yaml

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'


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.

@spydon
spydon merged commit 0931f0a into main Jul 20, 2026
38 checks passed
@spydon
spydon deleted the examples/database-crud-e2e-test branch July 20, 2026 12:11
Vinzent03 pushed a commit that referenced this pull request Jul 28, 2026
)

## What

Adds a full end-to-end integration test for the `database_crud` example,
matching the one added for `realtime_room`. It drives the actual app
widgets against the local Supabase stack rather than calling the
repository directly.

## The test

`integration_test/tasks_test.dart` uses `testWidgets` to:

1. Pump `CrudExampleApp` and wait for the seeded tasks to load (select).
2. **Filter** by title through the search field and assert the list
narrows, then clears (ilike).
3. **Create** a task through the new-task dialog and assert it appears
(insert).
4. **Complete** it by ticking the checkbox in its tile and assert the
checkbox becomes checked (update).
5. **Rename** it through the edit dialog and assert the new title
replaces the old (update).
6. **Delete** it and assert it leaves the list (delete).

Because reads and writes go over the network, the UI can't be settled
with `pumpAndSettle`; a small `_pumpUntil` helper polls the widget tree
with a timeout instead. The test uses a unique task title and a
`tearDown` that removes any `E2E %` rows, so it runs repeatably and
leaves the seed data untouched.

Also adds the `integration_test` dev dependency and an "Integration
test" section to the example README.

## Testing

- `flutter analyze`: no issues; `dart format`: clean.
- Ran end to end against a local stack, twice, both green. Integration
tests need a device, so run it with `-d macos`, an emulator or a real
device.
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