filesapp

package
v0.0.0-...-683b059 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package filesapp supports controlling the Files App on Chrome OS.

Index

Constants

View Source
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"
	Share        = "Share"
)

Context menu items for a file, values are the a11y name.

View Source
const (
	Downloads   = "Downloads"
	GoogleDrive = "Google Drive"
	MyDrive     = "My Drive"
	MyFiles     = "My files"
	Playfiles   = "Play files"
	Recent      = "Recent"
	Images      = "Images"
)

Directory names.

View Source
const DownloadPath = "/home/chronos/user/Downloads/"

DownloadPath is the location of Downloads for the user.

View Source
const FilesTitlePrefix = "Files - "

FilesTitlePrefix is the prefix of the Ash window title.

View Source
const MyFilesPath = "/home/chronos/user/MyFiles"

MyFilesPath is the location of My files for the user.

Variables

This section is empty.

Functions

func WindowFinder

func WindowFinder(appID string) *nodewith.Finder

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

func App(ctx context.Context, tconn *chrome.TestConn, appID string) (*FilesApp, error)

App returns an existing instance of the Files app. An error is returned if the app cannot be found.

func Launch

func Launch(ctx context.Context, tconn *chrome.TestConn) (*FilesApp, error)

Launch launches the Files Chrome app and returns it. An error is returned if the app fails to launch.

func LaunchSWA

func LaunchSWA(ctx context.Context, tconn *chrome.TestConn) (*FilesApp, error)

LaunchSWA launches the Files app SWA variant and returns it. An error is returned if the app fails to launch.

func Relaunch

func Relaunch(ctx context.Context, tconn *chrome.TestConn, filesApp *FilesApp) (*FilesApp, error)

Relaunch closes the existing Files app first then launch the Files app again.

func (*FilesApp) ClearSearch

func (f *FilesApp) ClearSearch() uiauto.Action

ClearSearch clicks the clear button to clear the search results and leave search mode.

func (*FilesApp) ClickContextMenuItem

func (f *FilesApp) ClickContextMenuItem(fileName string, menuItems ...string) uiauto.Action

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

func (f *FilesApp) ClickDirectoryContextMenuItem(dirName string, menuItems ...string) uiauto.Action

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

func (f *FilesApp) ClickMoreMenuItem(menuItems ...string) uiauto.Action

ClickMoreMenuItem returns a function that opens More menu then clicks on sub menu items.

func (*FilesApp) Close

func (f *FilesApp) Close(ctx context.Context) error

Close closes the Files App. This is automatically done when chrome resets and is not necessary to call.

func (*FilesApp) CreateFolder

func (f *FilesApp) CreateFolder(kb *input.KeyboardEventWriter, dirName string) uiauto.Action

CreateFolder returns a function that creates a new folder named dirName in the current directory.

func (*FilesApp) DeleteFileOrFolder

func (f *FilesApp) DeleteFileOrFolder(kb *input.KeyboardEventWriter, fileName string) uiauto.Action

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

func (f *FilesApp) DoubleClick(finder *nodewith.Finder) uiauto.Action

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

func (f *FilesApp) EnsureFocused(finder *nodewith.Finder) uiauto.Action

EnsureFocused calls ui.FocusAndWait if the target node is not focused.

func (*FilesApp) Exists

func (f *FilesApp) Exists(finder *nodewith.Finder) uiauto.Action

Exists calls ui.Exists scoping the finder to the Files App.

func (*FilesApp) FileExists

func (f *FilesApp) FileExists(fileName string) uiauto.Action

FileExists calls ui.Exists to check whether a folder or a file exists in the Files App.

func (*FilesApp) FocusAndWait

func (f *FilesApp) FocusAndWait(finder *nodewith.Finder) uiauto.Action

FocusAndWait calls ui.FocusAndWait scoping the finder to the Files App.

func (*FilesApp) Gone

func (f *FilesApp) Gone(finder *nodewith.Finder) uiauto.Action

Gone calls ui.Gone scoping the finder to the Files App.

func (*FilesApp) Info

func (f *FilesApp) Info(ctx context.Context, finder *nodewith.Finder) (*uiauto.NodeInfo, error)

Info calls ui.Info scoping the finder to the Files App.

func (*FilesApp) IsNodeFound

func (f *FilesApp) IsNodeFound(ctx context.Context, finder *nodewith.Finder) (bool, error)

IsNodeFound calls ui.IsNodeFound scoping the finder to the Files App.

func (*FilesApp) LeftClick

func (f *FilesApp) LeftClick(finder *nodewith.Finder) uiauto.Action

LeftClick calls ui.LeftClick 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

func (f *FilesApp) OpenDir(dirName, expectedTitle string) uiauto.Action

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

func (f *FilesApp) OpenDownloads() uiauto.Action

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

func (f *FilesApp) OpenDrive() uiauto.Action

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

func (f *FilesApp) OpenFile(fileName string) uiauto.Action

OpenFile returns a function that executes double click on a file to open it with default app.

func (*FilesApp) OpenLinuxFiles

func (f *FilesApp) OpenLinuxFiles() uiauto.Action

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

func (f *FilesApp) OpenPath(expectedTitle, dirName string, path ...string) uiauto.Action

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

func (f *FilesApp) OpenPlayfiles() uiauto.Action

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

func (f *FilesApp) OpenQuickView(fileName string) uiauto.Action

OpenQuickView returns a function that opens the QuickView menu for a file.

func (*FilesApp) PerformActionAndRetryMaximizedOnFail

func (f *FilesApp) PerformActionAndRetryMaximizedOnFail(action uiauto.Action) uiauto.Action

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

func (f *FilesApp) RenameFile(kb *input.KeyboardEventWriter, oldName, newName string) uiauto.Action

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

func (f *FilesApp) RightClick(finder *nodewith.Finder) uiauto.Action

RightClick calls ui.RightClick scoping the finder to the Files App.

func (*FilesApp) RightClickFile

func (f *FilesApp) RightClickFile(fileName string) uiauto.Action

RightClickFile returns a function that executes right click on a file to open its context menu.

func (*FilesApp) Search

func (f *FilesApp) Search(kb *input.KeyboardEventWriter, searchTerms string) uiauto.Action

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

func (f *FilesApp) SelectFile(fileName string) uiauto.Action

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

func (f *FilesApp) ToggleAvailableOfflineForFile(fileName string) uiauto.Action

ToggleAvailableOfflineForFile selects the specified file and toggles the Available Offline switch.

func (*FilesApp) WaitForFile

func (f *FilesApp) WaitForFile(fileName string) uiauto.Action

WaitForFile returns a function that waits for a file to exist.

func (*FilesApp) WaitUntilExists

func (f *FilesApp) WaitUntilExists(finder *nodewith.Finder) uiauto.Action

WaitUntilExists calls ui.WaitUntilExists scoping the finder to the Files App.

func (*FilesApp) WaitUntilFileGone

func (f *FilesApp) WaitUntilFileGone(fileName string) uiauto.Action

WaitUntilFileGone returns a function that waits for a file to no longer exist.

func (*FilesApp) WaitUntilGone

func (f *FilesApp) WaitUntilGone(finder *nodewith.Finder) uiauto.Action

WaitUntilGone calls ui.WaitUntilGone scoping the finder to the Files App.

func (*FilesApp) WithInterval

func (f *FilesApp) WithInterval(interval time.Duration) *FilesApp

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.

func (*FilesApp) WithTimeout

func (f *FilesApp) WithTimeout(timeout time.Duration) *FilesApp

WithTimeout returns a new FilesApp with the specified timeout. This does not launch the Files App again.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL