Skip to content

Commit fa38cb2

Browse files
authored
Revert "chore(e2e): update detox and android configuration (#78)" (#150)
This reverts commit d72f747.
1 parent d72f747 commit fa38cb2

File tree

19 files changed

+128
-247
lines changed

19 files changed

+128
-247
lines changed

.circleci/config.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
test-ios-vanilla:
9494
<<: *job
9595
macos:
96-
xcode: '10.0.0'
96+
xcode: "9.4.0"
9797
steps:
9898
- checkout
9999
# macOS VMs doesn't support Docker based caches
@@ -108,7 +108,7 @@ jobs:
108108
test-ios-cocoapods:
109109
<<: *job
110110
macos:
111-
xcode: '10.0.0'
111+
xcode: "9.4.0"
112112
steps:
113113
- checkout
114114
# macOS VMs doesn't support Docker based caches
@@ -171,19 +171,19 @@ workflows:
171171
only: /.*/
172172
- test-android:
173173
requires:
174-
- build-test-app
174+
- build-test-app
175175
filters:
176176
tags:
177177
only: /.*/
178178
- test-ios-vanilla:
179179
requires:
180-
- build-test-app
180+
- build-test-app
181181
filters:
182182
tags:
183183
only: /.*/
184184
- test-ios-cocoapods:
185185
requires:
186-
- build-test-app
186+
- build-test-app
187187
filters:
188188
tags:
189189
only: /.*/

CONTRIBUTING.md

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -49,59 +49,6 @@ $ yarn
4949
$ yarn test
5050
```
5151

52-
### End-to-end testing
53-
54-
End-to-end testing is done using [Detox](https://github.com/wix/Detox).
55-
56-
These tests are primarily built to be run on CI. The following instructions describe how to run them locally.
57-
58-
Tested on Mac only.
59-
60-
#### iOS
61-
62-
First, install your dependencies as described in [Step 1: Install dependencies](https://github.com/wix/Detox/blob/master/docs/Introduction.GettingStarted.md#step-1-install-dependencies).
63-
64-
```bash
65-
yarn # install project dependencies
66-
yarn build # build project and integrations
67-
cd packages/test-app
68-
yarn test:ios:cocoapods # or test:ios:vanilla
69-
```
70-
71-
For subsequent runs, you may need to do `rm -rf project && ./generate.sh` before running the test command.
72-
73-
### Android
74-
75-
Set up an Android emulator locally. The easiest way to do this is to install and launch Android Studio, and [manage your virtual devices](https://developer.android.com/studio/run/managing-avds) through the UI.
76-
77-
Check you have at least one emulator installed with `emulator -list-avds`. Now open `./packages/test-app/package.json` and ensure that the `name` under `"android.emu.release"` is one of the emulators in your list (change it if not, but do not commit this change).
78-
79-
```bash
80-
yarn # install project dependencies
81-
yarn build # build project and integrations
82-
cd packages/test-app
83-
SEGMENT_WRITE_TOKEN=test yarn test:android
84-
```
85-
86-
**Note:** A non-empty value of SEGMENT_WRITE_TOKEN is required for Android (but not iOS), because the native library will do a not null check for it and your application will crash.
87-
88-
**Note:** you can also run the emulator in debug mode, but you'll have to start the packager manually. Assuming you've already installed dependencies and built the project:
89-
90-
Build the android project and start the packager:
91-
92-
```bash
93-
cd packages/test-app
94-
SEGMENT_WRITE_TOKEN=test detox build -c android.emu.debug
95-
cd project
96-
yarn start
97-
```
98-
99-
In a new terminal window, run:
100-
101-
```bash
102-
detox test -c android.emu.debug
103-
```
104-
10552
### Architecture
10653

10754
- `packages/core`: the `@segment/analytics-react-native` module

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,10 @@ await analytics.setup('writeKey', {
166166
| [Firebase](https://www.npmjs.com/package/@segment/analytics-react-native-firebase) | :white_check_mark: | :white_check_mark: | `@segment/analytics-react-native-firebase` |
167167
| [Flurry](https://www.npmjs.com/package/@segment/analytics-react-native-flurry) | :white_check_mark: | :white_check_mark: | `@segment/analytics-react-native-flurry` |
168168
| [Google Analytics](https://www.npmjs.com/package/@segment/analytics-react-native-google-analytics) | :white_check_mark: | :white_check_mark: | `@segment/analytics-react-native-google-analytics` |
169-
| [Intercom](https://www.npmjs.com/package/@segment/analytics-react-native-intercom-ios) | :white_check_mark: | :x: | `@segment/analytics-react-native-intercom-ios` |
169+
| [Intercom](https://www.npmjs.com/package/@segment/analytics-react-native-intercom) | :white_check_mark: | :white_check_mark: | `@segment/analytics-react-native-intercom` |
170170
| [Localytics](https://www.npmjs.com/package/@segment/analytics-react-native-localytics) | :white_check_mark: | :white_check_mark: | `@segment/analytics-react-native-localytics` |
171171
| [Mixpanel](https://www.npmjs.com/package/@segment/analytics-react-native-mixpanel) | :white_check_mark: | :white_check_mark: | `@segment/analytics-react-native-mixpanel` |
172+
| [Quantcast](https://www.npmjs.com/package/@segment/analytics-react-native-quantcast-android) | :x: | :white_check_mark: | `@segment/analytics-react-native-quantcast-android` |
172173
| [Taplytics](https://www.npmjs.com/package/@segment/analytics-react-native-taplytics-ios) | :white_check_mark: | :x: | `@segment/analytics-react-native-taplytics-ios` |
173174
| [Tapstream](https://www.npmjs.com/package/@segment/analytics-react-native-tapstream-android) | :x: | :white_check_mark: | `@segment/analytics-react-native-tapstream-android` |
174175

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"npm-run-all": "^4.1.3",
7171
"prettier": "^1.14.2",
7272
"react": "16.8.3",
73-
"react-native": "0.59.9",
73+
"react-native": "0.59.2",
7474
"rimraf": "^2.6.2"
7575
}
7676
}

packages/integrations/integrations.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,11 @@
2222
ios:
2323
# Only compatible 3.0.x
2424
disabled: true
25-
android:
26-
disabled: true
2725

2826
- name: Intercom
2927
ios:
3028
pod:
3129
version: 1.0.0-beta
32-
android:
33-
disabled: true
3430

3531
- name: Tapstream
3632
ios:

packages/integrations/template/android/build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ android {
2626
versionName '1.0'
2727

2828
}
29-
packagingOptions {
30-
pickFirst "META-INF/*"
31-
}
3229
}
3330

3431
repositories {

packages/test-app/e2e/main.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ it('sends events and does not crash', async () => {
1414
await sleep(5 * 1000)
1515
})
1616

17-
if (CIRCLE_WORKFLOW_ID && E2E_TOKEN) {
17+
if (CIRCLE_WORKFLOW_ID) {
1818
it('sends events to the webhook', async () => {
1919
await element(by.text('Launch test suite')).tap()
2020
await element(by.text('Flush')).tap()

packages/test-app/package.json

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@
1212
"test:ios:cocoapods": "COCOAPODS=yes ./test_ios.sh",
1313
"test:ios:vanilla": "COCOAPODS=no ./test_ios.sh",
1414
"test:android": "./test_android.sh",
15-
"test": "run-s test:{ios,android}"
15+
"test": "run-s test:{ios,android}",
16+
"detox:build": "detox build",
17+
"detox:test": "detox test"
1618
},
1719
"devDependencies": {
1820
"jest": "^24.5.0",
1921
"react-native-cli": "^2.0.1"
2022
},
2123
"dependencies": {
22-
"detox": "^12.11.0",
24+
"detox": "^12.1.1",
2325
"isomorphic-fetch": "^2.2.1"
2426
},
2527
"detox": {
@@ -39,17 +41,11 @@
3941
"type": "ios.simulator",
4042
"name": "iPhone X"
4143
},
42-
"android.emu.release": {
43-
"binaryPath": "project/android/app/build/outputs/apk/release/app-release.apk",
44-
"build": "cd project/android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release",
45-
"type": "android.emulator",
46-
"name": "Nexus_5X_API_28"
47-
},
48-
"android.emu.debug": {
44+
"android": {
4945
"binaryPath": "project/android/app/build/outputs/apk/debug/app-debug.apk",
5046
"build": "cd project/android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug",
5147
"type": "android.emulator",
52-
"name": "Nexus_5X_API_28"
48+
"name": "Nexus_5X_API_27"
5349
}
5450
}
5551
}

packages/test-app/seed/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ yarn-error.log
3939
# BUCK
4040
buck-out/
4141
\.buckd/
42+
*.keystore
4243

4344
# fastlane
4445
#
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @format
3+
*/
4+
5+
import 'react-native'
6+
import React from 'react'
7+
import App from '../App'
8+
9+
// Note: test renderer must be required after react-native.
10+
import renderer from 'react-test-renderer'
11+
12+
it('renders correctly', () => {
13+
renderer.create(<App />)
14+
})
Binary file not shown.

packages/test-app/seed/android/app/build.gradle

Lines changed: 71 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,76 @@ apply plugin: "com.android.application"
22

33
import com.android.build.OutputFile
44

5+
/**
6+
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7+
* and bundleReleaseJsAndAssets).
8+
* These basically call `react-native bundle` with the correct arguments during the Android build
9+
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10+
* bundle directly from the development server. Below you can see all the possible configurations
11+
* and their defaults. If you decide to add a configuration block, make sure to add it before the
12+
* `apply from: "../../node_modules/react-native/react.gradle"` line.
13+
*
14+
* project.ext.react = [
15+
* // the name of the generated asset file containing your JS bundle
16+
* bundleAssetName: "index.android.bundle",
17+
*
18+
* // the entry file for bundle generation
19+
* entryFile: "index.android.js",
20+
*
21+
* // whether to bundle JS and assets in debug mode
22+
* bundleInDebug: false,
23+
*
24+
* // whether to bundle JS and assets in release mode
25+
* bundleInRelease: true,
26+
*
27+
* // whether to bundle JS and assets in another build variant (if configured).
28+
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
29+
* // The configuration property can be in the following formats
30+
* // 'bundleIn${productFlavor}${buildType}'
31+
* // 'bundleIn${buildType}'
32+
* // bundleInFreeDebug: true,
33+
* // bundleInPaidRelease: true,
34+
* // bundleInBeta: true,
35+
*
36+
* // whether to disable dev mode in custom build variants (by default only disabled in release)
37+
* // for example: to disable dev mode in the staging build type (if configured)
38+
* devDisabledInStaging: true,
39+
* // The configuration property can be in the following formats
40+
* // 'devDisabledIn${productFlavor}${buildType}'
41+
* // 'devDisabledIn${buildType}'
42+
*
43+
* // the root of your project, i.e. where "package.json" lives
44+
* root: "../../",
45+
*
46+
* // where to put the JS bundle asset in debug mode
47+
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
48+
*
49+
* // where to put the JS bundle asset in release mode
50+
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
51+
*
52+
* // where to put drawable resources / React Native assets, e.g. the ones you use via
53+
* // require('./image.png')), in debug mode
54+
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
55+
*
56+
* // where to put drawable resources / React Native assets, e.g. the ones you use via
57+
* // require('./image.png')), in release mode
58+
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
59+
*
60+
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
61+
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
62+
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
63+
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
64+
* // for example, you might want to remove it from here.
65+
* inputExcludes: ["android/**", "ios/**"],
66+
*
67+
* // override which node gets called and with what additional arguments
68+
* nodeExecutableAndArgs: ["node"],
69+
*
70+
* // supply additional arguments to the packager
71+
* extraPackagerArgs: []
72+
* ]
73+
*/
74+
575
project.ext.react = [
676
entryFile: "index.js"
777
]
@@ -26,16 +96,6 @@ def enableProguardInReleaseBuilds = false
2696
android {
2797
compileSdkVersion rootProject.ext.compileSdkVersion
2898

29-
signingConfigs {
30-
31-
release {
32-
storeFile file("android.keystore")
33-
storePassword "notSecret"
34-
keyAlias "segmentTesting"
35-
keyPassword "notSecret"
36-
}
37-
}
38-
3999
packagingOptions {
40100
pickFirst "META-INF/*"
41101
}
@@ -51,9 +111,6 @@ android {
51111
targetSdkVersion rootProject.ext.targetSdkVersion
52112
versionCode 1
53113
versionName "1.0"
54-
testBuildType System.getProperty("testBuildType", "debug") // This will later be used to control the test apk build type
55-
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
56-
multiDexEnabled true
57114
}
58115
splits {
59116
abi {
@@ -65,10 +122,8 @@ android {
65122
}
66123
buildTypes {
67124
release {
68-
signingConfig signingConfigs.release
69125
minifyEnabled enableProguardInReleaseBuilds
70126
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
71-
proguardFile "${rootProject.projectDir}/../../node_modules/detox/android/detox/proguard-rules-app.pro"
72127
}
73128
}
74129
// applicationVariants are e.g. debug, release
@@ -84,24 +139,17 @@ android {
84139
}
85140
}
86141
}
87-
lintOptions {
88-
checkReleaseBuilds false
89-
}
90142
}
91143

92144
dependencies {
93145
implementation fileTree(dir: "libs", include: ["*.jar"])
94146
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
95147
implementation "com.facebook.react:react-native:+" // From node_modules
96-
implementation "com.android.support:design:27.1.0"
97-
implementation 'com.android.support:multidex:1.0.3'
98-
androidTestImplementation("com.wix:detox:+") { transitive = true }
99-
androidTestImplementation "junit:junit:4.12"
100148
}
101149

102150
// Run this once to be able to run the application with BUCK
103151
// puts all compile dependencies into folder libs for BUCK to use
104152
task copyDownloadableDepsToLibs(type: Copy) {
105153
from configurations.compile
106-
into "libs"
154+
into 'libs'
107155
}

packages/test-app/seed/android/app/src/androidTest/java/com/testapp/DetoxTest.java

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)