瀏覽代碼

ios e2e debug on CI

Daniel Zlotin 7 年之前
父節點
當前提交
f09f82d79b
共有 3 個檔案被更改,包括 22 行新增9 行删除
  1. 16
    6
      scripts/test.e2e.ios.js
  2. 5
    2
      scripts/test.unit.ios.js
  3. 1
    1
      scripts/travis.sh

+ 16
- 6
scripts/test.e2e.ios.js 查看文件

@@ -5,13 +5,15 @@ const release = _.includes(process.argv, 'release');
5 5
 
6 6
 function buildProjForDetox() {
7 7
   const scheme = release ? `playground_release` : `playground`;
8
+  const conf = release ? `Release` : `Debug`;
8 9
 
9 10
   const cmd = `RCT_NO_LAUNCH_PACKAGER=true
10 11
             cd ./playground/ios && xcodebuild
12
+            build
11 13
             -scheme ${scheme}
12
-            ${release ? 'clean build' : 'build'}
13 14
             -project playground.xcodeproj
14 15
             -sdk iphonesimulator
16
+            -configuration ${conf}
15 17
             -derivedDataPath ./DerivedData/playground`;
16 18
 
17 19
   if (exec.which(`xcpretty`)) {
@@ -21,19 +23,27 @@ function buildProjForDetox() {
21 23
   }
22 24
 }
23 25
 
24
-function e2e() { //eslint-disable-line
25
-  try {
26
-    exec.execSyncSilent(`watchman watch-del-all || true`);
27
-    const detoxAppBuildPath = `playground/ios/DerivedData/playground/Build/Products/${release ? 'Release' : 'Debug'}-iphonesimulator/playground.app`;
26
+function runDetoxUsingMocha() {
27
+  const detoxAppBuildPath = `playground/ios/DerivedData/playground/Build/Products/${release ? 'Release' : 'Debug'}-iphonesimulator/playground.app`;
28 28
 
29
-    exec.execSync(`detoxAppBuildPath="${detoxAppBuildPath}"
29
+  exec.execSync(`detoxAppBuildPath="${detoxAppBuildPath}"
30 30
                               BABEL_ENV=test
31 31
                               ./node_modules/mocha/bin/mocha e2e
32 32
                                 --timeout ${2 * 60 * 1000}
33 33
                                 --recursive
34 34
                                 --bail`);
35
+}
36
+
37
+function e2e() { //eslint-disable-line
38
+  try {
39
+    if (process.env.CI) {
40
+      exec.exec(`yarn run start`);
41
+      exec.execSync(`sleep 5`);
42
+    }
43
+    runDetoxUsingMocha();
35 44
   } finally {
36 45
     if (process.env.CI) {
46
+      exec.kill(`react-native/local-cli/cli.js start`);
37 47
       exec.kill(`Simulator`);
38 48
       exec.kill(`CoreSimulator`);
39 49
       exec.execSync(`sleep 5`);

+ 5
- 2
scripts/test.unit.ios.js 查看文件

@@ -15,13 +15,16 @@ function run() {
15 15
             -scheme "playground"
16 16
             -project playground.xcodeproj
17 17
             -sdk iphonesimulator
18
-            -configuration Debug`);
18
+            -configuration Debug
19
+            -derivedDataPath ./DerivedData/playground`);
19 20
   runWithXcpretty(`RCT_NO_LAUNCH_PACKAGER=true
20 21
           cd ./playground/ios && xcodebuild
21 22
             test-without-building
22 23
             -scheme "playground"
23 24
             -project playground.xcodeproj
24
-            -destination 'platform=iOS Simulator,name=iPhone 7'`);
25
+            -sdk iphonesimulator
26
+            -destination 'platform=iOS Simulator,name=iPhone 7'
27
+            -derivedDataPath ./DerivedData/playground`);
25 28
 }
26 29
 
27 30
 run();

+ 1
- 1
scripts/travis.sh 查看文件

@@ -24,5 +24,5 @@ run_f "yarn run test-js"
24 24
 run_f "yarn run test-unit-android"
25 25
 run_f "yarn run test-unit-ios"
26 26
 run_f "yarn run test-e2e-android"
27
-run_f "yarn run test-e2e-ios -- release"
27
+run_f "yarn run test-e2e-ios"
28 28
 run_f "yarn run release"