@@ -52,17 +52,18 @@ public static void beforeScreenshot() {
52
52
53
53
@ Test
54
54
public void gridViewScreenshot () {
55
- ActivityScenario .launch (FileDisplayActivity .class );
55
+ try ( ActivityScenario < FileDisplayActivity > ignored = ActivityScenario .launch (FileDisplayActivity .class )) {
56
56
57
- onView (anyOf (withText (R .string .action_switch_grid_view ), withId (R .id .switch_grid_view_button ))).perform (click ());
57
+ onView (anyOf (withText (R .string .action_switch_grid_view ), withId (R .id .switch_grid_view_button ))).perform (click ());
58
58
59
- shortSleep ();
59
+ shortSleep ();
60
60
61
- Screengrab .screenshot ("01_gridView" );
61
+ Screengrab .screenshot ("01_gridView" );
62
62
63
- onView (anyOf (withText (R .string .action_switch_list_view ), withId (R .id .switch_grid_view_button ))).perform (click ());
63
+ onView (anyOf (withText (R .string .action_switch_list_view ), withId (R .id .switch_grid_view_button ))).perform (click ());
64
64
65
- Assert .assertTrue (true ); // if we reach this, everything is ok
65
+ Assert .assertTrue (true ); // if we reach this, everything is ok
66
+ }
66
67
}
67
68
68
69
@ Test
@@ -77,61 +78,66 @@ public void listViewScreenshot() {
77
78
assertTrue (result .isSuccess ());
78
79
}
79
80
80
- ActivityScenario .launch (FileDisplayActivity .class );
81
+ try ( ActivityScenario < FileDisplayActivity > ignored = ActivityScenario .launch (FileDisplayActivity .class )) {
81
82
82
- // go into work folder
83
- onView (withId (R .id .list_root )).perform (RecyclerViewActions .actionOnItemAtPosition (0 , click ()));
83
+ // go into work folder
84
+ onView (withId (R .id .list_root )).perform (RecyclerViewActions .actionOnItemAtPosition (0 , click ()));
84
85
85
- Screengrab .screenshot ("02_listView" );
86
+ Screengrab .screenshot ("02_listView" );
86
87
87
- Assert .assertTrue (true ); // if we reach this, everything is ok
88
+ Assert .assertTrue (true ); // if we reach this, everything is ok
89
+ }
88
90
}
89
91
90
92
@ Test
91
93
public void drawerScreenshot () {
92
- ActivityScenario .launch (FileDisplayActivity .class );
94
+ try ( ActivityScenario < FileDisplayActivity > ignored = ActivityScenario .launch (FileDisplayActivity .class )) {
93
95
94
- onView (withId (R .id .drawer_layout )).perform (DrawerActions .open ());
96
+ onView (withId (R .id .drawer_layout )).perform (DrawerActions .open ());
95
97
96
- Screengrab .screenshot ("03_drawer" );
98
+ Screengrab .screenshot ("03_drawer" );
97
99
98
- onView (withId (R .id .drawer_layout )).perform (DrawerActions .close ());
100
+ onView (withId (R .id .drawer_layout )).perform (DrawerActions .close ());
99
101
100
- Assert .assertTrue (true ); // if we reach this, everything is ok
102
+ Assert .assertTrue (true ); // if we reach this, everything is ok
103
+ }
101
104
}
102
105
103
106
@ Test
104
107
public void multipleAccountsScreenshot () {
105
- ActivityScenario .launch (FileDisplayActivity .class );
108
+ try ( ActivityScenario < FileDisplayActivity > ignored = ActivityScenario .launch (FileDisplayActivity .class )) {
106
109
107
- onView (withId (R .id .switch_account_button )).perform (click ());
110
+ onView (withId (R .id .switch_account_button )).perform (click ());
108
111
109
- Screengrab .screenshot ("04_accounts" );
112
+ Screengrab .screenshot ("04_accounts" );
110
113
111
- pressBack ();
114
+ pressBack ();
112
115
113
- Assert .assertTrue (true ); // if we reach this, everything is ok
116
+ Assert .assertTrue (true ); // if we reach this, everything is ok
117
+ }
114
118
}
115
119
116
120
@ Test
117
121
public void autoUploadScreenshot () {
118
- ActivityScenario .launch (SyncedFoldersActivity .class );
122
+ try ( ActivityScenario < SyncedFoldersActivity > ignored = ActivityScenario .launch (SyncedFoldersActivity .class )) {
119
123
120
- Screengrab .screenshot ("05_autoUpload" );
124
+ Screengrab .screenshot ("05_autoUpload" );
121
125
122
- Assert .assertTrue (true ); // if we reach this, everything is ok
126
+ Assert .assertTrue (true ); // if we reach this, everything is ok
127
+ }
123
128
}
124
129
125
130
@ Test
126
131
public void davdroidScreenshot () {
127
- ActivityScenario .launch (SettingsActivity .class );
132
+ try ( ActivityScenario < SettingsActivity > ignored = ActivityScenario .launch (SettingsActivity .class )) {
128
133
129
- onData (PreferenceMatchers .withTitle (R .string .prefs_category_more )).perform (ViewActions .scrollTo ());
134
+ onData (PreferenceMatchers .withTitle (R .string .prefs_category_more )).perform (ViewActions .scrollTo ());
130
135
131
- shortSleep ();
136
+ shortSleep ();
132
137
133
- Screengrab .screenshot ("06_davdroid" );
138
+ Screengrab .screenshot ("06_davdroid" );
134
139
135
- Assert .assertTrue (true ); // if we reach this, everything is ok
140
+ Assert .assertTrue (true ); // if we reach this, everything is ok
141
+ }
136
142
}
137
143
}
0 commit comments