Browse Source

ios e2e debug on CI

Daniel Zlotin 7 years ago
parent
commit
f09f82d79b
3 changed files with 22 additions and 9 deletions
  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 View File

5
 
5
 
6
 function buildProjForDetox() {
6
 function buildProjForDetox() {
7
   const scheme = release ? `playground_release` : `playground`;
7
   const scheme = release ? `playground_release` : `playground`;
8
+  const conf = release ? `Release` : `Debug`;
8
 
9
 
9
   const cmd = `RCT_NO_LAUNCH_PACKAGER=true
10
   const cmd = `RCT_NO_LAUNCH_PACKAGER=true
10
             cd ./playground/ios && xcodebuild
11
             cd ./playground/ios && xcodebuild
12
+            build
11
             -scheme ${scheme}
13
             -scheme ${scheme}
12
-            ${release ? 'clean build' : 'build'}
13
             -project playground.xcodeproj
14
             -project playground.xcodeproj
14
             -sdk iphonesimulator
15
             -sdk iphonesimulator
16
+            -configuration ${conf}
15
             -derivedDataPath ./DerivedData/playground`;
17
             -derivedDataPath ./DerivedData/playground`;
16
 
18
 
17
   if (exec.which(`xcpretty`)) {
19
   if (exec.which(`xcpretty`)) {
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
                               BABEL_ENV=test
30
                               BABEL_ENV=test
31
                               ./node_modules/mocha/bin/mocha e2e
31
                               ./node_modules/mocha/bin/mocha e2e
32
                                 --timeout ${2 * 60 * 1000}
32
                                 --timeout ${2 * 60 * 1000}
33
                                 --recursive
33
                                 --recursive
34
                                 --bail`);
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
   } finally {
44
   } finally {
36
     if (process.env.CI) {
45
     if (process.env.CI) {
46
+      exec.kill(`react-native/local-cli/cli.js start`);
37
       exec.kill(`Simulator`);
47
       exec.kill(`Simulator`);
38
       exec.kill(`CoreSimulator`);
48
       exec.kill(`CoreSimulator`);
39
       exec.execSync(`sleep 5`);
49
       exec.execSync(`sleep 5`);

+ 5
- 2
scripts/test.unit.ios.js View File

15
             -scheme "playground"
15
             -scheme "playground"
16
             -project playground.xcodeproj
16
             -project playground.xcodeproj
17
             -sdk iphonesimulator
17
             -sdk iphonesimulator
18
-            -configuration Debug`);
18
+            -configuration Debug
19
+            -derivedDataPath ./DerivedData/playground`);
19
   runWithXcpretty(`RCT_NO_LAUNCH_PACKAGER=true
20
   runWithXcpretty(`RCT_NO_LAUNCH_PACKAGER=true
20
           cd ./playground/ios && xcodebuild
21
           cd ./playground/ios && xcodebuild
21
             test-without-building
22
             test-without-building
22
             -scheme "playground"
23
             -scheme "playground"
23
             -project playground.xcodeproj
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
 run();
30
 run();

+ 1
- 1
scripts/travis.sh View File

24
 run_f "yarn run test-unit-android"
24
 run_f "yarn run test-unit-android"
25
 run_f "yarn run test-unit-ios"
25
 run_f "yarn run test-unit-ios"
26
 run_f "yarn run test-e2e-android"
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
 run_f "yarn run release"
28
 run_f "yarn run release"