diff --git a/js/react_native/e2e/android/app/src/androidTest/java/com/example/reactnativeonnxruntimemodule/DetoxTest.java b/js/react_native/e2e/android/app/src/androidTest/java/com/example/reactnativeonnxruntimemodule/DetoxTest.java index 2a2bc7e33f..9425e1365f 100644 --- a/js/react_native/e2e/android/app/src/androidTest/java/com/example/reactnativeonnxruntimemodule/DetoxTest.java +++ b/js/react_native/e2e/android/app/src/androidTest/java/com/example/reactnativeonnxruntimemodule/DetoxTest.java @@ -4,6 +4,8 @@ package com.example.reactnativeonnxruntimemodule; +import android.content.Intent; + import com.wix.detox.Detox; import com.wix.detox.config.DetoxConfig; @@ -11,6 +13,7 @@ import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; +import androidx.test.core.app.ApplicationProvider; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.LargeTest; import androidx.test.rule.ActivityTestRule; @@ -23,6 +26,9 @@ public class DetoxTest { @Test public void runDetoxTests() { + // try to close any existing ANR dialog which will interfere with the UI tests + ApplicationProvider.getApplicationContext().sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)); + DetoxConfig detoxConfig = new DetoxConfig(); detoxConfig.idlePolicyConfig.masterTimeoutSec = 90; detoxConfig.idlePolicyConfig.idleResourceTimeoutSec = 60; @@ -30,4 +36,4 @@ public class DetoxTest { Detox.runTests(mActivityRule, detoxConfig); } -} \ No newline at end of file +} diff --git a/js/react_native/e2e/test/OnnxruntimeModuleExample.test.js b/js/react_native/e2e/test/OnnxruntimeModuleExample.test.js index 2e8a7446b6..0141659e95 100644 --- a/js/react_native/e2e/test/OnnxruntimeModuleExample.test.js +++ b/js/react_native/e2e/test/OnnxruntimeModuleExample.test.js @@ -8,14 +8,6 @@ describe('OnnxruntimeModuleExample', () => { await device.launchApp(); }); - beforeEach(async () => { - await device.launchApp({ newInstance: true }); - }); - - it('OnnxruntimeModuleExampleE2ETest CheckOutputComponentExists', async () => { - await element(by.label('output')); - }); - it('OnnxruntimeModuleExampleE2ETest CheckInferenceResultValueIsCorrect', async () => { if (device.getPlatform() === 'ios') { await expect(element(by.label('output')).atIndex(1)).toHaveText('Result: 3'); diff --git a/tools/ci_build/github/azure-pipelines/templates/react-native-ci.yml b/tools/ci_build/github/azure-pipelines/templates/react-native-ci.yml index 3a3868f223..caf45fc510 100644 --- a/tools/ci_build/github/azure-pipelines/templates/react-native-ci.yml +++ b/tools/ci_build/github/azure-pipelines/templates/react-native-ci.yml @@ -267,7 +267,10 @@ stages: - script: | JEST_JUNIT_OUTPUT_FILE=$(Build.SourcesDirectory)/js/react_native/e2e/android-test-results.xml \ - detox test --record-logs all --configuration android.emu.release --loglevel trace + detox test --record-logs all \ + --configuration android.emu.release \ + --loglevel trace \ + --take-screenshots failing workingDirectory: '$(Build.SourcesDirectory)/js/react_native/e2e' displayName: Run React Native Detox Android e2e Tests @@ -318,7 +321,10 @@ stages: - script: | JEST_JUNIT_OUTPUT_FILE=$(Build.SourcesDirectory)/js/react_native/e2e/ios-test-results.xml \ - detox test --record-logs all --configuration ios.sim.release --loglevel trace + detox test --record-logs all \ + --configuration ios.sim.release \ + --loglevel trace \ + --take-screenshots failing workingDirectory: '$(Build.SourcesDirectory)/js/react_native/e2e' displayName: Run React Native Detox iOS e2e Tests