diff --git a/.circleci/config.yml b/.circleci/config.yml index 48a452dbb..4007ee264 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -324,16 +324,12 @@ aliases: - &run-objc-ios-e2e-tests name: iOS End-to-End Test Suite command: | - if [ $((0 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then - node ./scripts/run-ci-e2e-tests.js --ios --retries 3; - fi + node ./scripts/run-ci-e2e-tests.js --ios --retries 3; - &run-objc-tvos-e2e-tests name: tvOS End-to-End Test Suite command: | - if [ $((1 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then - node ./scripts/run-ci-e2e-tests.js --tvos --js --retries 3; - fi + node ./scripts/run-ci-e2e-tests.js --tvos --js --retries 3; - &run-android-e2e-tests name: Android End-to-End Test Suite @@ -443,13 +439,13 @@ jobs: # Runs end to end tests test_end_to_end: <<: *macos_defaults - parallelism: 2 steps: - attach_workspace: at: ~/react-native - - run: *boot-simulator-iphone - - run: *boot-simulator-appletv + - run: + name: Boot iOS Simulator + command: xcrun simctl boot "iPhone 5s" || true - run: name: Configure Environment Variables @@ -465,8 +461,20 @@ jobs: node -v - run: *run-objc-ios-e2e-tests - # Disabled for now - # - run: *run-objc-tvos-e2e-tests + + - run: + name: Install Apple Simulator Utilities + command: | + brew tap wix/brew + brew install applesimutils + + - run: + name: Build iOS App for Simulator + command: yarn run build-ios-e2e + + - run: + name: Run Detox Tests + command: yarn run test-ios-e2e - store_test_results: path: ~/react-native/reports/junit diff --git a/.eslintrc b/.eslintrc index e05c065a0..01842b1bc 100644 --- a/.eslintrc +++ b/.eslintrc @@ -52,7 +52,8 @@ "setTimeout": false, "window": false, "XMLHttpRequest": false, - "pit": false + "pit": false, + "jasmine": true }, "rules": { diff --git a/.gitignore b/.gitignore index 7705dae8f..50a3ed642 100644 --- a/.gitignore +++ b/.gitignore @@ -72,3 +72,4 @@ package-lock.json # ReactCommon subdir shouldn't have Xcode project /ReactCommon/**/*.xcodeproj +RNTester/build diff --git a/RNTester/e2e/config.json b/RNTester/e2e/config.json new file mode 100644 index 000000000..4dac170d3 --- /dev/null +++ b/RNTester/e2e/config.json @@ -0,0 +1,6 @@ +{ + "setupTestFrameworkScriptFile" : "./init.js", + "testEnvironment": "node", + "bail": true, + "verbose": true +} diff --git a/RNTester/e2e/init.js b/RNTester/e2e/init.js new file mode 100644 index 000000000..5d6e7a9a5 --- /dev/null +++ b/RNTester/e2e/init.js @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +const detox = require('detox'); +const config = require('../../package.json').detox; +const adapter = require('detox/runners/jest/adapter'); + +jest.setTimeout(480000); +jasmine.getEnv().addReporter(adapter); + +beforeAll(async () => { + await detox.init(config); +}); + +beforeEach(async function() { + await adapter.beforeEach(); +}); + +afterAll(async () => { + await adapter.afterAll(); + await detox.cleanup(); +}); + +process.on('unhandledRejection', (reason, p) => { + console.log('Unhandled Rejection at: Promise', p, 'reason:', reason); +}); diff --git a/RNTester/e2e/sanity.test.js b/RNTester/e2e/sanity.test.js new file mode 100644 index 000000000..0078a90b4 --- /dev/null +++ b/RNTester/e2e/sanity.test.js @@ -0,0 +1,47 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +/* global device, element, by, expect */ + +describe('Sanity', () => { + beforeEach(async () => { + await device.reloadReactNative(); + await element(by.label(`