77import android .support .test .rule .ActivityTestRule ;
88import android .support .test .runner .AndroidJUnit4 ;
99
10+ import org .junit .After ;
1011import org .junit .Rule ;
1112import org .junit .Test ;
1213import org .junit .runner .RunWith ;
@@ -29,6 +30,12 @@ public class MainActivityTest {
2930 public ActivityTestRule <MainActivity > activityRule = new ActivityTestRule <>(
3031 MainActivity .class , false , true );
3132
33+
34+ @ After
35+ public void onEndTest () {
36+ pressBack ();
37+ }
38+
3239 @ Test
3340 public void pieChartTest () {
3441 onView (withId (R .id .recycler_view ))
@@ -41,8 +48,6 @@ public void pieChartTest() {
4148 onWebView ().withElement (findElement (Locator .ID , "ac_path_1s" )).perform (webClick ());
4249 onWebView ().withElement (findElement (Locator .ID , "ac_path_1t" )).perform (webClick ());
4350 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
44-
45- pressBack ();
4651 }
4752
4853 @ Test
@@ -61,8 +66,6 @@ public void columnChartTest() {
6166 onWebView ().withElement (findElement (Locator .ID , "ac_path_16" )).perform (webClick ());
6267 onWebView ().withElement (findElement (Locator .ID , "ac_path_17" )).perform (webClick ());
6368 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
64-
65- pressBack ();
6669 }
6770
6871 @ Test
@@ -75,8 +78,6 @@ public void lineChartTest() {
7578 onWebView ().withElement (findElement (Locator .ID , "ac_path_20" )).perform (webClick ());
7679 onWebView ().withElement (findElement (Locator .ID , "ac_path_1m" )).perform (webClick ());
7780 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
78-
79- pressBack ();
8081 }
8182
8283 @ Test
@@ -88,8 +89,6 @@ public void areaChartTest() {
8889 onWebView ().withElement (findElement (Locator .ID , "ac_path_23" )).perform (webClick ());
8990 onWebView ().withElement (findElement (Locator .ID , "ac_path_24" )).perform (webClick ());
9091 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
91-
92- pressBack ();
9392 }
9493
9594 @ Test
@@ -120,8 +119,6 @@ public void barChartTest() {
120119 onWebView ().withElement (findElement (Locator .ID , "ac_path_3q" )).perform (webClick ());
121120 onWebView ().withElement (findElement (Locator .ID , "ac_path_3r" )).perform (webClick ());
122121 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
123-
124- pressBack ();
125122 }
126123
127124 @ Test
@@ -137,8 +134,6 @@ public void vennDiagramTest() {
137134 onWebView ().withElement (findElement (Locator .ID , "ac_path_a" )).perform (webClick ());
138135 onWebView ().withElement (findElement (Locator .ID , "ac_path_x" )).perform (webClick ());
139136 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
140-
141- pressBack ();
142137 }
143138
144139 @ Test
@@ -173,8 +168,6 @@ public void heatMapChartTest() {
173168 onWebView ().withElement (findElement (Locator .ID , "ac_rect_1i" )).perform (webClick ());
174169 onWebView ().withElement (findElement (Locator .ID , "ac_rect_1j" )).perform (webClick ());
175170 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
176-
177- pressBack ();
178171 }
179172
180173 @ Test
@@ -187,8 +180,6 @@ public void tagCloudTest() {
187180 onWebView ().withElement (findElement (Locator .ID , "ac_simple-text_s" )).perform (webClick ());
188181 onWebView ().withElement (findElement (Locator .ID , "ac_simple-text_2a" )).perform (webClick ());
189182 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
190-
191- pressBack ();
192183 }
193184
194185 @ Test
@@ -212,8 +203,6 @@ public void waterfallChartTest() {
212203 onWebView ().withElement (findElement (Locator .ID , "ac_path_1s" )).perform (webClick ());
213204 onWebView ().withElement (findElement (Locator .ID , "ac_path_1t" )).perform (webClick ());
214205 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
215-
216- pressBack ();
217206 }
218207
219208 @ Test
@@ -237,8 +226,6 @@ public void treeMapChartTest() {
237226 onWebView ().withElement (findElement (Locator .ID , "ac_rect_12" )).perform (webClick ());
238227 onWebView ().withElement (findElement (Locator .ID , "ac_rect_13" )).perform (webClick ());
239228 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
240-
241- pressBack ();
242229 }
243230
244231 @ Test
@@ -253,8 +240,6 @@ public void circularGaugeTest() {
253240 onWebView ().withElement (findElement (Locator .ID , "ac_path_e" )).perform (webClick ());
254241 onWebView ().withElement (findElement (Locator .ID , "ac_path_f" )).perform (webClick ());
255242 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
256-
257- pressBack ();
258243 }
259244
260245 @ Test
@@ -264,8 +249,6 @@ public void thermometerTest() {
264249
265250 onWebView ().withElement (findElement (Locator .ID , "container" )).perform (webClick ());
266251 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
267-
268- pressBack ();
269252 }
270253
271254 @ Test
@@ -275,8 +258,6 @@ public void linearColorScaleTest() {
275258
276259 onWebView ().withElement (findElement (Locator .ID , "container" )).perform (webClick ());
277260 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
278-
279- pressBack ();
280261 }
281262
282263 @ Test
@@ -287,8 +268,6 @@ public void windSpeedTest() {
287268 onWebView ().withElement (findElement (Locator .ID , "container" )).perform (webClick ());
288269 onWebView ().withElement (findElement (Locator .ID , "ac_path_1l" )).perform (webClick ());
289270 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
290-
291- pressBack ();
292271 }
293272
294273 @ Test
@@ -299,8 +278,6 @@ public void windDirectionTest() {
299278 onWebView ().withElement (findElement (Locator .ID , "container" )).perform (webClick ());
300279 onWebView ().withElement (findElement (Locator .ID , "ac_path_y" )).perform (webClick ());
301280 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
302-
303- pressBack ();
304281 }
305282
306283 @ Test
@@ -312,8 +289,6 @@ public void scatterChartTest() {
312289 onWebView ().withElement (findElement (Locator .ID , "ac_path_13" )).perform (webClick ());
313290 onWebView ().withElement (findElement (Locator .ID , "ac_path_6a" )).perform (webClick ());
314291 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
315-
316- pressBack ();
317292 }
318293
319294 @ Test
@@ -326,8 +301,6 @@ public void resourceChartTest() {
326301 onWebView ().withElement (findElement (Locator .ID , "ac_path_7" )).perform (webClick ());
327302 onWebView ().withElement (findElement (Locator .ID , "ac_path_9" )).perform (webClick ());
328303 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
329-
330- pressBack ();
331304 }
332305
333306 @ Test
@@ -340,8 +313,6 @@ public void radarChartTest() {
340313 onWebView ().withElement (findElement (Locator .ID , "ac_path_2k" )).perform (webClick ());
341314 onWebView ().withElement (findElement (Locator .ID , "ac_path_22" )).perform (webClick ());
342315 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
343-
344- pressBack ();
345316 }
346317
347318 @ Test
@@ -354,8 +325,6 @@ public void polarChartTest() {
354325 onWebView ().withElement (findElement (Locator .ID , "ac_path_2a" )).perform (webClick ());
355326 onWebView ().withElement (findElement (Locator .ID , "ac_path_2d" )).perform (webClick ());
356327 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
357-
358- pressBack ();
359328 }
360329
361330 @ Test
@@ -376,8 +345,6 @@ public void rangeChartTest() {
376345 onWebView ().withElement (findElement (Locator .ID , "ac_path_31" )).perform (webClick ());
377346 onWebView ().withElement (findElement (Locator .ID , "ac_path_30" )).perform (webClick ());
378347 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
379-
380- pressBack ();
381348 }
382349
383350 @ Test
@@ -404,8 +371,6 @@ public void verticalChartTest() {
404371 onWebView ().withElement (findElement (Locator .ID , "ac_path_1l" )).perform (webClick ());
405372 onWebView ().withElement (findElement (Locator .ID , "ac_path_1m" )).perform (webClick ());
406373 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
407-
408- pressBack ();
409374 }
410375
411376 @ Test
@@ -420,8 +385,6 @@ public void funnelChartTest() {
420385 onWebView ().withElement (findElement (Locator .ID , "ac_path_k" )).perform (webClick ());
421386 onWebView ().withElement (findElement (Locator .ID , "ac_path_l" )).perform (webClick ());
422387 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
423-
424- pressBack ();
425388 }
426389
427390 @ Test
@@ -447,8 +410,6 @@ public void pertChartTest() {
447410 onWebView ().withElement (findElement (Locator .ID , "ac_path_1h" )).perform (webClick ());
448411 onWebView ().withElement (findElement (Locator .ID , "ac_path_1a" )).perform (webClick ());
449412 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
450-
451- pressBack ();
452413 }
453414
454415 @ Test
@@ -460,8 +421,6 @@ public void combinedChartTest() {
460421 onWebView ().withElement (findElement (Locator .ID , "ac_path_1u" )).perform (webClick ());
461422 onWebView ().withElement (findElement (Locator .ID , "ac_path_1x" )).perform (webClick ());
462423 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
463-
464- pressBack ();
465424 }
466425
467426 @ Test
@@ -478,8 +437,6 @@ public void bubbleChartTest() {
478437 onWebView ().withElement (findElement (Locator .ID , "ac_circle_2r" )).perform (webClick ());
479438 onWebView ().withElement (findElement (Locator .ID , "ac_circle_3u" )).perform (webClick ());
480439 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
481-
482- pressBack ();
483440 }
484441
485442 @ Test
@@ -491,8 +448,6 @@ public void paretoChartTest() {
491448 onWebView ().withElement (findElement (Locator .ID , "ac_path_2k" )).perform (webClick ());
492449 onWebView ().withElement (findElement (Locator .ID , "ac_path_2l" )).perform (webClick ());
493450 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
494-
495- pressBack ();
496451 }
497452
498453 @ Test
@@ -506,8 +461,6 @@ public void pyramidChartTest() {
506461 onWebView ().withElement (findElement (Locator .ID , "ac_path_r" )).perform (webClick ());
507462 onWebView ().withElement (findElement (Locator .ID , "ac_path_i" )).perform (webClick ());
508463 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
509-
510- pressBack ();
511464 }
512465
513466 @ Test
@@ -526,8 +479,6 @@ public void boxChartTest() {
526479 onWebView ().withElement (findElement (Locator .ID , "ac_path_1p" )).perform (webClick ());
527480 onWebView ().withElement (findElement (Locator .ID , "ac_path_1t" )).perform (webClick ());
528481 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
529-
530- pressBack ();
531482 }
532483
533484 @ Test
@@ -540,8 +491,6 @@ public void mosaicChartTest() {
540491 onWebView ().withElement (findElement (Locator .ID , "ac_path_1o" )).perform (webClick ());
541492 onWebView ().withElement (findElement (Locator .ID , "ac_path_1p" )).perform (webClick ());
542493 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
543-
544- pressBack ();
545494 }
546495
547496 @ Test
@@ -557,8 +506,6 @@ public void mekkoChartTest() {
557506 onWebView ().withElement (findElement (Locator .ID , "ac_path_1b" )).perform (webClick ());
558507 onWebView ().withElement (findElement (Locator .ID , "ac_path_1a" )).perform (webClick ());
559508 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
560-
561- pressBack ();
562509 }
563510
564511 @ Test
@@ -580,8 +527,6 @@ public void bar3DChartTest() {
580527 onWebView ().withElement (findElement (Locator .ID , "ac_path_3n" )).perform (webClick ());
581528 onWebView ().withElement (findElement (Locator .ID , "ac_path_4b" )).perform (webClick ());
582529 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
583-
584- pressBack ();
585530 }
586531
587532 @ Test
@@ -602,8 +547,6 @@ public void column3DChartTest() {
602547 onWebView ().withElement (findElement (Locator .ID , "ac_path_2w" )).perform (webClick ());
603548 onWebView ().withElement (findElement (Locator .ID , "ac_path_6r" )).perform (webClick ());
604549 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
605-
606- pressBack ();
607550 }
608551
609552 @ Test
@@ -615,8 +558,6 @@ public void area3DChartTest() {
615558 onWebView ().withElement (findElement (Locator .ID , "ac_path_2j" )).perform (webClick ());
616559 onWebView ().withElement (findElement (Locator .ID , "ac_path_23" )).perform (webClick ());
617560 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
618-
619- pressBack ();
620561 }
621562
622563 @ Test
@@ -628,8 +569,6 @@ public void hiloChartTest() {
628569 onWebView ().withElement (findElement (Locator .ID , "ac_path_2b" )).perform (webClick ());
629570 onWebView ().withElement (findElement (Locator .ID , "ac_path_3b" )).perform (webClick ());
630571 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
631-
632- pressBack ();
633572 }
634573
635574 @ Test
@@ -639,8 +578,6 @@ public void ohlcChartTest() {
639578
640579 onWebView ().withElement (findElement (Locator .ID , "container" )).perform (webClick ());
641580 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
642-
643- pressBack ();
644581 }
645582
646583 @ Test
@@ -659,8 +596,6 @@ public void quadrantChartTest() {
659596 onWebView ().withElement (findElement (Locator .ID , "ac_path_d" )).perform (webClick ());
660597 onWebView ().withElement (findElement (Locator .ID , "ac_path_f" )).perform (webClick ());
661598 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
662-
663- pressBack ();
664599 }
665600
666601 @ Test
@@ -677,8 +612,6 @@ public void sunburstChartTest() {
677612 onWebView ().withElement (findElement (Locator .ID , "ac_path_5" )).perform (webClick ());
678613 onWebView ().withElement (findElement (Locator .ID , "ac_path_5" )).perform (webClick ());
679614 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
680-
681- pressBack ();
682615 }
683616
684617 @ Test
@@ -700,8 +633,6 @@ public void bubbleMapTest() {
700633 onWebView ().withElement (findElement (Locator .ID , "ac_circle_11" )).perform (webClick ());
701634 onWebView ().withElement (findElement (Locator .ID , "ac_circle_x" )).perform (webClick ());
702635 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
703-
704- pressBack ();
705636 }
706637
707638 @ Test
@@ -717,8 +648,6 @@ public void choroplethMapTest() {
717648 onWebView ().withElement (findElement (Locator .ID , "ac_path_10" )).perform (webClick ());
718649 onWebView ().withElement (findElement (Locator .ID , "ac_path_s" )).perform (webClick ());
719650 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
720-
721- pressBack ();
722651 }
723652
724653 @ Test
@@ -735,8 +664,6 @@ public void pointMapTest() {
735664 onWebView ().withElement (findElement (Locator .ID , "ac_path_25" )).perform (webClick ());
736665 onWebView ().withElement (findElement (Locator .ID , "ac_path_26" )).perform (webClick ());
737666 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
738-
739- pressBack ();
740667 }
741668
742669 @ Test
@@ -751,8 +678,6 @@ public void connectorMapTest() {
751678 onWebView ().withElement (findElement (Locator .ID , "ac_path_7l" )).perform (webClick ());
752679 onWebView ().withElement (findElement (Locator .ID , "ac_path_7m" )).perform (webClick ());
753680 onView (withId (R .id .web_view )).check (matches (isEnabled ()));
754-
755- pressBack ();
756681 }
757682
758683}
0 commit comments