1 /* 2 * Copyright (C) 2019 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.platform.helpers; 18 19 import android.support.test.uiautomator.Direction; 20 21 public interface IDriveHelper extends IAppHelper { 22 23 /** 24 * Setup expectations: Google Drive is opened and the navigation button is visible. 25 * 26 * <p>This method will go to "My Drive" page. 27 */ goToMyDrive()28 public void goToMyDrive(); 29 30 /** 31 * Setup expectations: Google Drive is opened and the navigation button is visible. 32 * 33 * <p>This method will go to "Shared with me" page. 34 */ goToSharedWithMe()35 public void goToSharedWithMe(); 36 37 /** 38 * Setup expectations: Google Drive is opened and the navigation drawer is visible. 39 * 40 * <p>This method will open the navigation drawer. 41 */ openNavigationDrawer()42 public void openNavigationDrawer(); 43 44 /** 45 * Setup expectations: Google Drive is opened and the search button is visible. 46 * 47 * <p>This method will input searching filename. 48 */ searchFile(String fileName)49 public void searchFile(String fileName); 50 51 /** 52 * Setup expectations: Google Drive is opened and the search result is displayed. 53 * 54 * <p>This method will click the menu of search result by index. 55 * 56 * @param index The index of the search result to select 57 */ clickSearchResultActionButton(int index)58 public void clickSearchResultActionButton(int index); 59 60 /** 61 * Setup expectations: Google Drive is opened and click the action button of search result file. 62 * 63 * <p>This method will click the download button 64 */ clickDownloadFileButton()65 public void clickDownloadFileButton(); 66 67 /** 68 * Setup expectations: Existing file is removed before download. Click download file button. 69 * 70 * <p>This method will check if file is created in Download folder. 71 * 72 * @param fileName file to search 73 * @return true if the file is created in Download folder 74 */ isStartDownloading(String fileName)75 public boolean isStartDownloading(String fileName); 76 77 /** 78 * Setup expectations: Start downloading file. 79 * 80 * <p>This method will check if download is still processing. 81 * 82 * @param fileName file to download 83 * @return true if the file modified date is still updating. 84 */ isDownloading(String fileName)85 public boolean isDownloading(String fileName); 86 87 /** 88 * Setup expectations: File is downloaded in Download folder. 89 * 90 * <p>This method will remove the existing file in Download folder. 91 * 92 * @param fileName file to download 93 */ removeDownloadedFile(String fileName)94 public void removeDownloadedFile(String fileName); 95 96 /** 97 * Setup expectations: Google Drive is open and navigation button is visible. 98 * 99 * <p>This method will click into settings page and click clear cache. 100 */ clearCache()101 public void clearCache(); 102 103 /** 104 * Setup expectations: Google Drive is open and file list is visible. 105 * 106 * <p>This method will click on the first file. 107 */ openFile()108 public void openFile(); 109 110 /** 111 * Setup expectations: Google Drive is open to a scrollable recycler or viewport 112 * 113 * <p>This method will scroll the page in the direction and amount passed in 114 * 115 * @return true if scrollable view is findable, or false if not. 116 */ scrollPage(Direction dir, float value)117 public boolean scrollPage(Direction dir, float value); 118 119 /** 120 * Setup expectations: on a doc page without scrollable recycler or viewport 121 * 122 * <p>Scroll vertically up or down 123 */ scrollVert(Direction dir)124 public void scrollVert(Direction dir); 125 126 /** 127 * Setup expectations: Google Drive is open and Files tab is selected at the bottom 128 * 129 * @param fileName File name to check whether it exist or not 130 */ doesFileExist(String fileName)131 boolean doesFileExist(String fileName); 132 133 /** 134 * Setup expectations: Google Drive is open and Files tab is selected at the bottom 135 * 136 * @param fileName File name to upload from local device documents 137 */ uploadFileFromLocalDeviceDocuments(String fileName)138 void uploadFileFromLocalDeviceDocuments(String fileName); 139 140 /** 141 * Setup expectations: Google Drive is open and Files tab is selected at the bottom 142 * 143 * <p>Given file name is visible and clickable to open 144 * 145 * @param fileName File name to open 146 */ openFile(String fileName)147 void openFile(String fileName); 148 149 /** 150 * Setup expectations: Google Drive is open and Click on file to open in Docs Editor 151 * 152 * <p>Waits until the document is fully opened in Docs Editor 153 */ waitForDocumentToOpen()154 void waitForDocumentToOpen(); 155 } 156