Kaynağa Gözat

upgraded detox to version 6.x.x (#2284)

* upgraded detox to version 6.x.x

* fixed detox script, added release config
yogevbd 7 yıl önce
ebeveyn
işleme
2955b7601a
5 değiştirilmiş dosya ile 45 ekleme ve 62 silme
  1. 2
    10
      e2e/init.js
  2. 1
    0
      e2e/mocha.opts
  3. 19
    11
      package-lock.json
  4. 20
    1
      package.json
  5. 3
    40
      scripts/test.e2e.ios.js

+ 2
- 10
e2e/init.js Dosyayı Görüntüle

@@ -1,17 +1,9 @@
1 1
 require('babel-polyfill'); // eslint-disable-line import/no-extraneous-dependencies
2 2
 const detox = require('detox');
3
+const config = require('../package.json').detox;
3 4
 
4 5
 before(async () => {
5
-  const detoxConfig = {
6
-    configurations: {
7
-      ios: {
8
-        binaryPath: process.env.detoxAppBuildPath,
9
-        type: 'ios.simulator',
10
-        name: 'iPhone 7'
11
-      }
12
-    }
13
-  };
14
-  await detox.init(detoxConfig, { launchApp: false });
6
+  await detox.init(config, { launchApp: false });
15 7
 });
16 8
 
17 9
 after(async () => {

+ 1
- 0
e2e/mocha.opts Dosyayı Görüntüle

@@ -0,0 +1 @@
1
+--recursive --timeout 300000 --bail

+ 19
- 11
package-lock.json Dosyayı Görüntüle

@@ -2123,27 +2123,29 @@
2123 2123
       }
2124 2124
     },
2125 2125
     "detox": {
2126
-      "version": "5.10.0",
2127
-      "resolved": "https://registry.npmjs.org/detox/-/detox-5.10.0.tgz",
2128
-      "integrity": "sha512-ji/7dyO3GBTlhD6CNt/hMpeYJymRLm7Cl6np8tMO2tG9PPrJZqhNUDGxENPLwKxHDZ+NqC8PrbEA1PzeqdbcUw==",
2126
+      "version": "6.0.2",
2127
+      "resolved": "https://registry.npmjs.org/detox/-/detox-6.0.2.tgz",
2128
+      "integrity": "sha512-q2Wx7x0Lc/LXh0BxgEPDdntxVbt7apJAZ3Tu6mjkNBuCy8mh9yEAGhOvtC9eI8tor+BMMi9kxzl26W6AHFjYxA==",
2129 2129
       "dev": true,
2130 2130
       "requires": {
2131 2131
         "child-process-promise": "2.2.1",
2132 2132
         "commander": "2.12.2",
2133
-        "detox-server": "2.1.0",
2133
+        "detox-server": "6.0.2",
2134 2134
         "fs-extra": "4.0.2",
2135 2135
         "get-port": "2.1.0",
2136
+        "ini": "1.3.5",
2136 2137
         "lodash": "4.17.4",
2137 2138
         "npmlog": "4.1.2",
2138 2139
         "shell-utils": "1.0.9",
2140
+        "tail": "1.2.3",
2139 2141
         "telnet-client": "0.15.3",
2140 2142
         "ws": "1.1.5"
2141 2143
       }
2142 2144
     },
2143 2145
     "detox-server": {
2144
-      "version": "2.1.0",
2145
-      "resolved": "https://registry.npmjs.org/detox-server/-/detox-server-2.1.0.tgz",
2146
-      "integrity": "sha512-Q4ZBcCYmRSymMabizH+Fao8SgKHCgvwYuHsutLslcDW5s0UR8hegC55cX0y/7vNA3Y+qtD844ivzWps5TjBJ+A==",
2146
+      "version": "6.0.2",
2147
+      "resolved": "https://registry.npmjs.org/detox-server/-/detox-server-6.0.2.tgz",
2148
+      "integrity": "sha512-Pt1Lfnkdpm5uGcuXs5fwLj7sOX2DpRlTXTiUrrMWKXtIX3yZhaUTmgpN+30bWhmh0WBAJA+yZeAwdxwqI0WPrA==",
2147 2149
       "dev": true,
2148 2150
       "requires": {
2149 2151
         "lodash": "4.17.4",
@@ -6206,9 +6208,9 @@
6206 6208
       }
6207 6209
     },
6208 6210
     "mobx": {
6209
-      "version": "3.3.2",
6210
-      "resolved": "https://registry.npmjs.org/mobx/-/mobx-3.3.2.tgz",
6211
-      "integrity": "sha1-6RKp98grLfafGr5lFeyqVRgooCQ=",
6211
+      "version": "3.4.0",
6212
+      "resolved": "https://registry.npmjs.org/mobx/-/mobx-3.4.0.tgz",
6213
+      "integrity": "sha1-uX+Y2XPRvibRhdPPx4BT3Ugp7JU=",
6212 6214
       "dev": true
6213 6215
     },
6214 6216
     "mocha": {
@@ -7838,7 +7840,7 @@
7838 7840
       "dev": true,
7839 7841
       "requires": {
7840 7842
         "lodash": "4.17.4",
7841
-        "mobx": "3.3.2"
7843
+        "mobx": "3.4.0"
7842 7844
       }
7843 7845
     },
7844 7846
     "repeat-element": {
@@ -8650,6 +8652,12 @@
8650 8652
         }
8651 8653
       }
8652 8654
     },
8655
+    "tail": {
8656
+      "version": "1.2.3",
8657
+      "resolved": "https://registry.npmjs.org/tail/-/tail-1.2.3.tgz",
8658
+      "integrity": "sha1-sI1vp5+5KIaWMaNBpRwUSXwcQlU=",
8659
+      "dev": true
8660
+    },
8653 8661
     "telnet-client": {
8654 8662
       "version": "0.15.3",
8655 8663
       "resolved": "https://registry.npmjs.org/telnet-client/-/telnet-client-0.15.3.tgz",

+ 20
- 1
package.json Dosyayı Görüntüle

@@ -52,7 +52,7 @@
52 52
     "eslint-config-xo": "0.18.x",
53 53
     "eslint-config-xo-react": "0.14.x",
54 54
     "eslint-plugin-react": "7.x.x",
55
-    "detox": "5.x.x",
55
+    "detox": "6.x.x",
56 56
     "jest": "21.x.x",
57 57
     "mocha": "4.x.x",
58 58
     "react": "16.0.0-alpha.6",
@@ -98,6 +98,25 @@
98 98
       }
99 99
     }
100 100
   },
101
+  "detox": {
102
+    "test-runner": "mocha",
103
+    "specs": "e2e",
104
+    "runner-config": "e2e/mocha.opts",
105
+    "configurations": {
106
+      "ios.sim.debug": {
107
+        "binaryPath": "playground/ios/DerivedData/playground/Build/Products/Debug-iphonesimulator/playground.app",
108
+        "build": "RCT_NO_LAUNCH_PACKAGER=true xcodebuild build -scheme playground -project playground/ios/playground.xcodeproj -sdk iphonesimulator -configuration Debug -derivedDataPath playground/ios/DerivedData/playground ONLY_ACTIVE_ARCH=YES -quiet",
109
+        "type": "ios.simulator",
110
+        "name": "iPhone 7"
111
+      },
112
+      "ios.sim.release": {
113
+        "binaryPath": "playground/ios/DerivedData/playground/Build/Products/Release-iphonesimulator/playground.app",
114
+        "build": "RCT_NO_LAUNCH_PACKAGER=true xcodebuild build -scheme playground_release -project playground/ios/playground.xcodeproj -sdk iphonesimulator -configuration Release -derivedDataPath playground/ios/DerivedData/playground ONLY_ACTIVE_ARCH=YES -quiet",
115
+        "type": "ios.simulator",
116
+        "name": "iPhone 7"
117
+      }
118
+    }
119
+  },
101 120
   "xo": {
102 121
     "extends": "xo-react",
103 122
     "space": true,

+ 3
- 40
scripts/test.e2e.ios.js Dosyayı Görüntüle

@@ -3,47 +3,10 @@ const exec = require('shell-utils').exec;
3 3
 
4 4
 const release = _.includes(process.argv, '--release');
5 5
 
6
-function buildProjForDetox() {
7
-  const scheme = release ? `playground_release` : `playground`;
8
-  const conf = release ? `Release` : `Debug`;
9
-
10
-  execWithXcprettyIfPossible(`cd ./playground/ios &&
11
-            RCT_NO_LAUNCH_PACKAGER=true
12
-            xcodebuild build
13
-            -scheme ${scheme}
14
-            -project playground.xcodeproj
15
-            -sdk iphonesimulator
16
-            -configuration ${conf}
17
-            -derivedDataPath ./DerivedData/playground
18
-            ONLY_ACTIVE_ARCH=YES`);
19
-}
20
-
21
-function runDetoxUsingMocha() {
22
-  const detoxAppBuildPath = `playground/ios/DerivedData/playground/Build/Products/${release ? 'Release' : 'Debug'}-iphonesimulator/playground.app`;
23
-
24
-  exec.execSync(`detoxAppBuildPath="${detoxAppBuildPath}"
25
-                              ./node_modules/mocha/bin/mocha e2e
26
-                                --timeout ${5 * 60 * 1000}
27
-                                --recursive
28
-                                --bail
29
-                                ${process.env.CI ? '--cleanup' : ''}`);
30
-}
31
-
32
-function e2e() {
33
-  runDetoxUsingMocha();
34
-}
6
+run();
35 7
 
36 8
 function run() {
37
-  buildProjForDetox();
38
-  e2e();
9
+  const conf = release ? `release` : `debug`;
10
+  exec.execSync(`detox build --configuration ios.sim.${conf} && detox test --configuration ios.sim.${conf} ${process.env.CI ? '--cleanup' : ''}`);
39 11
 }
40 12
 
41
-function execWithXcprettyIfPossible(cmd) {
42
-  if (exec.which('xcpretty')) {
43
-    exec.execSync(`${cmd} | xcpretty`);
44
-  } else {
45
-    exec.execSync(cmd);
46
-  }
47
-}
48
-
49
-run();