I have E2E tests for my React Native app that are written using Detox & YakBak. Although my tests are currently failing as it is unable to ping the mock express server that is running in the background.
About:
Here’s a brief explanation on how the system works:
- E2E tests are written in React Native using Detox
- The tests are running in “testing” schema on ios which hits
localhost:3001
- There is an express app running on
localhost:3001
with Yakbak - If the request is made for the first time, it hits
localhost:3000
& saves the response in tapes. - The next time that same response is made, it returns the tape and doesn’t hit the actual server
Hence once all the tapes are recorded, we can run our E2E tests with pre-recorded tapes and without actually hitting our backend servers (localhost:3000
or any other url)
Problem:
In my Bitrise workflow, I have a step that starts this express server and runs it in the background:
node proxy_server.js &>/dev/null &
When the tests run and it tries to make a network request to localhost:3001
, it is unable to hit the express server and the tests fail.
Hence I need help trying to figure out why the express server in the background is not accessible.
Also the reason I think this is a Bitrise issue is that I was able to download the bitrise.yml
file and run the same workflow locally on my computer and it ran the express server in the background and passed all the tests.
If anyone has any ideas/way to diagnose this issue, please let me know. Thanks for your help in advance!
Debugging Logs
Step that runs the express server in the background:
Running the express app as a background process like so:
node proxy_server.js &>/dev/null &
And here is the output showing that the node process is running successfully:
+ node --version
v8.12.0
+ which node
/usr/local/bin/node
+ cd e2e/mock
+ pwd
/Users/vagrant/git/e2e/mock
+ node proxy_server.js
+ ps -ef
+ grep 'node proxy_server.js'
501 3869 3866 0 4:17PM ?? 0:00.00 node proxy_server.js
501 3871 3866 0 4:17PM ?? 0:00.00 grep node proxy_server.js
^^ looks like the express server is running!?
Failing Build: https://app.bitrise.io/build/2eb7dd7a74ecf799
Let me know if you need more infomation to debug this issue.