-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run Detox Android on CircleCI (#465)
* Run Detox Android on CircleCI * Add `0.68` to the matrix * Remove unnecessary requires * Use `android_emulator_start` command from `react-native` orb * Use `android` orb instead * List available SDKs * Use `android/save-gradle-cache` and use the right system image * Add `post-emulator-launch-assemble-command` * Setup Detox for React Native 0.68 * Configure Blob
- Loading branch information
Showing
10 changed files
with
109 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ aliases: | |
orbs: | ||
node: circleci/[email protected] | ||
browser-tools: circleci/[email protected] | ||
android: circleci/[email protected] | ||
|
||
executors: | ||
node: | ||
|
@@ -217,6 +218,36 @@ jobs: | |
name: Run Detox on iOS | ||
command: yarn e2e:ios | ||
- save-cache-detox-app | ||
test-android: | ||
parameters: | ||
react-native-version: | ||
type: string | ||
executor: | ||
name: android/android-machine | ||
resource-class: large | ||
tag: 2023.11.1 | ||
working_directory: ~/react-native-url-polyfill/platforms/react-native/<< parameters.react-native-version >> | ||
steps: | ||
- attach-workspace | ||
- install-node | ||
- install-yarn-dependencies | ||
- run: | ||
name: List available SDKs | ||
command: sdkmanager --list | ||
- android/create-avd: | ||
avd-name: TestingAVD | ||
install: true | ||
system-image: system-images;android-34;default;x86_64 | ||
- android/start-emulator: | ||
avd-name: TestingAVD | ||
no-window: true | ||
post-emulator-launch-assemble-command: '' | ||
restore-gradle-cache-prefix: v1a | ||
- run: | ||
name: Run Detox | ||
command: yarn e2e:android | ||
- android/save-gradle-cache: | ||
cache-prefix: v1a | ||
test-hermes-android: | ||
parameters: | ||
react-native-version: | ||
|
@@ -302,16 +333,10 @@ workflows: | |
requires: | ||
- lint | ||
- test-js | ||
- test-hermes-ios: | ||
matrix: | ||
parameters: | ||
react-native-version: ['0.68'] | ||
requires: | ||
- test-ios-<< matrix.react-native-version >> | ||
- test-hermes-android: | ||
- test-android: | ||
matrix: | ||
parameters: | ||
react-native-version: ['0.68'] | ||
react-native-version: ['0.68', '0.72'] | ||
requires: | ||
- lint | ||
- test-js | ||
|
@@ -322,3 +347,15 @@ workflows: | |
# requires: | ||
# - lint | ||
# - test-js | ||
- test-hermes-ios: | ||
matrix: | ||
parameters: | ||
react-native-version: ['0.68'] | ||
requires: | ||
- test-ios-<< matrix.react-native-version >> | ||
- test-hermes-android: | ||
matrix: | ||
parameters: | ||
react-native-version: ['0.68'] | ||
requires: | ||
- test-android-<< matrix.react-native-version >> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
platforms/react-native/0.68/android/app/src/androidTest/java/com/detox/DetoxTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.detox; | ||
|
||
import com.wix.detox.Detox; | ||
import com.wix.detox.config.DetoxConfig; | ||
|
||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import androidx.test.ext.junit.runners.AndroidJUnit4; | ||
import androidx.test.filters.LargeTest; | ||
import androidx.test.rule.ActivityTestRule; | ||
|
||
@RunWith(AndroidJUnit4.class) | ||
@LargeTest | ||
public class DetoxTest { | ||
@Rule | ||
public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class, false, false); | ||
|
||
@Test | ||
public void runDetoxTests() { | ||
DetoxConfig detoxConfig = new DetoxConfig(); | ||
detoxConfig.idlePolicyConfig.masterTimeoutSec = 90; | ||
detoxConfig.idlePolicyConfig.idleResourceTimeoutSec = 60; | ||
detoxConfig.rnContextLoadTimeoutSec = (BuildConfig.DEBUG ? 180 : 60); | ||
|
||
Detox.runTests(mActivityRule, detoxConfig); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
platforms/react-native/0.68/android/app/src/main/res/values/strings.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
<resources> | ||
<string name="app_name">Detox</string> | ||
<string name="blob_provider_authority">com.detox.blobs</string> | ||
</resources> |
7 changes: 7 additions & 0 deletions
7
platforms/react-native/0.68/android/app/src/main/res/xml/network_security_config.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<network-security-config> | ||
<domain-config cleartextTrafficPermitted="true"> | ||
<domain includeSubdomains="true">10.0.2.2</domain> | ||
<domain includeSubdomains="true">localhost</domain> | ||
</domain-config> | ||
</network-security-config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters