Browse Source

js - enable showModal e2e test and create dismissModal e2e test

Ran Greenberg 7 years ago
parent
commit
2d0da0d9b5
2 changed files with 19 additions and 1 deletions
  1. 8
    1
      playground/e2e/app.test.js
  2. 11
    0
      playground/src/containers/SimpleScreen.js

+ 8
- 1
playground/e2e/app.test.js View File

@@ -39,10 +39,17 @@ describe('app', () => {
39 39
     expect(elementByLabel('React Native Navigation!')).toBeVisible();
40 40
   });
41 41
 
42
-  xit('show modal', () => {
42
+  it('show modal', () => {
43 43
     elementByLabel('Show Modal').tap();
44 44
     expect(elementByLabel('Modal screen')).toBeVisible();
45 45
   });
46
+  
47
+  it('dismiss modal', () => {
48
+    elementByLabel('Show Modal').tap();
49
+    expect(elementByLabel('Modal screen')).toBeVisible();
50
+    elementByLabel('Dismiss Modal').tap();
51
+    expect(elementByLabel('React Native Navigation!')).toBeVisible();
52
+  });
46 53
 });
47 54
 
48 55
 describe('reload app', () => {

+ 11
- 0
playground/src/containers/SimpleScreen.js View File

@@ -8,6 +8,7 @@ class SimpleScreen extends Component {
8 8
     super(props);
9 9
     this.onClickPop = this.onClickPop.bind(this);
10 10
     this.onClickPush = this.onClickPush.bind(this);
11
+    this.onClickShowModal = this.onClickShowModal.bind(this);
11 12
     this.onClickDismissModal = this.onClickDismissModal.bind(this);
12 13
   }
13 14
 
@@ -19,6 +20,7 @@ class SimpleScreen extends Component {
19 20
         {this.renderTextFromFunctionInProps()}
20 21
         <Button title="Push" onPress={this.onClickPush} />
21 22
         <Button title="Pop" onPress={this.onClickPop} />
23
+        <Button title="Show Mddal" onPress={this.onClickPop} />
22 24
         <Button title="Dismiss Modal" onPress={this.onClickDismissModal} />
23 25
       </View>
24 26
     );
@@ -45,6 +47,15 @@ class SimpleScreen extends Component {
45 47
       }
46 48
     });
47 49
   }
50
+  
51
+  onClickShowModal() {
52
+    Navigation.showModal({
53
+      name: 'navigation.playground.SimpleScreen',
54
+      passProps: {
55
+        text: 'Modal screen'
56
+      }
57
+    });
58
+  }
48 59
 
49 60
   onClickDismissModal() {
50 61
     Navigation.dismissModal(this.props.id);