fix(test): stabilize postMessage toast E2E test on iOS - #416
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to stabilize the iOS E2E “postMessage shows native toast” scenario by avoiding a race where the test waits too long for the RN bubble and only then checks for a toast that is short-lived in E2E mode.
Changes:
- Updated AppleApp (Vanilla + Expo) E2E specs to call
sendPostMessageToNativeAndWaitForToast()without a message regex argument. - Reworked
sendPostMessageToNativeAndWaitForToastto tap with Detox synchronization disabled and to assert the native toast before checking RN UI state.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| apps/brownfield-example-shared-tests/e2e/appleAppExpoBrownfield.e2e.js | Updates the Expo AppleApp toast test to use the new helper signature. |
| apps/brownfield-example-shared-tests/e2e/appleAppDetoxUtils.cjs | Adjusts the helper to prioritize toast visibility and reduces sync-related flakiness around the tap. |
| apps/brownfield-example-shared-tests/e2e/appleAppBrownfield.e2e.js | Updates the Vanilla AppleApp toast test to use the new helper signature. |
Comments suppressed due to low confidence (1)
apps/brownfield-example-shared-tests/e2e/appleAppDetoxUtils.cjs:280
sendPostMessageToNativeAndWaitForToastno longer verifies that the RN postMessage bubble ever appears. That makes the toast assertion easier to satisfy even if the postMessage didn’t land (and in the Vanilla AppleApp suite there isn’t another test that checks the bubble). Since the toast is now asserted first, you can safely add a follow-up wait for the RN bubble after the toast without reintroducing the original race.
await waitForNativeOverlayVisible(
by.id(ids.appleAppPostMessageToast),
DETOX_TIMING.TOAST_VISIBILITY_TIMEOUT_MS
);
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
hurali97
approved these changes
Jul 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
E2E Apple toast test is flaky. The hypothesis is a race in
sendPostMessageToNativeAndWaitForToast.The helper taps "Send message to Native", then spent up to 15 seconds polling for the RN message bubble before checking for the native toast. In E2E mode the toast only stays visible for ~10 seconds (Toast.swift), and the Expo bubble can be slow to surface (Fabric accessibility + 300ms fade-in animation). So the toast often gets dismissed before the test would look for it.
Test plan
CI green