Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/camera/camera_android_camerax/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@
- Maintain high test coverage using [dart-add-unit-test](.agents/skills/dart-add-unit-test/SKILL.md)
and [dart-collect-coverage](.agents/skills/dart-collect-coverage/SKILL.md).
- Avoid duplicating constant strings; reuse existing ones from adjacent code.
- **Testing Guidelines**: You MUST read and follow all rules in [TESTING.md](TESTING.md) BEFORE writing or modifying any tests. This is CRITICAL for preventing CI flakiness.
- **CRITICAL**: When spawning subagents, NEVER provide absolute file paths in prompts. ALWAYS use relative paths. Passing absolute paths breaks `Workspace: branch` isolation and causes state bleed into the active workspace.
9 changes: 9 additions & 0 deletions packages/camera/camera_android_camerax/TESTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Testing Best Practices

This document outlines testing rules and best practices for the `camera_android_camerax` package. All contributors MUST follow these guidelines to prevent CI flakiness and maintain code quality.

## Integration Tests

- **Video Recording Delay**: You MUST add a delay of at least 4 seconds (e.g., `await Future<void>.delayed(const Duration(seconds: 4));`) before stopping a video recording.
- *Why*: Both physical Android devices and emulators require time for the CameraX encoder to initialize and capture actual video frames. Stopping immediately will result in an empty or corrupted file, causing CI flakes.
- *Example*: See the `video recording state is cleared after camera is disposed` test in [`example/integration_test/integration_test.dart`](example/integration_test/integration_test.dart).
Loading