App: [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-23] [$500] Create `setupNewDotWebForEmulators`
FOR BUG ZERO TEAM
https://github.com/Expensify/App/issues/28910#issuecomment-1754285321
Context
We plan to change the URL to serve the App on the development environment from localhost:8082 to new.expensify.com.dev in this PR. This can be accomplished by adding a new entry to the laptop’s hosts file along with changes made in the PR. However, we’re not sure how we can access the App on Safari or Chrome on iOS or Android simulators.
Create setupNewDotWebForEmulators script described below.
Proposal
Configure iOS simulators and Android emulators to connect to new.expensify.com.dev over https for local development.
Please re-state the problem that we are trying to solve in this issue.
We are adding https to the webpack-dev-server. Furthermore, we are configuring our dev machines to redirect requests from https://new.expensify.com.dev to 127.0.0.1 (aka localhost).
However, this is not working out-of-the-box on iOS Simulators and Android Emulators.
What is the root cause of that problem?
The root causes are different per-platform.
iOS
iOS Simulators inherit the hosts file from the mac computer they’re running on. However, you still won’t be able to connect because the iOS Simulator does not have the certs that you set up for SSL.
Android
The Android emulator will not inherit the hosts file from the mac computer they’re running on. It is missing the hosts file so will not know that when you go to new.expensify.com.dev you mean localhost.
What changes do you think we should make in order to solve the problem?
iOS
Boot an iOS simulator then run the following command to provide the correct certs to the Simulator:
xcrun simctl keychain booted add-cert ./config/webpack/certificate.pem
Android
We need to push the /etc/hosts file from the workstation to the emulator with the following command:
adb root
adb remount
adb push /etc/hosts /system/etc/hosts
If you see an error about the system being readonly, try the following in order:
adb root
adb disable-verity
adb reboot
adb root
adb remount
adb push /etc/hosts /system/etc/hosts
Packaging it all up
People will have to do this anytime they set up a new simulator/emulator and want to connect to new.expensify.com.dev. That’s kind of annoying, but at least we can package it up in a script like setupNewDotWebForEmulators. That way – if people have forgotten or never encountered these routing / SSL problems, they can just run npm run setupNewDotWebForEmulators, and as long as they followed the setup steps for SSL in webpack, it should work.
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~016381e2cc76fceca1
- Upwork Job ID: 1709910071627542528
- Last Price Increase: 2023-10-05
- Automatic offers:
- shubham1206agra | Contributor | 27048389
- b4s36t4 | Contributor | 27141130
- akinwale | Contributor | 27154634
About this issue
- Original URL
- State: closed
- Created 9 months ago
- Comments: 39 (24 by maintainers)
These were a set of bash scripts implemented, so no need to complete a checklist here.
cc @jliexpensify
Going off @hayata-suenaga 's summary here:
Payment Summary
Upwork job
@jliexpensify this issue is an external issue that creates a new feature that developers can use when working on NewDot.
The new development feature turned out to be tricky and I agree with @shubham1206agra that the work involved turned out to be tricker than simple bug fixes.
I think we can pay:
$750 for @shubham1206agra $250 for @b4s36t4 for their help in figuring out a blocking issue $250 for @mananjadhav for their partial work as a C+ (They needed to drop the issue to work on other high priority issues) $500 for @akinwale for taking over the issue as C+ from @mananjadhav
In the above payment summary, the payment for C+ ($750) is split between @mananjadhav and @akinwale
Let me know if you agree
Commenting
@hayata-suenaga for Manan, he needs to be paid via New.Dot, which requires a Payment Summary for J.Mills to sign off on 😃
ah did I provide payment summary too early 😓 let’s wait until the PR is deployed to production and regression period ends.
@shubham1206agra I’m taking over the C+ review and testing from @mananjadhav. It looks like melvinbot got a little confused.
@hayata-suenaga PR is up