-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add environ for device.launchApp
#376
Comments
What is your use case here? |
@LeoNatan the use case we had at Envoy is, we sometimes needs to set a different configuration value for testing purpose, such as |
Besides API, there is also stuff we need to mock via feeding a different environment variable to the app. For example, our Envoy sign-in app supports badge printing, to test the badge printer, there is no way we make the iPad really print the badge out and somehow ensure the badge printing is correct. In that case, we will need to feed in an environment variable telling the app to use a mock printer module, and talk to our local HTTP server instead, and the HTTP server is running with our tester, so that we can check the parameters sending to the mock printer server, and we can see if it's working as expected. Like this
Likewise, we have to mock PubNub, that's also done with a mock API server doing long polling. For more details, we have a blog post for it https://envoy.engineering/embedded-web-server-for-ios-ui-testing-8ff3cef513df Anyway, in short, that's not for user interaction, it's more for changing the configuration to make some untestable thing testable for our use case. |
We have a mocking recommendation, but unfortunately it is only supported on a very old RN version (0.44). Hang in there. |
@leeor besides mocking, we also have use case for operations such as resetting key chain, for example, before certain test case, we want to reset the key chain, then we pass in
when the app reads this part, it will clear the key chain before launching the app. We can also set some variable, like access key
As for our use case, it's not possible to reset key chain via user interface, we do have reset login, but that needs to be done via a toggle in Settings app. |
Any reason not to use launch arguments? There is a similar API you can use to test whether a launch argument exists. |
For now, we can launch the app with
launchArgs
but in many cases, it's easier to pass in environment variables, like this
as launchArgs require parsing, while environment variable can be read directly with simple key. So I think it would be nice to add support for launching the app with environment variables.
The text was updated successfully, but these errors were encountered: