onnxruntime/js/react_native/e2e/test/OnnxruntimeModuleExample.test.js
Rachel Guo 2cb3fb18b5
Integrate React Native E2E test with detox framework (#15133)
### Description
<!-- Describe your changes. -->

Integrate react native e2e test framework with detox.
https://wix.github.io/Detox/

Good build in CI:

https://dev.azure.com/onnxruntime/onnxruntime/_build/results?buildId=946695&view=results

### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->

Write cross-platform end-to-end tests in JavaScript. 
Resolve flaky e2e tests in react native ci pipelines.

---------

Co-authored-by: rachguo <rachguo@rachguos-Mini.attlocal.net>
Co-authored-by: rachguo <rachguo@rachguos-Mac-mini.local>
2023-04-21 09:46:26 -07:00

27 lines
No EOL
849 B
JavaScript

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
/* Initial Simple Detox Test Setup. Can potentially add more unit tests. */
describe('OnnxruntimeModuleExample', () => {
beforeAll(async () => {
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');
}
if (device.getPlatform() === 'android') {
await expect(element(by.label('output'))).toHaveText('Result: 3');
}
});
});