Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test-suite] Fix FBNativeAd test suite by adding onError support #8662

Merged
merged 14 commits into from
Jun 5, 2020

Conversation

sjchmiela
Copy link
Contributor

@sjchmiela sjchmiela commented Jun 4, 2020

Why

Fixes #8643.

How

The problems that I faced were:

  • the test timed out, most probably due to mountAndWaitFor not being able to finish fetching new ad (debugging natively I saw that setNativeAd was being hit after the tests failed), so I moved the mountAndWaitFor to inside of the test and added a higher timeout value
  • this has resulted in "text must be wrapped in an explicit component" error, which was occurring due to headline being "" which is falsy and makes headline && <Text>…</Text> resolve to "". I revamped the construct to ? : null which fixed that issue.
  • after longer testing it turned out that on Android I'm able to reproduce timeouts even with the higher allowed value (with a clean install) — this got me thinking there must be more to it than just the timeout
  • so I dived into native code and saw the todo: handle errors. It turned out that timeout is actually an error, just not delivered. So I added the onError callback for both platforms. Hooray! 🎉

Test Plan

When the test fails, the specific reason is shown as Promise rejection. It failed on my device which has ad tracking limits enabled. It failed on clean installs on Android (restarting fixed the issue).

@sjchmiela sjchmiela requested a review from esamelson June 4, 2020 14:40
@github-actions
Copy link
Contributor

github-actions bot commented Jun 4, 2020

Native Component List for this branch is ready

Copy link
Contributor

@esamelson esamelson left a comment

Choose a reason for hiding this comment

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

amazing work, thank you @sjchmiela 🙏

@sjchmiela sjchmiela merged commit a39ce4d into master Jun 5, 2020
@sjchmiela sjchmiela deleted the @sjchmiela/fix-expo-ads-facebook-test-suite branch June 5, 2020 07:31
esamelson pushed a commit that referenced this pull request Jun 9, 2020
…thNativeAd (#8662)

# Why

Fixes #8643.

# How

The problems that I faced were:

- the test timed out, most probably due to `mountAndWaitFor` not being able to finish fetching new ad (debugging natively I saw that `setNativeAd` was being hit after the tests failed), so I moved the `mountAndWaitFor` to inside of the test and added a higher timeout value
- this has resulted in "text must be wrapped in an explicit <Text> component" error, which was occurring due to `headline` being `""` which is falsy and makes `headline && <Text>…</Text>` resolve to `""`. I revamped the construct to `? : null` which fixed that issue.
- after longer testing it turned out that on Android I'm able to reproduce timeouts even with the higher allowed value (with a clean install) — this got me thinking there must be more to it than just the timeout
- so I dived into native code and saw the `todo: handle errors`. It turned out that timeout is actually an error, just not delivered. So I added the `onError` callback for both platforms. Hooray! 🎉 

# Test Plan

When the test fails, the specific reason is shown as Promise rejection. It failed on my device which has ad tracking limits enabled. It failed on clean installs on Android (restarting fixed the issue).
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.

[expo-ads-facebook] fix test-suite on Android, add NativeAdView.onAdLoaded Android implementation
2 participants