Browse Source

Basic Detox tests working

Jamon Holmgren 6 years ago
parent
commit
77229885e2
6 changed files with 29 additions and 13828 deletions
  1. 4
    0
      WebTest/.gitignore
  2. 4
    6
      WebTest/App.js
  3. 8
    8
      WebTest/e2e/firstTest.spec.js
  4. 0
    8486
      WebTest/package-lock.json
  5. 13
    1
      WebTest/package.json
  6. 0
    5327
      WebTest/yarn.lock

+ 4
- 0
WebTest/.gitignore View File

54
 
54
 
55
 # Bundle artifact
55
 # Bundle artifact
56
 *.jsbundle
56
 *.jsbundle
57
+
58
+# Don't save lockfiles for this test project
59
+package-lock.json
60
+yarn.lock

+ 4
- 6
WebTest/App.js View File

3
  * https://github.com/facebook/react-native
3
  * https://github.com/facebook/react-native
4
  *
4
  *
5
  * @format
5
  * @format
6
- * @flow
7
  */
6
  */
8
 
7
 
9
-import React, {Component} from 'react';
10
-import {Platform, StyleSheet, Text, View} from 'react-native';
8
+import React, { Component } from 'react';
9
+import { Platform, StyleSheet, Text, View } from 'react-native';
11
 
10
 
12
 const instructions = Platform.select({
11
 const instructions = Platform.select({
13
   ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
12
   ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
16
     'Shake or press menu button for dev menu',
15
     'Shake or press menu button for dev menu',
17
 });
16
 });
18
 
17
 
19
-type Props = {};
20
-export default class App extends Component<Props> {
18
+export default class App extends Component {
21
   render() {
19
   render() {
22
     return (
20
     return (
23
-      <View style={styles.container}>
21
+      <View testID="welcome" style={styles.container}>
24
         <Text style={styles.welcome}>Welcome to React Native!</Text>
22
         <Text style={styles.welcome}>Welcome to React Native!</Text>
25
         <Text style={styles.instructions}>To get started, edit App.js</Text>
23
         <Text style={styles.instructions}>To get started, edit App.js</Text>
26
         <Text style={styles.instructions}>{instructions}</Text>
24
         <Text style={styles.instructions}>{instructions}</Text>

+ 8
- 8
WebTest/e2e/firstTest.spec.js View File

7
     await expect(element(by.id('welcome'))).toBeVisible();
7
     await expect(element(by.id('welcome'))).toBeVisible();
8
   });
8
   });
9
 
9
 
10
-  it('should show hello screen after tap', async () => {
11
-    await element(by.id('hello_button')).tap();
12
-    await expect(element(by.text('Hello!!!'))).toBeVisible();
13
-  });
10
+  // it('should show hello screen after tap', async () => {
11
+  //   await element(by.id('hello_button')).tap();
12
+  //   await expect(element(by.text('Hello!!!'))).toBeVisible();
13
+  // });
14
 
14
 
15
-  it('should show world screen after tap', async () => {
16
-    await element(by.id('world_button')).tap();
17
-    await expect(element(by.text('World!!!'))).toBeVisible();
18
-  });
15
+  // it('should show world screen after tap', async () => {
16
+  //   await element(by.id('world_button')).tap();
17
+  //   await expect(element(by.text('World!!!'))).toBeVisible();
18
+  // });
19
 })
19
 })

+ 0
- 8486
WebTest/package-lock.json
File diff suppressed because it is too large
View File


+ 13
- 1
WebTest/package.json View File

7
     "test": "jest"
7
     "test": "jest"
8
   },
8
   },
9
   "dependencies": {
9
   "dependencies": {
10
+    "ir-webview": "../",
10
     "react": "16.4.1",
11
     "react": "16.4.1",
11
     "react-native": "0.56.0"
12
     "react-native": "0.56.0"
12
   },
13
   },
13
   "devDependencies": {
14
   "devDependencies": {
15
+    "@babel/core": "^7.0.0-beta",
16
+    "babel-core": "^7.0.0-beta",
17
+    "babel-preset-react-native": "5.0.2",
14
     "babel-jest": "23.4.2",
18
     "babel-jest": "23.4.2",
15
-    "babel-preset-react-native": "^5",
19
+    "detox": "^8.1.4",
16
     "jest": "23.5.0",
20
     "jest": "23.5.0",
17
     "react-test-renderer": "16.4.1"
21
     "react-test-renderer": "16.4.1"
18
   },
22
   },
20
     "preset": "react-native"
24
     "preset": "react-native"
21
   },
25
   },
22
   "detox": {
26
   "detox": {
27
+    "configurations": {
28
+      "ios.sim.debug": {
29
+        "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/WebTest.app",
30
+        "build": "xcodebuild -project ios/WebTest.xcodeproj -scheme WebTest -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
31
+        "type": "ios.simulator",
32
+        "name": "iPhone 6"
33
+      }
34
+    },
23
     "test-runner": "jest"
35
     "test-runner": "jest"
24
   }
36
   }
25
 }
37
 }

+ 0
- 5327
WebTest/yarn.lock
File diff suppressed because it is too large
View File