2828@ FixMethodOrder (MethodSorters .NAME_ASCENDING )
2929public class E2ETest {
3030
31- private static final String TAG = E2ETest . class . getSimpleName () ;
31+ private static final String TAG = "E2E" ;
3232
3333 private UiDevice mDevice ;
3434
@@ -54,73 +54,75 @@ public void after() {
5454
5555 @ Test
5656 public void test_00_configureNextcloudAccount () throws UiObjectNotFoundException {
57+ Log .i (TAG , "Configure Nextcloud account" );
5758 launch (APP_NEXTCLOUD );
5859
5960 final var loginButton = mDevice .findObject (new UiSelector ().textContains ("Log in" ));
6061 loginButton .waitForExists (TIMEOUT );
61- log ( "Login Button exists. Clicking on it..." );
62+ Log . d ( TAG , "Login Button exists. Clicking on it..." );
6263 loginButton .click ();
63- log ( "Login Button clicked." );
64+ Log . d ( TAG , "Login Button clicked." );
6465
6566 final var urlInput = mDevice .findObject (new UiSelector ().focused (true ));
6667 urlInput .waitForExists (TIMEOUT );
67- log ( "URL input exists." );
68- log ( "Entering URL..." );
68+ Log . d ( TAG , "URL input exists." );
69+ Log . d ( TAG , "Entering URL..." );
6970 urlInput .setText (SERVER_URL );
70- log ( "URL entered." );
71+ Log . d ( TAG , "URL entered." );
7172
72- log ( "Pressing enter..." );
73+ Log . d ( TAG , "Pressing enter..." );
7374 mDevice .pressEnter ();
74- log ( "Enter pressed." );
75+ Log . d ( TAG , "Enter pressed." );
7576
76- log ( "Waiting for WebView..." );
77+ Log . d ( TAG , "Waiting for WebView..." );
7778 mDevice .wait (findObject (By .clazz (WebView .class )), TIMEOUT );
78- log ( "WebView exists." );
79+ Log . d ( TAG , "WebView exists." );
7980
8081 final var webViewLoginButton = mDevice .findObject (new UiSelector ()
8182 .instance (0 )
8283 .className (Button .class ));
83- log ( "Waiting for WebView Login Button..." );
84+ Log . d ( TAG , "Waiting for WebView Login Button..." );
8485 webViewLoginButton .waitForExists (TIMEOUT );
85- log ( "WebView Login Button exists. Clicking on it..." );
86+ Log . d ( TAG , "WebView Login Button exists. Clicking on it..." );
8687 webViewLoginButton .click ();
8788
8889 final var usernameInput = mDevice .findObject (new UiSelector ()
8990 .instance (0 )
9091 .className (EditText .class ));
91- log ( "Waiting for Username Input..." );
92+ Log . d ( TAG , "Waiting for Username Input..." );
9293 usernameInput .waitForExists (TIMEOUT );
93- log ( "Username Input exists. Setting text..." );
94+ Log . d ( TAG , "Username Input exists. Setting text..." );
9495 usernameInput .setText (SERVER_USERNAME );
95- log ( "Username has been set." );
96+ Log . d ( TAG , "Username has been set." );
9697
9798 final var passwordInput = mDevice .findObject (new UiSelector ()
9899 .instance (1 )
99100 .className (EditText .class ));
100- log ( "Waiting for Password Input..." );
101+ Log . d ( TAG , "Waiting for Password Input..." );
101102 passwordInput .waitForExists (TIMEOUT );
102- log ( "Password Input exists. Setting text..." );
103+ Log . d ( TAG , "Password Input exists. Setting text..." );
103104 passwordInput .setText (SERVER_PASSWORD );
104105
105106 final var webViewSubmitButton = mDevice .findObject (new UiSelector ()
106107 .instance (0 )
107108 .className (Button .class ));
108- log ( "Waiting for WebView Submit Button..." );
109+ Log . d ( TAG , "Waiting for WebView Submit Button..." );
109110 webViewSubmitButton .waitForExists (TIMEOUT );
110- log ( "WebView Submit Button exists. Clicking on it..." );
111+ Log . d ( TAG , "WebView Submit Button exists. Clicking on it..." );
111112 webViewSubmitButton .click ();
112113
113114 final var webViewGrantAccessButton = mDevice .findObject (new UiSelector ()
114115 .instance (0 )
115116 .className (Button .class ));
116- log ( "Waiting for WebView Grant Access Button..." );
117+ Log . d ( TAG , "Waiting for WebView Grant Access Button..." );
117118 webViewGrantAccessButton .waitForExists (TIMEOUT );
118- log ( "WebView Grant Access Button exists. Clicking on it..." );
119+ Log . d ( TAG , "WebView Grant Access Button exists. Clicking on it..." );
119120 webViewGrantAccessButton .click ();
120121 }
121122
122123 @ Test
123124 public void test_01_importAccountIntoSampleApp () throws UiObjectNotFoundException , InterruptedException {
125+ Log .i (TAG , "Import account into sample app" );
124126 launch (APP_SAMPLE );
125127
126128 final var accountButton = mDevice .findObject (new UiSelector ()
@@ -142,31 +144,32 @@ public void test_01_importAccountIntoSampleApp() throws UiObjectNotFoundExceptio
142144 Thread .sleep (10_000 );
143145 final var okButton = mDevice .findObject (new UiSelector ()
144146 .textContains ("OK" ));
145- log ( "Waiting for OK Button..." );
147+ Log . d ( TAG , "Waiting for OK Button..." );
146148 okButton .waitForExists (TIMEOUT );
147- log ( "OK Button exists. Clicking on it..." );
149+ Log . d ( TAG , "OK Button exists. Clicking on it..." );
148150 okButton .click ();
149- log ( "OK Button clicked" );
151+ Log . d ( TAG , "OK Button clicked" );
150152
151153 mDevice .waitForWindowUpdate (null , TIMEOUT );
152154
153155 final var allowButton = mDevice .findObject (new UiSelector ()
154156 .instance (1 )
155157 .className (Button .class ));
156- log ( "Waiting for Allow Button..." );
158+ Log . d ( TAG , "Waiting for Allow Button..." );
157159 allowButton .waitForExists (TIMEOUT );
158- log ( "Allow Button exists. Clicking on it..." );
160+ Log . d ( TAG , "Allow Button exists. Clicking on it..." );
159161 allowButton .click ();
160- log ( "Allow Button clicked" );
162+ Log . d ( TAG , "Allow Button clicked" );
161163
162- log ( "Waiting for finished import..." );
164+ Log . d ( TAG , "Waiting for finished import..." );
163165 final var welcomeText = mDevice .findObject (new UiSelector ().description ("Filter" ));
164166 welcomeText .waitForExists (TIMEOUT );
165- log ( "Import finished." );
167+ Log . d ( TAG , "Import finished." );
166168 }
167169
168170 @ Test
169171 public void test_02_verifyResult () throws UiObjectNotFoundException {
172+ Log .i (TAG , "Verify successful import" );
170173 launch (APP_SAMPLE );
171174
172175 final var result = mDevice .findObject (new UiSelector ()
@@ -175,11 +178,8 @@ public void test_02_verifyResult() throws UiObjectNotFoundException {
175178 System .out .println ("Found: " + result .getText ());
176179 }
177180
178- private void log (@ NonNull String message ) {
179- Log .i (TAG , message );
180- }
181-
182181 private void launch (@ NonNull String packageName ) {
182+ Log .d (TAG , "Launching " + packageName );
183183 final var context = getInstrumentation ().getContext ();
184184 context .startActivity (context
185185 .getPackageManager ()
0 commit comments