mattermost-mobile-upstream/detox/e2e/support
Guillermo Vayá 9e6f7144a3
Fix cross-device sync for attach logs preference (MM-67856) (#9667)
* Fix cross-device sync for attach logs preference (MM-67856)

WatermelonDB query .observe() only emits when records enter/leave the
result set, not when a field on an existing record changes. This caused
the attach logs toggle to not sync across devices after the initial
creation. Fix by subscribing to the individual record's .observe() via
switchMap, which emits on any field change.

Extract observePreferenceAsBool helper to app/queries/servers/preference.ts
and use it in both report_a_problem and quick_actions enhanced components.

Also adds unit tests, E2E tests, and debug logging for preference WS events.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Address PR review feedback for attach logs feature

- Add testID to Report a Problem screen and use screen.back.button in
  Detox screen object to match existing settings screen patterns
- Remove unused REPORT_PROBLEM_CLOSE_BUTTON_ID export
- Omit preference values from debug logs to avoid logging large or
  sensitive data
- Rename attachLogsPref to attachLogsEnabled for clarity

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* address review requests

* Fix attach_logs detox tests

Tests 2 and 3 navigated to ChannelScreen directly after closing Settings
while still on the Account tab; added ChannelListScreen.open() first.

Test 4 was writing AllowDownloadLogs under LogSettings, but the server
field lives under SupportSettings, so apiUpdateConfig silently had no
effect and the toggle stayed visible. Corrected the section and added
device.reloadReactNative() so the client picks up the updated config on
next startup.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Address PR review feedback

- preferences.ts: prefix logDebug calls with handler name per repo
  convention.
- report_a_problem/index.test.tsx: wrap the post-update assertion in
  waitFor() so the test doesn't race the observable emission.
- detox report_problem screen: use toBeVisible() matcher in toBeVisible()
  instead of toExist(), matching method intent.
- attach_logs.e2e.ts: wrap test 4 body in try/finally so the
  AllowDownloadLogs rollback always runs, preventing config leaks into
  later suites if an assertion fails.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* use observewithcolumns

* Log early returns in preference WS handlers

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-21 12:10:36 +02:00
..
fixtures Barebones code for v2 2020-11-17 14:20:58 -03:00
pilot feat: add AI-powered pilot framework for Detox E2E testing (#8981) 2025-09-16 09:33:38 +05:30
server_api MM-68200 About modal updates to show correct SKU and align with web (#9662) 2026-04-16 09:10:41 -04:00
ui Fix cross-device sync for attach logs preference (MM-67856) (#9667) 2026-04-21 12:10:36 +02:00
utils iOS & Android: Migrate 29 Channel Settings tests from Rainforest to Detox (#9313) 2026-02-09 19:46:27 +05:30
interactive_dialog_test_helper.ts Add Multiselect, Dynamic Select, Multiform, and Field Refresh Support for Interactive Dialogs (#9484) 2026-03-18 15:15:08 -06:00
test_config.ts Improve docs for e2e testing in iOS (#9674) 2026-04-14 15:42:39 +02:00