react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

test(database, e2e): remove workaround for emulator rules

Open davidepalazzo opened this issue 3 years ago â€ĸ 6 comments

Description

It seems that the latest version of the Emulator loads the database rules correctly, which means we can get rid of the workarounds.

The e2e tests run successfully after updating the helpers.js file.

Related issues

https://github.com/invertase/react-native-firebase/issues/5876

Release Summary

Remove workarounds in e2e for database Emulator

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • [X] Yes
  • My change supports the following platforms;
    • [ ] Android
    • [ ] iOS
  • My change includes tests;
    • [X] e2e tests added or updated in packages/\*\*/e2e
    • [ ] jest tests added or updated in packages/\*\*/__tests__
  • [ ] I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • [ ] Yes
    • [X] No

Test Plan


Think react-native-firebase is great? Please consider supporting the project with any of the below:

đŸ”Ĩ

davidepalazzo avatar Aug 28 '22 03:08 davidepalazzo

The latest updates on your projects. Learn more about Vercel for Git â†—ī¸Ž

Name Status Preview Updated
react-native-firebase ✅ Ready (Inspect) Visit Preview Sep 17, 2022 at 4:06PM (UTC)
1 Ignored Deployment
Name Status Preview Updated
react-native-firebase-next âŦœī¸ Ignored (Inspect) Sep 17, 2022 at 4:06PM (UTC)

vercel[bot] avatar Aug 28 '22 03:08 vercel[bot]

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Aug 28 '22 03:08 CLAassistant

Codecov Report

Merging #6498 (1436ddb) into main (1fe3570) will decrease coverage by 46.43%. The diff coverage is n/a.

:exclamation: Current head 1436ddb differs from pull request most recent head 3e11007. Consider uploading reports for the commit 3e11007 to get more accurate results

@@             Coverage Diff             @@
##             main    #6498       +/-   ##
===========================================
- Coverage   72.25%   25.82%   -46.42%     
===========================================
  Files         109       97       -12     
  Lines        4662     4296      -366     
  Branches     1051     1051               
===========================================
- Hits         3368     1109     -2259     
- Misses       1214     2585     +1371     
- Partials       80      602      +522     

codecov[bot] avatar Aug 28 '22 03:08 codecov[bot]

Thanks for your speedy response @mikehardy. I addressed everything you mentioned in your comments and sorted out the CLA with my correct signed account (I had it done in the past so not sure what happen there).

In my local the e2e runs smoothly: Screen Shot 2022-08-28 at 9 25 39 am

Let's see if the pipeline likes that too!

davidepalazzo avatar Aug 28 '22 05:08 davidepalazzo

Oh my! Just saw this one was still sitting around, apologies. Still getting back up to speed since summer travels. I just squashed the three commits to one, rebased it against current main, and re-pushed it so CI will hopefully clear Then we can get this in, it's a nice cleanup

mikehardy avatar Sep 17 '22 15:09 mikehardy

Hmm - not sure what the explanation is, but currently failing every time on iOS at least (android is having unrelated issues) in CI with


  database().ref().on()
    ✔ throws if event type is invalid
    ✔ throws if callback is not a function
    ✔ throws if cancel callback is not a function
    ✔ throws if context is not an object
    ✔ should callback with an initial value
    - should callback multiple times when the value changes
16:56:14.777 detox[17936] WARN:  at e2e/init.js:41:15 
 âš ī¸ A test failed:
16:56:14.778 detox[17936] WARN:  at e2e/init.js:42:15 
 ī¸   ->  should cancel when something goes wrong
16:56:14.779 detox[17936] WARN:  at e2e/init.js:49:13 
 ī¸   ->  Retrying in 5 seconds ... (1)
16:56:24.799 detox[17936] WARN:  at e2e/init.js:46:15 
    🔴  Retry #1 failed...
16:56:24.800 detox[17936] WARN:  at e2e/init.js:49:13 
 ī¸   ->  Retrying in 10 seconds ... (2)
16:56:39.803 detox[17936] WARN:  at e2e/init.js:46:15 
    🔴  Retry #2 failed...
16:56:39.804 detox[17936] WARN:  at e2e/init.js:49:13 
 ī¸   ->  Retrying in 15 seconds ... (3)
16:56:59.808 detox[17936] WARN:  at e2e/init.js:46:15 
    🔴  Retry #3 failed...
16:56:59.809 detox[17936] WARN:  at e2e/init.js:49:13 
 ī¸   ->  Retrying in 20 seconds ... (4)
    1) should cancel when something goes wrong


  319 passing (6m)
  23 pending
  1 failing

  1) database().ref().on()
       should cancel when something goes wrong:
     Error: Spy was not called within timeout period.
      at Timeout._onTimeout (node_modules/@react-native-firebase/private-tests-helpers/lib/index.js:3:824)
      at listOnTimeout (node:internal/timers:559:17)
      at processTimers (node:internal/timers:502:7)

mikehardy avatar Sep 17 '22 18:09 mikehardy

No worries at all! Between travelling and work I only had time to have a look at this now.

I retested the changes I made with a fresh clone from main and I'm getting the same failing test in my local as the CI. It looks like we still need to keep the workaround for now after all. â˜šī¸

davidepalazzo avatar Oct 02 '22 10:10 davidepalazzo

Well, at least we are not crazy since we have reproducible results. Or with only a sample size of 2 perhaps it is still sunspots or something and we're just falling prey to confirmation bias. But I'll trust the result - I guess we still need the workaround

It was a wonderful thought though, I do love purging workarounds - thanks a bunch for the attempt. Cheers

mikehardy avatar Oct 02 '22 20:10 mikehardy