Documentation
¶
Overview ¶
Package filesapp supports controlling the Files App on Chrome OS.
Index ¶
- Constants
- func WindowFinder(appID string) *nodewith.Finder
- type FilesApp
- func App(ctx context.Context, tconn *chrome.TestConn, appID string) (*FilesApp, error)
- func Launch(ctx context.Context, tconn *chrome.TestConn) (*FilesApp, error)
- func LaunchSWA(ctx context.Context, tconn *chrome.TestConn) (*FilesApp, error)
- func Relaunch(ctx context.Context, tconn *chrome.TestConn, filesApp *FilesApp) (*FilesApp, error)
- func (f *FilesApp) ClearSearch() uiauto.Action
- func (f *FilesApp) ClickContextMenuItem(fileName string, menuItems ...string) uiauto.Action
- func (f *FilesApp) ClickDirectoryContextMenuItem(dirName string, menuItems ...string) uiauto.Action
- func (f *FilesApp) ClickMoreMenuItem(menuItems ...string) uiauto.Action
- func (f *FilesApp) Close(ctx context.Context) error
- func (f *FilesApp) CreateFolder(kb *input.KeyboardEventWriter, dirName string) uiauto.Action
- func (f *FilesApp) DeleteFileOrFolder(kb *input.KeyboardEventWriter, fileName string) uiauto.Action
- func (f *FilesApp) DoubleClick(finder *nodewith.Finder) uiauto.Action
- func (f *FilesApp) DragAndDropFile(fileName string, dropPoint coords.Point, kb *input.KeyboardEventWriter) uiauto.Action
- func (f *FilesApp) EnsureFocused(finder *nodewith.Finder) uiauto.Action
- func (f *FilesApp) Exists(finder *nodewith.Finder) uiauto.Action
- func (f *FilesApp) FileExists(fileName string) uiauto.Action
- func (f *FilesApp) FocusAndWait(finder *nodewith.Finder) uiauto.Action
- func (f *FilesApp) Gone(finder *nodewith.Finder) uiauto.Action
- func (f *FilesApp) Info(ctx context.Context, finder *nodewith.Finder) (*uiauto.NodeInfo, error)
- func (f *FilesApp) IsNodeFound(ctx context.Context, finder *nodewith.Finder) (bool, error)
- func (f *FilesApp) LeftClick(finder *nodewith.Finder) uiauto.Action
- func (f *FilesApp) LeftClickUntil(finder *nodewith.Finder, condition func(context.Context) error) uiauto.Action
- func (f *FilesApp) NodesInfo(ctx context.Context, finder *nodewith.Finder) ([]uiauto.NodeInfo, error)
- func (f *FilesApp) OpenDir(dirName, expectedTitle string) uiauto.Action
- func (f *FilesApp) OpenDownloads() uiauto.Action
- func (f *FilesApp) OpenDrive() uiauto.Action
- func (f *FilesApp) OpenFile(fileName string) uiauto.Action
- func (f *FilesApp) OpenLinuxFiles() uiauto.Action
- func (f *FilesApp) OpenPath(expectedTitle, dirName string, path ...string) uiauto.Action
- func (f *FilesApp) OpenPlayfiles() uiauto.Action
- func (f *FilesApp) OpenQuickView(fileName string) uiauto.Action
- func (f *FilesApp) PerformActionAndRetryMaximizedOnFail(action uiauto.Action) uiauto.Action
- func (f *FilesApp) RenameFile(kb *input.KeyboardEventWriter, oldName, newName string) uiauto.Action
- func (f *FilesApp) RightClick(finder *nodewith.Finder) uiauto.Action
- func (f *FilesApp) RightClickFile(fileName string) uiauto.Action
- func (f *FilesApp) Search(kb *input.KeyboardEventWriter, searchTerms string) uiauto.Action
- func (f *FilesApp) SelectFile(fileName string) uiauto.Action
- func (f *FilesApp) SelectMultipleFiles(kb *input.KeyboardEventWriter, fileList ...string) uiauto.Action
- func (f *FilesApp) ToggleAvailableOfflineForFile(fileName string) uiauto.Action
- func (f *FilesApp) WaitForFile(fileName string) uiauto.Action
- func (f *FilesApp) WaitUntilExists(finder *nodewith.Finder) uiauto.Action
- func (f *FilesApp) WaitUntilFileGone(fileName string) uiauto.Action
- func (f *FilesApp) WaitUntilGone(finder *nodewith.Finder) uiauto.Action
- func (f *FilesApp) WithInterval(interval time.Duration) *FilesApp
- func (f *FilesApp) WithPollOpts(pollOpts testing.PollOptions) *FilesApp
- func (f *FilesApp) WithTimeout(timeout time.Duration) *FilesApp
Constants ¶
const ( Open = "Open" OpenWith = "Open with…" Cut = "Cut Ctrl+X" Copy = "Copy Ctrl+C" Paste = "Paste Ctrl+V" GetInfo = "Get info Space" // Space is the key shortcut. Rename = "Rename Ctrl+Enter" Delete = "Delete Alt+Backspace" ZipSelection = "Zip select" NewFolder = "New folder Ctrl+E" )
Context menu items for a file, values are the a11y name.
const ( Downloads = "Downloads" GoogleDrive = "Google Drive" MyDrive = "My Drive" MyFiles = "My files" Playfiles = "Play files" Recent = "Recent" Images = "Images" )
Directory names.
const DownloadPath = "/home/chronos/user/Downloads/"
DownloadPath is the location of Downloads for the user.
const FilesTitlePrefix = "Files - "
FilesTitlePrefix is the prefix of the Ash window title.
const MyFilesPath = "/home/chronos/user/MyFiles"
MyFilesPath is the location of My files for the user.
Variables ¶
This section is empty.
Functions ¶
func WindowFinder ¶
WindowFinder finds the window based on the Files app type running.
Types ¶
type FilesApp ¶
type FilesApp struct {
// contains filtered or unexported fields
}
FilesApp represents an instance of the Files App.
func App ¶
App returns an existing instance of the Files app. An error is returned if the app cannot be found.
func Launch ¶
Launch launches the Files Chrome app and returns it. An error is returned if the app fails to launch.
func LaunchSWA ¶
LaunchSWA launches the Files app SWA variant and returns it. An error is returned if the app fails to launch.
func (*FilesApp) ClearSearch ¶
ClearSearch clicks the clear button to clear the search results and leave search mode.
func (*FilesApp) ClickContextMenuItem ¶
ClickContextMenuItem returns a function that right clicks a file to open the context menu and then clicks on sub menu items. This method will not select context menu for items in the navigation tree.
func (*FilesApp) ClickDirectoryContextMenuItem ¶
ClickDirectoryContextMenuItem returns a function that right clicks a directory in the navigation tree to open the context menu and then clicks on sub menu items. An error is returned if dir is not found or right click fails.
func (*FilesApp) ClickMoreMenuItem ¶
ClickMoreMenuItem returns a function that opens More menu then clicks on sub menu items.
func (*FilesApp) Close ¶
Close closes the Files App. This is automatically done when chrome resets and is not necessary to call.
func (*FilesApp) CreateFolder ¶
CreateFolder returns a function that creates a new folder named dirName in the current directory.
func (*FilesApp) DeleteFileOrFolder ¶
DeleteFileOrFolder returns a function that deletes a file or folder. The parent folder must currently be open for this to work. Consider using OpenPath to do this.
func (*FilesApp) DoubleClick ¶
DoubleClick calls ui.DoubleClick scoping the finder to the Files App.
func (*FilesApp) DragAndDropFile ¶
func (f *FilesApp) DragAndDropFile(fileName string, dropPoint coords.Point, kb *input.KeyboardEventWriter) uiauto.Action
DragAndDropFile selects the specified file and does a drag and drop to the specified point.
func (*FilesApp) EnsureFocused ¶
EnsureFocused calls ui.FocusAndWait if the target node is not focused.
func (*FilesApp) FileExists ¶
FileExists calls ui.Exists to check whether a folder or a file exists in the Files App.
func (*FilesApp) FocusAndWait ¶
FocusAndWait calls ui.FocusAndWait scoping the finder to the Files App.
func (*FilesApp) IsNodeFound ¶
IsNodeFound calls ui.IsNodeFound scoping the finder to the Files App.
func (*FilesApp) LeftClickUntil ¶
func (f *FilesApp) LeftClickUntil(finder *nodewith.Finder, condition func(context.Context) error) uiauto.Action
LeftClickUntil calls ui.LeftClickUntil scoping the finder to the Files App.
func (*FilesApp) NodesInfo ¶
func (f *FilesApp) NodesInfo(ctx context.Context, finder *nodewith.Finder) ([]uiauto.NodeInfo, error)
NodesInfo calls ui.NodesInfo scoping the finder to the Files App.
func (*FilesApp) OpenDir ¶
OpenDir returns a function that opens one of the directories shown in the navigation tree. An error is returned if dir is not found or does not open.
func (*FilesApp) OpenDownloads ¶
OpenDownloads returns a function that opens the Downloads folder in the Files App. An error is returned if Downloads is not found or does not open.
func (*FilesApp) OpenDrive ¶
OpenDrive returns a function that opens the Google Drive folder in the Files App. An error is returned if Drive is not found or does not open.
func (*FilesApp) OpenFile ¶
OpenFile returns a function that executes double click on a file to open it with default app.
func (*FilesApp) OpenLinuxFiles ¶
OpenLinuxFiles returns a function that opens the Linux files folder in the Files App. An error is returned if Linux files is not found or does not open.
func (*FilesApp) OpenPath ¶
OpenPath returns a function that opens a folder. Parameter path should be a path to the folder, e.g, Downloads > testfolder1 > subfolder > ...
func (*FilesApp) OpenPlayfiles ¶
OpenPlayfiles returns a function that opens the "Play files" folder in the Files App. An error is returned if "Play files"" is not found or does not open.
func (*FilesApp) OpenQuickView ¶
OpenQuickView returns a function that opens the QuickView menu for a file.
func (*FilesApp) PerformActionAndRetryMaximizedOnFail ¶
PerformActionAndRetryMaximizedOnFail attempts an action and if it fails, maximizes the Files app and tries again. TODO(crbug/1189914): Remove once the underlying race condition causing the listbox to not populate is fixed.
func (*FilesApp) RenameFile ¶
RenameFile renames a file that is currently visible. To rename a file in a specific directory, first open the path, then rename the file.
func (*FilesApp) RightClick ¶
RightClick calls ui.RightClick scoping the finder to the Files App.
func (*FilesApp) RightClickFile ¶
RightClickFile returns a function that executes right click on a file to open its context menu.
func (*FilesApp) Search ¶
Search clicks the search button, enters search text and presses enter. The search occurs within the currently visible directory root e.g. Downloads.
func (*FilesApp) SelectFile ¶
SelectFile returns a function that selects a file by clicking on it.
func (*FilesApp) SelectMultipleFiles ¶
func (f *FilesApp) SelectMultipleFiles(kb *input.KeyboardEventWriter, fileList ...string) uiauto.Action
SelectMultipleFiles returns a function that selects multiple items in the Files app listBox while pressing 'Ctrl'.
func (*FilesApp) ToggleAvailableOfflineForFile ¶
ToggleAvailableOfflineForFile selects the specified file and toggles the Available Offline switch.
func (*FilesApp) WaitForFile ¶
WaitForFile returns a function that waits for a file to exist.
func (*FilesApp) WaitUntilExists ¶
WaitUntilExists calls ui.WaitUntilExists scoping the finder to the Files App.
func (*FilesApp) WaitUntilFileGone ¶
WaitUntilFileGone returns a function that waits for a file to no longer exist.
func (*FilesApp) WaitUntilGone ¶
WaitUntilGone calls ui.WaitUntilGone scoping the finder to the Files App.
func (*FilesApp) WithInterval ¶
WithInterval returns a new FilesApp with the specified polling interval. This does not launch the Files App again.
func (*FilesApp) WithPollOpts ¶
func (f *FilesApp) WithPollOpts(pollOpts testing.PollOptions) *FilesApp
WithPollOpts returns a new FilesApp with the specified polling options. This does not launch the Files App again.