4e746f20186da8abaa91547a07b3cfc4c256af85
[android_pandora.git] /
1 /*
2  * This is an example test project created in Eclipse to test NotePad which is a sample 
3  * project located in AndroidSDK/samples/android-11/NotePad
4  * Just click on File --> New --> Project --> Android Project --> Create Project from existing source and
5  * select NotePad.
6  * 
7  * Then you can run these test cases either on the emulator or on device. You right click
8  * the test project and select Run As --> Run As Android JUnit Test
9  * 
10  * @author Renas Reda, renas.reda@jayway.com
11  * 
12  */
13
14 package org.openintents.filemanager.test;
15
16 import java.io.File;
17 import java.io.FileWriter;
18 import java.io.IOException;
19 import java.util.Random;
20
21 import android.app.Activity;
22 import android.content.Intent;
23 import android.content.SharedPreferences;
24 import android.net.Uri;
25 import android.os.Environment;
26 import android.preference.PreferenceManager;
27 import android.test.InstrumentationTestCase;
28 import android.test.suitebuilder.annotation.Smoke;
29
30 import com.jayway.android.robotium.solo.Solo;
31
32 public class TestFileManagerActivity extends InstrumentationTestCase {
33         
34         private static final String TAG = "TestFileManagerActivity";
35         
36         private Solo solo;
37         private Activity activity;
38         private Random random = new Random();
39         private Intent intent;
40         private String sdcardPath;
41         
42         public TestFileManagerActivity() {
43                 super();
44         }
45
46         protected void setUp() throws Exception {
47                 super.setUp();
48                 
49                 sdcardPath = Environment.getExternalStorageDirectory().getAbsolutePath()+'/';
50                 
51                 // need to do this before creating activity
52                 cleanDirectory(new File(sdcardPath + "oi-filemanager-tests"));
53                 createDirectory(sdcardPath + "oi-filemanager-tests");
54                 
55                 intent = new Intent();
56                 intent.setAction("android.intent.action.MAIN");
57                 intent.setClassName("org.openintents.filemanager",
58                                 "org.openintents.filemanager.FileManagerActivity");
59                 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
60
61                 activity = getInstrumentation().startActivitySync(intent);
62
63                 this.solo = new Solo(getInstrumentation(), activity);
64         }
65
66         protected void tearDown() throws Exception {
67                 try {
68                         this.solo.finishOpenedActivities();
69                 } catch (Throwable e) {
70                         e.printStackTrace();
71                 }
72                 super.tearDown();
73                 cleanDirectory(new File(sdcardPath + "oi-filemanager-tests"));
74         }
75
76         private String getAppString(int resId) {
77                 return activity.getString(resId);
78         }
79
80         @Smoke
81         public void test000Eula() {
82                 String accept = getAppString(org.openintents.distribution.R.string.oi_distribution_eula_accept);
83                 String cancel = getAppString(org.openintents.distribution.R.string.oi_distribution_eula_refuse);
84                 boolean existsAccept = solo.searchButton(accept);
85                 boolean existsCancel = solo.searchButton(cancel);
86                 
87                 if (existsAccept && existsCancel) {
88                         solo.clickOnButton(accept);
89                 }
90         }
91
92         @Smoke
93         public void test001RecentChanges() {
94                 String recentChanges = getAppString(org.openintents.distribution.R.string.oi_distribution_newversion_recent_changes);
95                 String cont = getAppString(org.openintents.distribution.R.string.oi_distribution_newversion_continue);
96                 while(solo.scrollUp());
97                 boolean existsRecentChanges = solo.searchText(recentChanges);
98                 boolean existsCont = solo.searchButton(cont);
99                 
100                 if (existsRecentChanges && existsCont) {
101                         solo.clickOnButton(cont);
102                 }
103         }
104
105         private void cleanDirectory(File file) {
106                 if(!file.exists()) return;
107                 for(String name:file.list()) {
108                         if(!name.startsWith("oi-") && !name.startsWith(".oi-")) {
109                                 throw new RuntimeException(file + " contains unexpected file");
110                         }
111                         File child = new File(file, name);
112                         if(child.isDirectory())
113                                 cleanDirectory(child);
114                         else
115                                 child.delete();
116                 }
117                 file.delete();
118                 if(file.exists()) {
119                         throw new RuntimeException("Deletion of " + file + " failed");
120                 }
121         }
122
123         private void createFile(String path, String content) throws IOException {
124                 File file = new File(path);
125                 FileWriter wr = new FileWriter(file);
126                 wr.write(content);
127                 wr.close();
128         }
129         
130         private void createDirectory(String path) throws IOException {
131                 File file = new File(path);
132                 file.mkdir();
133                 if(!file.exists())
134                         throw new IOException("Creation of " + path + " failed");
135         }
136         
137         private void deleteDirectory(String path) {
138                 File file = new File(path);
139                 if(file.exists())
140                         if(file.isDirectory())
141                                 cleanDirectory(file);
142                         file.delete();
143         }
144
145         public void testNavigation() throws IOException {
146 //              if(solo.searchText("Accept")) {
147 //                      solo.clickOnButton("Accept");
148 //                      if(solo.searchButton("Continue"))
149 //                              solo.clickOnButton("Continue");
150 //              }
151                 createDirectory(sdcardPath + "oi-filemanager-tests");
152                 createFile(sdcardPath + "oi-filemanager-tests/oi-test.txt", "");
153                 createDirectory(sdcardPath + "oi-filemanager-tests/oi-test-dir");
154                 createFile(sdcardPath + "oi-filemanager-tests/oi-test-dir/oi-fff.txt", "");
155                 
156                 solo.clickOnText("oi-filemanager-tests");
157                 assertTrue(solo.searchText("oi-test.txt"));
158                 solo.clickOnText("oi-test-dir");
159                 assertTrue(solo.searchText("oi-fff.txt"));
160
161                 solo.goBack();
162                 solo.goBack();
163                 solo.clickOnText("oi-filemanager-tests");
164                 assertTrue(solo.searchText("oi-test.txt"));
165                 
166                 solo.clickOnText("oi-test-dir");
167                 solo.goBack();
168                 assertTrue(solo.searchText("oi-test.txt"));
169                 
170                 solo.goBack();
171         }
172         
173         public void testModification() throws IOException {
174                 createDirectory(sdcardPath + "oi-filemanager-tests");
175                 createFile(sdcardPath + "oi-filemanager-tests/oi-rem-test.txt", "");
176                 solo.clickOnText("oi-filemanager-tests");
177                 solo.clickLongOnText("oi-rem-test.txt");
178                 solo.clickOnText(getAppString(org.openintents.filemanager.R.string.menu_delete)); // Delete
179                 solo.clickOnText(getAppString(android.R.string.ok));
180                 
181                 //when actionbar is present, this test case should find the first ImageButton
182                 if(android.os.Build.VERSION.SDK_INT < 11)
183                         solo.clickOnMenuItem(getAppString(org.openintents.filemanager.R.string.menu_new_folder)); // New Folder
184                 else
185                         solo.clickOnImageButton(0);
186                 solo.enterText(0, "oi-created-folder");
187                 solo.clickOnText(getAppString(android.R.string.ok));
188                 
189                 solo.goBack();
190                 assertTrue(solo.searchText("oi-created-folder"));
191                 solo.goBack();
192                 
193                 File createdFolder = new File(sdcardPath + "oi-filemanager-tests/oi-created-folder");
194                 assertTrue(createdFolder.exists());
195                 assertTrue(createdFolder.isDirectory());
196                 assertFalse(new File(sdcardPath + "oi-filemanager-tests/oi-rem-test.txt").exists());
197         }
198         
199         public void testBookmarks() throws IOException {
200                 String fn = "oi-bookmark-" + random.nextInt(1000);
201                 createDirectory(sdcardPath + "oi-filemanager-tests");
202                 createDirectory(sdcardPath + "oi-filemanager-tests/" + fn);
203                 createFile(sdcardPath + "oi-filemanager-tests/" + fn + "/oi-inside-book.txt", "");
204                 
205                 // create bookmark
206                 
207                 solo.clickOnText("oi-filemanager-tests");
208                 solo.clickLongOnText(fn);
209                 solo.clickOnText(getAppString(org.openintents.filemanager.R.string.menu_bookmark)); // Add to bookmarks
210                 
211                 // navigate to it
212                 
213                 solo.clickOnMenuItem(getAppString(org.openintents.filemanager.R.string.bookmarks)); // Bookmarks
214                 solo.clickOnText(fn);
215                 assertTrue(solo.searchText("oi-inside-book.txt"));
216                 solo.goBack();
217                 solo.goBack();
218                 
219                 // remove it
220                 
221                 solo.clickOnMenuItem(getAppString(org.openintents.filemanager.R.string.settings));
222                 solo.clickOnText(getAppString(org.openintents.filemanager.R.string.bookmarks_manage));
223                 solo.clickOnText(fn);
224                 solo.clickOnText(getAppString(org.openintents.filemanager.R.string.bookmarks_delete));
225                 solo.goBack();
226                 
227                 // make sure that it is deleted
228                 
229                 solo.clickOnMenuItem(getAppString(org.openintents.filemanager.R.string.bookmarks));
230                 assertFalse(solo.searchText(fn));
231                 solo.goBack();
232                 solo.goBack();
233         }
234         
235         public void testActions() throws IOException {
236                 createDirectory(sdcardPath + "oi-filemanager-tests");
237                 createDirectory(sdcardPath + "oi-filemanager-tests/oi-move-target");
238                 createFile(sdcardPath + "oi-filemanager-tests/oi-file-1.txt", "");
239                 createFile(sdcardPath + "oi-filemanager-tests/oi-file-2.txt", "");
240                 createFile(sdcardPath + "oi-filemanager-tests/oi-file-3.txt", "");
241                 createFile(sdcardPath + "oi-filemanager-tests/oi-file-4.txt", "");
242                 createFile(sdcardPath + "oi-filemanager-tests/oi-file-5.txt", "");
243                 solo.clickOnText("oi-filemanager-tests");
244                 
245                 // copy
246                 
247                 solo.clickLongOnText("oi-file-1.txt");
248                 solo.clickOnText(getAppString(org.openintents.filemanager.R.string.menu_copy));
249                 selectTargetAndCheck("oi-move-target", "oi-file-1.txt", null);
250                 assertTrue(solo.searchText("oi-file-1.txt"));
251                 
252                 // move
253                 
254                 solo.clickLongOnText("oi-file-2.txt");
255                 solo.clickOnText(getAppString(org.openintents.filemanager.R.string.menu_move));
256                 selectTargetAndCheck("oi-move-target", "oi-file-2.txt", null);
257                 assertFalse(solo.searchText("oi-file-2.txt"));
258                 
259                 // multi select
260                 
261                 solo.clickOnMenuItem(getAppString(org.openintents.filemanager.R.string.menu_multi_select));
262                 solo.clickOnText("oi-file-3.txt");
263                 solo.clickOnText("oi-file-4.txt");
264                 solo.clickOnText(getAppString(org.openintents.filemanager.R.string.move_button_multiselect));
265                 selectTargetAndCheck("oi-move-target", "oi-file-3.txt", "oi-file-4.txt");
266                 
267                 // rename
268                 
269                 solo.clickLongOnText("oi-file-5.txt");
270                 solo.clickOnText(getAppString(org.openintents.filemanager.R.string.menu_rename));
271                 solo.enterText(0, "oi-renamed-file.txt");
272                 solo.clickOnText(getAppString(android.R.string.ok)); // not sure what to do
273                 assertTrue(solo.searchText("oi-renamed-file.txt"));
274                 
275                 solo.goBack();
276                 solo.goBack();
277         }
278         
279         private void selectTargetAndCheck(String dirname, String name1, String name2) throws IOException {
280                 createDirectory(sdcardPath + "oi-filemanager-tests");
281                 solo.clickOnText(dirname);
282                 solo.clickOnButton(getAppString(org.openintents.filemanager.R.string.copy_button) + "|" + 
283                                                         getAppString(org.openintents.filemanager.R.string.move_button));
284                 solo.clickOnText(dirname);
285                 assertTrue(solo.searchText(name1));
286                 if(name2 != null)
287                         assertTrue(solo.searchText(name2));
288                 solo.goBack();
289         }
290         
291         public void testDetails() throws IOException {
292                 createDirectory(sdcardPath + "oi-filemanager-tests");
293                 createFile(sdcardPath + "oi-filemanager-tests/oi-detail.txt", "abcdefg");
294
295                 solo.clickOnText("oi-filemanager-tests");
296                 
297                 solo.clickLongOnText("oi-detail.txt");
298                 solo.clickOnText(getAppString(org.openintents.filemanager.R.string.menu_details));
299                 assertTrue(solo.searchText(getAppString(org.openintents.filemanager.R.string.details_type_file)));
300                 // depending on locale:
301                 assertTrue(solo.searchText("7.00B") || solo.searchText("7.00 B") || solo.searchText("7,00B") || solo.searchText("7,00 B"));
302                 
303                 // not sure:
304                 //Calendar today = new GregorianCalendar();
305                 //String todayString = today.get(Calendar.DAY_OF_MONTH) + "/" + today.get(Calendar.MONTH) + "/" + today.get(Calendar.YEAR);
306                 //assertTrue(solo.searchText(todayString));
307
308                 solo.goBack();
309                 solo.goBack();
310                 solo.goBack();
311         }
312         
313         public void testFilters() throws IOException {
314                 createDirectory(sdcardPath + "oi-filemanager-tests");
315                 createFile(sdcardPath + "oi-filemanager-tests/oi-not-filter.txt", "");
316                 createFile(sdcardPath + "oi-filemanager-tests/oi-filtered.py", "");
317                 createDirectory(sdcardPath + "oi-filemanager-tests/oi-f-dir");
318                 solo.clickOnText("oi-filemanager-tests");
319                 
320                 solo.clickOnMenuItem(getAppString(org.openintents.filemanager.R.string.menu_filter));
321                 solo.enterText(0, ".py");
322                 solo.clickOnButton(getAppString(android.R.string.ok));
323                 
324                 assertTrue(solo.searchText("oi-filtered.py"));
325                 assertTrue(solo.searchText("oi-f-dir"));
326                 assertFalse(solo.searchText("oi-not-filter.txt"));
327                 
328                 solo.goBack();
329                 solo.goBack();
330         }
331         
332         public void testHiddenFiles() throws IOException {
333                 createDirectory(sdcardPath + "oi-filemanager-tests");
334                 createFile(sdcardPath + "oi-filemanager-tests/.oi-hidden.txt", "");
335                 solo.clickOnText("oi-filemanager-tests");
336                 
337                 boolean origState = solo.searchText(".oi-hidden.txt");
338                 
339                 solo.clickOnMenuItem(getAppString(org.openintents.filemanager.R.string.settings));
340                 
341                 solo.clickOnText(getAppString(org.openintents.filemanager.R.string.preference_displayhiddenfiles_title));
342                 solo.goBack();
343                 assertTrue(origState != solo.searchText(".oi-hidden.txt"));
344                 
345                 solo.goBack();
346                 solo.goBack();
347         }
348         
349         public void testOrder() throws IOException, InterruptedException {
350                 createDirectory(sdcardPath + "oi-filemanager-tests");
351                 createFile(sdcardPath + "oi-filemanager-tests/oi-b.txt", "bbb");
352                 Thread.sleep(10); // make sure that next file is younger
353                 createFile(sdcardPath + "oi-filemanager-tests/oi-a.txt", "aaaaaa");
354                 Thread.sleep(10);
355                 createFile(sdcardPath + "oi-filemanager-tests/oi-c.txt", "");
356                 solo.clickOnText("oi-filemanager-tests");
357                 
358                 String[] sortOrders = activity.getResources().getStringArray(org.openintents.filemanager.R.array.preference_sortby_names);
359                 
360                 setAscending(true);
361                 setSortOrder(sortOrders[0]);
362                 assertItemsInOrder("oi-a.txt", "oi-b.txt", "oi-c.txt");
363                 
364                 setSortOrder(sortOrders[1]);
365                 assertItemsInOrder("oi-c.txt", "oi-b.txt", "oi-a.txt");
366                 
367                 setSortOrder(sortOrders[2]);
368                 assertItemsInOrder("oi-b.txt", "oi-a.txt", "oi-c.txt");
369                 
370                 setAscending(false);
371                 setSortOrder(sortOrders[0]);
372                 assertItemsInOrder("oi-c.txt", "oi-b.txt", "oi-a.txt");
373         }
374         
375         private void setSortOrder(String name) {
376                 solo.clickOnMenuItem(getAppString(org.openintents.filemanager.R.string.settings));
377                 solo.clickOnText(getAppString(org.openintents.filemanager.R.string.preference_sortby));
378                 solo.clickOnText(name);
379                 solo.goBack();
380         }
381         
382         private void setAscending(boolean enabled) {
383                 SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(activity);
384                 SharedPreferences.Editor editor = settings.edit();
385                 editor.putBoolean("ascending", enabled);
386                 editor.commit();
387         }
388         
389         private void assertItemsInOrder(String a, String b, String c) {
390                 int aPos = solo.getText(a).getTop();
391                 int bPos = solo.getText(b).getTop();
392                 int cPos = solo.getText(c).getTop();
393                 if(aPos > bPos)
394                         fail("aPos > bPos");
395                 if(bPos > cPos)
396                         fail("bpos > cPos");
397         }
398         
399         public void testIntentSaveAs() throws IOException {
400                 createDirectory(sdcardPath + "oi-filemanager-tests");
401                 createFile(sdcardPath + "oi-filemanager-tests/oi-to-open.txt", "bbb");
402
403                 Uri uri = Uri.parse("file:///mnt/sdcard/oi-filemanager-tests/oi-to-open.txt");
404                 intent = new Intent("android.intent.action.VIEW", uri);
405                 intent.setClassName("org.openintents.filemanager",
406                                 "org.openintents.filemanager.SaveAsActivity");
407                 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
408                 
409                 activity = getInstrumentation().startActivitySync(intent);
410                 
411                 solo.enterText(0, "oi-target.txt");
412                 solo.clickOnButton(getAppString(android.R.string.ok));
413                 assertTrue(new File(sdcardPath + "oi-filemanager-tests/oi-to-open.txtoi-target.txt").exists());
414                 solo.goBack();
415                 solo.goBack();
416         }
417         
418         public void testIntentUrl() throws IOException {
419                 createDirectory(sdcardPath + "oi-filemanager-tests");
420                 createDirectory(sdcardPath + "oi-filemanager-tests/oi-dir-to-open");
421                 createDirectory(sdcardPath + "oi-filemanager-tests/oi-dir-to-open/oi-intent");
422                 
423                 Uri uri = Uri.parse("file:///mnt/sdcard/oi-filemanager-tests/oi-dir-to-open");
424                 intent = new Intent("android.intent.action.VIEW", uri);
425                 intent.setClassName("org.openintents.filemanager",
426                                 "org.openintents.filemanager.FileManagerActivity");
427                 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
428                 
429                 activity = getInstrumentation().startActivitySync(intent);
430                 
431                 assertTrue(solo.searchText("oi-intent"));
432                 solo.goBack();
433                 solo.goBack();
434         }
435         
436         public void testIntentUri() throws IOException {
437                 createDirectory(sdcardPath + "oi-filemanager-tests");
438                 createFile(sdcardPath + "oi-filemanager-tests/oi-to-open.txt", "bbb");          
439                 
440                 Intent intent = new Intent(Intent.ACTION_VIEW);
441                 intent.setData(Uri.parse("file://" + sdcardPath + "oi-filemanager-tests/oi-to-open.txt"));
442                 intent.setPackage("org.openintents.filemanager");
443                 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
444                 
445                 activity = getInstrumentation().startActivitySync(intent);
446                 
447                 assertTrue(solo.searchText("oi-to-open.txt"));
448                 solo.goBack();
449                 solo.goBack();  
450         }
451         
452         public void testIntentPickFile() throws IOException {
453                 // startActivityForResult is, I think, impossible to test on Robotinium
454                 createDirectory(sdcardPath + "oi-filemanager-tests");
455                 createFile(sdcardPath + "oi-filemanager-tests/oi-pick-file", "");
456                 
457                 Uri uri = Uri.parse("file:///mnt/sdcard/oi-filemanager-tests/oi-dir-to-open");
458                 intent = new Intent("org.openintents.action.PICK_FILE", uri);
459                 intent.setClassName("org.openintents.filemanager",
460                                 "org.openintents.filemanager.FileManagerActivity");
461                 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
462                 
463                 activity = getInstrumentation().startActivitySync(intent);
464                 
465                 solo.clickOnText("oi-pick-file");
466                 solo.clickOnButton(getAppString(android.R.string.ok));
467                 
468                 solo.goBack();
469         }
470         
471         public void testIntentRememberPickFilePath() throws IOException {
472                 String[] actions = new String[]{
473                         "org.openintents.action.PICK_FILE",
474                         "org.openintents.action.PICK_DIRECTORY",
475                         Intent.ACTION_GET_CONTENT
476                 };
477                 
478                 for(int i=0;i<3;i++){
479                         createDirectory(sdcardPath + "oi-filemanager-tests");
480                         if(i==1){ //Pick directory
481                                 createDirectory(sdcardPath + "oi-filemanager-tests/oi-dir-to-pick");
482                         }
483                         else{
484                                 createFile(sdcardPath + "oi-filemanager-tests/oi-file-to-pick.txt", "bbb");
485                         }
486                         //Directory because PICK_DIRECTORY doesn't show files
487                         createDirectory(sdcardPath + "oi-to-pick-test-folder-deleted");
488                         
489
490                         // Pick a file first
491                         Uri uri = Uri.parse("file:///mnt/sdcard"); //If there was already a remembered pick file path
492                         intent = new Intent(actions[i], uri);
493                         intent.setClassName("org.openintents.filemanager",
494                                         "org.openintents.filemanager.FileManagerActivity");
495                         intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
496                         
497                         activity = getInstrumentation().startActivitySync(intent);
498                         
499                         solo.clickOnText("oi-filemanager-tests");
500                         if(i==1) //Pick directory
501                                 solo.clickOnText("oi-dir-to-pick");
502                         else
503                                 solo.clickOnText("oi-file-to-pick.txt");
504                         
505                         if(i != 2) // When ACTION_GET_CONTENT, the file is picked automatically, when clicked
506                                 solo.clickOnButton(getAppString(android.R.string.ok));
507                         
508                         // Check, if we are in the oi-filemanager-tests directory
509                         intent = new Intent(actions[i]);
510                         intent.setClassName("org.openintents.filemanager",
511                                         "org.openintents.filemanager.FileManagerActivity");
512                         intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
513                         activity = getInstrumentation().startActivitySync(intent);
514                         
515                         solo.goBack();
516                         
517                         
518                         //Delete the oi-filemanager-tests directory
519                         deleteDirectory(sdcardPath + "oi-filemanager-tests");
520                         
521                         //Check, if the current directory is the default (sdcardPath)
522                         intent = new Intent(actions[i]);
523                         intent.setClassName("org.openintents.filemanager",
524                                         "org.openintents.filemanager.FileManagerActivity");
525                         intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
526                         activity = getInstrumentation().startActivitySync(intent);
527                         
528                         assertTrue(solo.searchText("oi-to-pick-test-folder-deleted"));
529                         
530                         //Clean up
531                         (new File(sdcardPath + "oi-to-pick-test-folder-deleted")).delete();
532                         
533                         solo.goBack();
534                         solo.goBack();
535                 }
536         }
537
538         public void testBrowseToOnPressEnter() throws IOException {
539                 String dirPath = "oi-filemanager-tests";
540                 String filename = "oi-test-is-in-right-directory";
541                 createDirectory(sdcardPath + dirPath);
542                 createFile(sdcardPath + dirPath + "/" + filename, "");
543                 
544                 /*
545                  *  We start at the SD card. Home ImageButton has index 0. Then there's a mnt classic button.
546                  *  And finally SD card ImageButton with index 1. (Android 1.x and 2.x)
547                  *  
548                  *  Remark: On Android 3.x(?) and 4.x, the index may have to be set to 2?
549                  */
550                 int imageButtonIndex = 0;
551                 if(android.os.Build.VERSION.SDK_INT < 11)
552                         imageButtonIndex = 1;
553                 else
554                         imageButtonIndex = 2;
555                 solo.clickOnImageButton(imageButtonIndex);
556                 
557                 solo.clickOnEditText(0); // Let the editText has focus to be able to send the enter key.
558                 solo.enterText(0, "/"+dirPath);
559                 solo.sendKey(Solo.ENTER);
560
561                 assertTrue(solo.searchText(filename));
562                 
563                 solo.goBack();
564                 solo.goBack();
565         }
566         
567         // Other possible tests:
568         //              testSend
569         //              testMore
570         //              testKeyboardFilter
571 }