* Add two-phase tool call approval for agents in channels Implements the mobile counterpart to the webapp's multiplayer tool calling feature. When a bot is @mentioned in a channel, tool call arguments and results are redacted from other members. Only the invoker can approve/reject tool execution (Phase 1) and decide whether to share results with the channel (Phase 2). See mattermost/mattermost-plugin-agents#491 for the server/webapp changes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add tests for channel tool calling utilities and remote actions Tests for isToolCallRedacted, isPendingToolResult, getToolApprovalStage, mergeToolCalls utility functions and fetchToolCallPrivate, fetchToolResultPrivate, submitToolResult remote actions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add e2e tests and testIDs for agent tool calls in channels Adds detox e2e tests covering tool call card rendering, approval buttons, result approval phase, and multi-tool-call scenarios. Adds testID props to ToolApprovalSet and ToolCard components to support the e2e tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Address PR review feedback for two-phase tool call approval - Fix mergeToolCalls to preserve public-only tools instead of dropping them - Fix stale closure race in handleToolDecision with functional setState - Add forceLogoutIfNecessary to tool_private and tool_result remote actions - Show snackbar on submit failure using existing error types - Reset isDM in catch block to prevent stale state - Sync animation shared values when isCollapsed changes externally - Clear private data on streaming-to-persisted transition - Wrap action buttons with usePreventDoubleTap - Use toolCalls reference instead of toolCalls.length in effect dependency - Fix grammar in warning callout ("its" -> "their") - Change fontWeight from number to string per RN conventions Co-authored-by: Cursor <cursoragent@cursor.com> * Address PR review feedback: withObservables HOC, memoization, typography - Refactor AgentPost to use withObservables HOC for channel observation instead of useEffect+subscribe, providing isDM as a prop - Memoize undecidedCount in ToolApprovalSet and move before early return - Replace manual font styles with typography() utility in ToolCard Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com> |
||
|---|---|---|
| .. | ||
| android_emulator | ||
| e2e | ||
| utils | ||
| .babelrc | ||
| .detoxrc.json | ||
| create_android_emulator.sh | ||
| inject-detox-settings.js | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| save_report.js | ||
| tsconfig.json | ||
| webhook_server.js | ||
How to Run Detox Tests
This guide will help you set up and run Detox tests for your project.
Install Dependencies
First, navigate to the root directory of your project and install the necessary dependencies by running:
npm install
navigate to the detox folder and run npm install
Android
Build Detox Android App
To build the Detox Android app, navigate to the detox folder and run:
npm run e2e:android-inject-settings
npm run e2e:android-build
The debug apk will be built and available at android/app/build/outputs/apk/debug/app-debug.apk
Run Detox Android Tests
Create emulator
./create_android_emulator.sh SDK_VERSION AVD_NAME
# example ./create_android_emulator.sh 34 pixel_5a_avd
# example ./create_android_emulator.sh 34 pixel_5a_avd --headless
# If we want to see the emulator logs. Run it in debug mode example ./create_android_emulator.sh 34 pixel_5a_avd --debug
To execute the Detox tests on Android, navigate to the detox folder and run:
npm run e2e:android-test
# To run a particular tests
npm run e2e:android-test <path to test file>
iOS
Build iOS Simulator
To build the iOS simulator for Detox, navigate to the detox folder and run:
npm run e2e:ios-build
This will build the Simulor .zip file at the root folder.
Create a folder named mobile-artifacts at the project root. Unzip the zip file and move the mattermost app under mobile-artifacts.
# From project root
mkdir mobile-artifacts
Run iOS Tests
To execute the Detox tests on iOS, navigate to the detox folder and run:
npm run e2e:ios-test
# To run a particular tests
npm run e2e:android-test path to test file.
Disabling Password Autofill (Optional)
iOS password autofill can interfere with login tests by automatically filling credentials. To disable this feature on your simulator:
# Interactive mode - select simulator from list
npm run e2e:ios-disable-autofill
# Or specify simulator ID directly
npm run e2e:ios-disable-autofill -- --simulator-id SIMULATOR_UDID
When to use this:
- Before running iOS E2E tests if you notice password fields being auto-filled
- When login tests fail unexpectedly due to autofill interference
- After creating a new iOS simulator for testing
Note: CI environments automatically disable this setting, so this is only needed for local development.
Finding your simulator ID:
xcrun simctl list devices | grep Booted
TIP : For iOS, you can download the simulator from ~Mobile: Test build or ~Release: Mobile Apps channel in the community.
Results
The Local Runs generate artifacts under detox/artifacts/ios-debug-** or detox/artifacts/android-debug-**.
You can see the html report, failure screenshot under that folder.
Playbooks Tests (AI-Powered Testing)
The Playbooks tests leverage AI-powered testing through the Wix Pilot framework, enabling natural language test creation and execution.
How It Works
The Playbooks tests utilize the pilot library, which connects to Anthropic Claude via the ClaudePromptHandler. This innovative approach allows you to:
- Write tests using natural language prompts
- Automatically translate prompts into executable test steps
- Maintain tests more intuitively through conversational interfaces
- Handle complex scenarios with AI-generated test logic
The system integrates seamlessly with your existing Detox test infrastructure while adding AI capabilities.
Best Practices
For reliable and effective Playbooks tests, follow these guidelines from the Pilot Best Practices Guide:
-
Prompt Clarity:
- Write clear, concise prompts
- Use specific action-oriented language
- Avoid ambiguous phrasing
-
Test Design:
- Keep prompts focused on single scenarios
- Use deterministic language to prevent flaky tests
- Structure complex tests as sequences of simple prompts
-
Maintenance:
- Review AI-generated test steps before committing
- Version control both prompts and generated code
- Monitor test stability regularly
-
Integration:
- Combine AI tests with traditional assertions
- Use AI for complex scenarios, traditional methods for simple verifications
- Document which tests are AI-generated
Getting Started
To run Playbooks tests:
-
Set up your environment:
export ANTHROPIC_API_KEY='your-api-key-here' -
Run tests normally:
- The system will automatically initialize the
ClaudePromptHandlerwhen the API key is detected - No additional configuration is required beyond the API key
- The system will automatically initialize the
-
Execution examples:
# Run all Playbooks tests npm run e2e:android-test tests/playbooks/ # Run a specific Playbook test npm run e2e:ios-test tests/playbooks/playbooks_basic.e2e.ts
Technical Notes
- The Pilot framework handles the translation between natural language prompts and executable code
- Tests are cached locally after generation for faster subsequent runs
- All AI interactions are logged in the test artifacts for debugging
- The system falls back to traditional testing methods if the API key isn't available
For complete documentation, see: