* Add multiselect, dynamic select, multiform, and field refresh support for Interactive Dialogs This PR adds comprehensive support for advanced interactive dialog features through the DialogRouter component, which routes between legacy InteractiveDialog and modern AppsForm implementations based on the FeatureFlagInteractiveDialogAppsForm feature flag. Features Added: - Multiselect support for select fields (users, channels, static options) - Dynamic select fields with server-side lookup and search - Multiform/multistep dialogs with state preservation across steps - Field refresh functionality to update form fields based on selections Core Components: - DialogRouter: Routes between legacy InteractiveDialog and AppsForm based on feature flag - InteractiveDialogAdapter: Converts between dialog formats and handles submission/lookup - dialog_conversion utilities: Convert DialogElement to AppField format - Enhanced autocomplete_selector with multiselect support - Integration selector improvements for multiselect workflows Technical Implementation: - Follows webapp DialogRouter pattern (PR #31821) - Uses WeakMap caching for expensive form conversions - Proper error handling and validation for all field types - Comprehensive unit test coverage for conversion logic Bug Fixes: - Fix dynamic select to fetch initial options with empty search input - Fix multiselect value handling in dialog submission - Add proper multiselect support in dialog-to-form conversion Note: Changes only affect AppsForm path. Legacy InteractiveDialog remains unchanged and will only support basic features (no multiselect/dynamic/multiform). Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com> * Add E2E tests and test infrastructure for interactive dialog features E2E Tests Added (18 tests, all passing in ~10 minutes): - MM-T4976: Multiselect fields (users, channels, options) - MM-T4977: Dynamic select fields with search - MM-T4980: Multistep dialog progression - MM-T4981: Multistep dialog cancellation - MM-T4983: Field refresh basic interaction - MM-T4986: Field refresh changes and cancellation - Plus 12 existing tests for basic dialogs, text fields, boolean fields Test Infrastructure: - Add interactive_dialog_test_helper with setup utilities - Add webhook server support for dynamic plugin installation - Enhanced integration_selector screen helpers for multiselect testing - Add helper functions for user/channel selection Test Optimizations: - Replace arbitrary 2s waits with waitFor() for dynamic search results - Reduce buffer waits from 500ms to 300ms where appropriate - Add swipe gesture in ensureDialogClosed() to reveal posts hidden behind keyboard - Tests optimized for speed while maintaining reliability Bug Fixes in Tests: - Fix MM-T4976 to use selectUser() helper instead of incorrect test data - Remove multiform code incorrectly merged into MM-T4977 dynamic select test - Add proper cleanup between tests to prevent state accumulation All tests verified passing multiple times with proper synchronization. Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com> * Fix integration selector tap handling on Android and update E2E tests Bug Fix - Integration Selector: - Replace KeyboardAwareFlatList with regular FlatList to fix tap handling on Android API 34+ - Add platform-specific keyboard dismiss behavior (onScrollBeginDrag for Android, on-drag for iOS) - Follows the same pattern as invite/selection and user_list components Issue: KeyboardAwareFlatList prevents taps on search results after typing in the search field on Android API 34+. Users could not select dynamic options after searching, making dynamic select fields unusable on Android. E2E Test Updates: - Add waitFor() with 3s timeout instead of immediate expect for dynamic field buttons - Add 300ms buffer wait after selecting first dynamic option before checking for second field - Ensures proper timing for dialog re-render after integration selector closes Testing: - All 18 E2E tests passing locally on Android Pixel 4 XL API 34 (~8.4 minutes) - Verified dynamic select, multiselect, multiform, and field refresh functionality Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com> * Address code review feedback for interactive dialog improvements - Move API call to client layer: Added lookupInteractiveDialog method to client mixin following ClientMix pattern - Extract error message function: Created getSubmissionErrorMessage helper to improve readability - Simplify nullish coalescing: Use ?? operator instead of ternary for notify_on_cancel - Add error logging: Added logDebug in autocomplete selector and performLookupCall catch blocks - Improve field.name handling: Added early return check and removed unnecessary fallback - Remove type cast: Use object spread instead of 'as any' for refresh submission - Simplify refresh logic: Removed verbose debug logs from dialog conversion - Revert PROFILE_CHUNK_SIZE: Changed back from 10 to 100 (unintentional change) - Revert test config: Changed serverOneUrl back to localhost (unintentional change) Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com> * Add date/datetime field support with timezone features Core Features: - Add DATE and DATETIME field types for Apps Forms - User timezone and military time preferences via database observables - Relative date support (today, tomorrow, +5d, -2w, +1m) - Location timezone override with visual indicator (🌍 Times in GMT/PST) - Min/max date constraints with relative date resolution - Configurable time intervals (iOS: 1-30 min, fallback 60→30) - Required field validation prevents empty submission - allowPastDates logic (defaults to false, auto-calculated from min_date) Implementation: - DateTimeSelector component with timezone-aware display - parseDateInTimezone utility for proper date parsing - Dialog to AppForm conversion preserves datetime_config - Proper UTC conversion regardless of display timezone - Fix date off-by-one errors from timezone conversion - Fix field label overlap with flexbox layout Type Definitions: - Add min_date, max_date, time_interval, datetime_config to AppField - Define DateTimeConfig (time_interval, location_timezone, is_range, etc) - Update DialogElement and InteractiveDialogElementType Testing: - 52 unit tests passing (date utilities, validation, integration) - 7 E2E tests passing (field display, validation, timezone, UTC conversion) - Comprehensive coverage for relative dates, timezone parsing, validation Architecture: - withObservables HOC pattern for reactive user preferences - Only modifies apps_form (not deprecated interactive_dialog) - Clean separation of utilities, components, and observables - Follows existing patterns from custom_status/scheduled_posts * move performDynamicLookup and use currentConfig * Fix code review findings for datetime field support - Hoist useMemo/hook calls out of switch-case (Rules of Hooks fix) - Wrap AppsFormFieldComponent with React.memo - Extract dateTimeStyles to makeStyleSheetFromTheme at module scope - i18n: replace hardcoded "Times in", "Select Date", "Select Time" strings - Remove spurious handleChange calls from picker toggle buttons - Add .clone() to prevent moment mutations in resolveRelativeDate and getDateValue - Fix test: remove private _d field access, assert no-call on toggle - Fix getStyleSheet return syntax in DateTimeSelector Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Align mobile date/datetime with webapp and migrate E2E tests Date/DateTime parity with webapp: - Change default time interval from 30 to 60 minutes - Add time offset support (+H, +M, +S) to resolveRelativeDate - Add manual time entry with parseTimeString for allow_manual_time_entry - Auto-populate required datetime fields with rounded current time - Remove unused range fields from DateTimeConfig type - Extract DEFAULT_TIME_INTERVAL_MINUTES to shared constant - Use effectiveInterval for consistent iOS picker/rounding alignment - Wrap handlers in useCallback, use typography() and changeOpacity() - Add logWarning for +M disambiguation and null date parse failures - Internationalize date-time separator string E2E test infrastructure: - Migrate all dialog tests from demo plugin to test plugin - Replace DemoPlugin with TestPlugin constant - Remove duplicate MM-T4986 test and demo-plugin activation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix line spacing nit * remove file, update alphabetically * Fix code review findings for datetime field support Bug fixes: - Fix relative time offsets (+2H, +30M) being overwritten with current time in getDateValue — skip time replacement for HMS offsets - Handle Android picker dismiss (event.type === 'dismissed') to prevent silently filling fields when user cancels - Parse minDate/maxDate with field timezone via parseDateInTimezone to avoid off-by-one at timezone day boundaries - Use field's location_timezone in initValues for correct auto-defaults - Fix parseDateInTimezone to use timezone for date-only strings Improvements: - Add database teardown in DateTimeSelector test (afterAll cleanup) - Fail fast in apiGetLatestPluginVersion instead of wrong fallback - Stronger E2E assertions: validation error text in MM-T2530B, ISO datetime pattern check in MM-T2530F - Extract ISO_DATETIME_PATTERN constant for E2E test reuse - Use typography() in apps_form_field.tsx stylesheets - Internationalize hardcoded 'at' date-time separator Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix by.text() RegExp usage in MM-T2530G timezone test Detox's by.text() only accepts strings, not RegExp. Use API to fetch the submission post and validate ISO datetime pattern in JavaScript, matching the approach used in MM-T2530F. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Address CodeRabbit R2 findings in E2E tests - Enforce UTC suffix (Z or ±HH:MM) in ISO_DATETIME_PATTERN - Make required-field validation assertion mandatory (remove try/catch) - Fail fast when field refresh element not found (remove silent fallback) - Remove commented-out pluginInstallAndEnable dead code Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add unit tests for datetime business logic Cover parseTimeString, initValues datetime auto-population, getDateValue/isTimeOffset, and datetime_config preservation in dialog_conversion — areas flagged as uncovered in PR test check. Export the four helpers from their modules so tests can exercise them directly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Pin demo plugin install via fixture upload + add datetime E2E tests Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Auto-download demo plugin tarball into fixtures Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Configure demo plugin user/channel/lastname for fresh-install path Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Add datetime E2E tests and isolate iOS 26 keyboard contamination Adds MM-T2530A-H covering date/datetime field rendering, validation, picker interaction, defaults, UTC submit, timezone indicator, and manual time entry. Manual entry placed last (T2530H) since the TextInput keyboard cycle leaves animation state on iOS 26 + react-native-keyboard-controller that breaks subsequent dialog tests. Skips T4983 with TODO referencing the same iOS 26 keyboard contamination (field-refresh dialog with text inputs poisons RCTRefreshControl with progressViewOffset NaN). Refines selectUser/selectChannel helpers to target by entity ID for when the iOS 26 + Detox UserItem TouchableOpacity hit-test regression is resolved upstream and skipped tests can be re-enabled. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix lint and update tests for updates to main * fix bad import * updates for code review, move/rename files * Restore UserItem testID on the touchable (from reverted #9790) #9790 (Rainforest→Detox migration) was reverted in #9834, which dropped this fix. On iOS 26, Detox synthetic taps don't propagate from the inner testID-bearing View to the parent TouchableOpacity, so integration-selector user rows weren't selectable in E2E. Move the testID onto the TouchableOpacity (as CustomListRow already does) to make the row tappable again. * Update user_list snapshot for UserItem testID move * updates from main merge, review fixes * fix e2etests * fix bad merge * fix failing test caused by bad merge --------- Co-authored-by: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com> Co-authored-by: Mattermost Build <build@mattermost.com> |
||
|---|---|---|
| .. | ||
| android_emulator | ||
| e2e | ||
| maestro | ||
| provision | ||
| scripts | ||
| utils | ||
| .babelrc | ||
| .detoxrc.json | ||
| CLAUDE.md | ||
| create_android_emulator.sh | ||
| generate_unified_report.js | ||
| inject-detox-settings.js | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| save_maestro_zephyr.js | ||
| 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
Configure your server details
in detox/e2e/support/test_config.ts will provide some default values for your server, if they differ you can:
- use environment variables
export SITE_1_URL="http://your-server:8065"
export ADMIN_USERNAME="your-username"
export ADMIN_PASSWORD="your-password"
export ADMIN_EMAIL="your-email"
- create a .env file in the
detoxfolder providing the values:
# detox/.env
SITE_1_URL=http://localhost:8065
ADMIN_USERNAME=your-username
ADMIN_PASSWORD=your-password
ADMIN_EMAIL=your-email@example.com
Note: no need to provide all variables, only the ones that differ.
Android
Build Detox Android App
To build the Detox Android app, navigate to the detox folder and run:
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>
Local runs now default to a lower-memory setup so they coexist better with other tools:
- Detox uses
1worker unless you setDETOX_MAX_WORKERS. - Detox caps Node heap at
4096MBunless you already setNODE_OPTIONS. - Android Detox builds cap Gradle heap at
3072MBand use at most2Gradle workers unless you overrideMM_GRADLE_XMX_MBorMM_GRADLE_WORKERS_MAX. - Android emulator RAM defaults to
3072MBwhen created or refreshed; override withMM_ANDROID_EMULATOR_RAM_MB.
iOS
Build iOS Simulator
To build the iOS simulator for Detox, from the project folder run:
npm run e2e:ios-build
This will build the Simulator .zip file at the root folder.
Create a folder named mobile-artifacts at the project root. Move the zip file under mobile-artifacts and unzip it there.
# From project root
mkdir mobile-artifacts
Configure your local
Update detox/.detoxrc.json to specify which device you want to run it. Change:
"device": {
"type": "__DEVICE_NAME__",
"os": "__DEVICE_OS_VERSION__"
},
to something like:
"device": {
"type": "iPhone 17 Pro",
"os": "iOS 26.4"
},
To get your values run xcrun simctl list devices to find both the device and iOS version.
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
from iOS v26 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:
- if using iOS 26 or later
- 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: