Skip to content

chore: block logs in maestro tests - #636

Merged
eszlamczyk merged 2 commits into
mainfrom
chore/maestro-ignore-warnings
Aug 6, 2026
Merged

chore: block logs in maestro tests#636
eszlamczyk merged 2 commits into
mainfrom
chore/maestro-ignore-warnings

Conversation

@eszlamczyk

Copy link
Copy Markdown
Collaborator

What/Why?

Suppresses the RN example app's LogBox during Maestro E2E runs so dev warning overlays/toasts never corrupt the exact-match (100% threshold) screenshot assertions.

Driven entirely from run-tests.sh via a bundled flag file (e2e-config.json) — no native module, no pod install, no Metro config, and no per-flow YAML changes:

  • run-tests.sh flips the flag to true before build/setup and restores it to false on exit (folded into the existing device-shutdown trap).
  • index.js reads the flag and calls LogBox.ignoreAllLogs() when it's set.
  • Because the flag is a bundled source input (not an env var), Metro reliably picks it up; the - launchApp at the start of each flow reloads the bundle.

Normal yarn ios/dev builds keep LogBox on (flag defaults to false).

Testing

  • Run yarn test:e2e:smoke:ios (or :android) and confirm screenshots no longer capture the LogBox warning overlay.
  • Verify a plain yarn react-native-example ios still shows LogBox warnings.
  • After a run, confirm e2e-config.json is restored to false (clean git tree).

PR Checklist

  • Code compiles and runs on iOS
  • Code compiles and runs on Android
  • Updated documentation/README if applicable
  • Ran example app to verify changes
  • E2E tests are passing
  • Required E2E tests have been added (if applicable)

@eszlamczyk
eszlamczyk requested a review from Copilot August 6, 2026 08:04
@eszlamczyk
eszlamczyk marked this pull request as ready for review August 6, 2026 08:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to make Maestro E2E screenshot assertions reliable by preventing React Native LogBox warning overlays from appearing during test runs, while keeping normal dev behavior unchanged.

Changes:

  • Add a bundled e2e-config.json flag file (default disableLogBox: false) to control E2E-only behavior.
  • Update the RN example app entrypoint to read that flag and call LogBox.ignoreAllLogs() when enabled.
  • Update the Maestro run-tests.sh script to flip the flag on before the run and restore it on exit.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
apps/react-native-example/index.js Reads e2e-config.json and disables LogBox when disableLogBox is enabled.
apps/react-native-example/e2e-config.json Introduces a bundled configuration flag (default off) for E2E behavior.
.maestro/scripts/run-tests.sh Toggles the flag for the E2E run and restores it during cleanup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .maestro/scripts/run-tests.sh
@eszlamczyk
eszlamczyk merged commit 9959acc into main Aug 6, 2026
9 checks passed
@eszlamczyk
eszlamczyk deleted the chore/maestro-ignore-warnings branch August 6, 2026 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants