瀏覽代碼

ignored android modal e2e

Daniel Zlotin 7 年之前
父節點
當前提交
5613738cb5

+ 84
- 9
AndroidE2E/app/src/androidTest/java/com/reactnativenavigation/e2e/androide2e/ModalsTest.java 查看文件

@@ -5,8 +5,6 @@ import android.support.test.uiautomator.By;
5 5
 import org.junit.Ignore;
6 6
 import org.junit.Test;
7 7
 
8
-import static org.junit.Assert.fail;
9
-
10 8
 public class ModalsTest extends BaseTest {
11 9
 	@Ignore
12 10
 	@Test
@@ -20,42 +18,119 @@ public class ModalsTest extends BaseTest {
20 18
 	@Ignore
21 19
 	@Test
22 20
 	public void dismissModal() throws Exception {
23
-		fail("to implement");
21
+		launchTheApp();
22
+		assertMainShown();
23
+		elementByText("SHOW MODAL").click();
24
+		assertExists(By.text("Modal Screen"));
25
+
26
+		elementByText("DISMISS MODAL").click();
27
+		assertMainShown();
28
+
24 29
 	}
25 30
 
26 31
 	@Ignore
27 32
 	@Test
28 33
 	public void showMultipleModals() throws Exception {
29
-		fail("to implement");
34
+		launchTheApp();
35
+		assertMainShown();
36
+		elementByText("SHOW MODAL").click();
37
+		assertExists(By.text("Modal Stack Position: 1"));
38
+
39
+		elementByText("SHOW MODAL").click();
40
+		assertExists(By.text("Modal Stack Position: 2"));
41
+
42
+		elementByText("DISMISS MODAL").click();
43
+		assertExists(By.text("Modal Stack Position: 1"));
44
+
45
+		elementByText("DISMISS MODAL").click();
46
+		assertMainShown();
30 47
 	}
31 48
 
32 49
 	@Ignore
33 50
 	@Test
34 51
 	public void dismissUnknownContainerId() throws Exception {
35
-		fail("to implement");
52
+		launchTheApp();
53
+		assertMainShown();
54
+		elementByText("SHOW MODAL").click();
55
+		assertExists(By.text("Modal Stack Position: 1"));
56
+
57
+		elementByText("DISMISS UNKNOWN MODAL").click();
58
+		assertExists(By.text("Modal Stack Position: 1"));
59
+
60
+		elementByText("DISMISS MODAL").click();
61
+		assertMainShown();
36 62
 	}
37 63
 
38 64
 	@Ignore
39 65
 	@Test
40 66
 	public void dismissModalByContainerIdWhenNotOnTop() throws Exception {
41
-		fail("to implement");
67
+		launchTheApp();
68
+		assertMainShown();
69
+		elementByText("SHOW MODAL").click();
70
+		assertExists(By.text("Modal Stack Position: 1"));
71
+
72
+		elementByText("SHOW MODAL").click();
73
+		assertExists(By.text("Modal Stack Position: 2"));
74
+
75
+		elementByText("DISMISS PREVIOUS MODAL").click();
76
+		assertExists(By.text("Modal Stack Position: 2"));
77
+
78
+		elementByText("DISMISS MODAL").click();
79
+		assertMainShown();
42 80
 	}
43 81
 
44 82
 	@Ignore
45 83
 	@Test
46 84
 	public void dismissAllPreviousModalsByIdWhenTheyAreBelowTopPresented() throws Exception {
47
-		fail("to implement");
85
+		launchTheApp();
86
+		assertMainShown();
87
+		elementByText("SHOW MODAL").click();
88
+		assertExists(By.text("Modal Stack Position: 1"));
89
+		elementByText("SHOW MODAL").click();
90
+		assertExists(By.text("Modal Stack Position: 2"));
91
+		elementByText("SHOW MODAL").click();
92
+		assertExists(By.text("Modal Stack Position: 3"));
93
+
94
+		elementByText("DISMISS ALL PREVIOUS MODALS").click();
95
+		assertExists(By.text("Modal Stack Position: 3"));
96
+
97
+		elementByText("DISMISS MODAL").click();
98
+		assertMainShown();
48 99
 	}
49 100
 
50 101
 	@Ignore
51 102
 	@Test
52 103
 	public void dismissSomeModalByIdDeepInTheStack() throws Exception {
53
-		fail("to implement");
104
+		launchTheApp();
105
+		assertMainShown();
106
+		elementByText("SHOW MODAL").click();
107
+		assertExists(By.text("Modal Stack Position: 1"));
108
+		elementByText("SHOW MODAL").click();
109
+		assertExists(By.text("Modal Stack Position: 2"));
110
+		elementByText("SHOW MODAL").click();
111
+		assertExists(By.text("Modal Stack Position: 3"));
112
+
113
+		elementByText("DISMISS FIRST IN THE STACK").click();
114
+		assertExists(By.text("Modal Stack Position: 3"));
115
+
116
+		elementByText("DISMISS MODAL").click();
117
+		assertExists(By.text("Modal Stack Position: 2"));
118
+
119
+		elementByText("DISMISS MODAL").click();
120
+		assertMainShown();
54 121
 	}
55 122
 
56 123
 	@Ignore
57 124
 	@Test
58 125
 	public void dismissAllModals() throws Exception {
59
-		fail("to implement");
126
+		launchTheApp();
127
+		assertMainShown();
128
+		elementByText("SHOW MODAL").click();
129
+		assertExists(By.text("Modal Stack Position: 1"));
130
+		elementByText("SHOW MODAL").click();
131
+		assertExists(By.text("Modal Stack Position: 2"));
132
+
133
+		elementByText("DISMISS ALL MODALS").click();
134
+		assertMainShown();
60 135
 	}
61 136
 }