Replies: 3 comments
-
@nicolls1 to my knowledge you should not submit your detox build as you've likely enabled cleartext traffic for your Android Builds.
|
Beta Was this translation helpful? Give feedback.
-
Overall, I'd recommend using debug builds where possible for Detox testing – it requires more effort with fighting your |
Beta Was this translation helpful? Give feedback.
-
Posting my solution for react-native in case anyone is looking for one. As suggested by @noomorph , I do a debug build in detox and then on application level I disable logbox. Here's how: I installed react-native-launch-arguments so that then can do this. // on utils.ts
import { LaunchArguments } from 'react-native-launch-arguments';
interface MyExpectedArgs {
DETOX?: boolean;
}
const launchArgs = LaunchArguments.value<MyExpectedArgs>();
export const isDetox = () => {
return launchArgs?.DETOX === true;
}; Then call the function to trigger whatever you'r doing in your detox specific application code. In this case we want to disable Logbox so no UI elements are hidden behind the boxes. // on App.tsx
import { isDetox } from './utils.ts';
// Disable LogBox in Detox environment
if (isDetox()) {
console.log('Detox environment detected, ignoring logs');
LogBox.ignoreAllLogs();
} and finally I add the launch args statically to my ios simulator debug setup // on .detoxrc.js
...
apps: {
'ios.debug': {
type: 'ios.app',
binaryPath: 'ios/build/Build/Products/Debug-iphonesimulator/Codereaderdev.app',
build: 'xcodebuild -workspace ios/Codereaderdev.xcworkspace -scheme Codereaderdev -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build',
launchArgs: {
DETOX: 'true'
}
},
...
} You will no longer see the boxes on Detox runs. I kind of understand the Detox team not wanting to modify application code, that is great. But a small guide on how to do this should be included or easily findable. I think it's in the happy path of a Detox user. |
Beta Was this translation helpful? Give feedback.
-
I haven't been able to find any docs on this and am curious what is considered best practice. I could see it going both ways where it would be ideal to have the bundle that gets sent to the app stores is the bundle that has had end to end test run on it, but at the same time it probably doesn't make sense to have the extras detox adds in the final build.
Appreciate any thoughts!
Beta Was this translation helpful? Give feedback.
All reactions