Documentation ¶
Overview ¶
Package launcher is used for controlling the launcher directly through the UI.
Index ¶
- Constants
- Variables
- func AddItemsToFolder(ctx context.Context, tconn *chrome.TestConn, folder *nodewith.Finder, ...) error
- func AppItemViewFinder(appName string) *nodewith.Finder
- func AppSearchFinder(appName, searchContainer string) *nodewith.Finder
- func CloseBubbleLauncher(tconn *chrome.TestConn) uiauto.Action
- func CloseFolderView(ctx context.Context, tconn *chrome.TestConn) error
- func CreateAppSearchFinder(ctx context.Context, tconn *chrome.TestConn, appName string) *nodewith.Finder
- func CreateFolder(ctx context.Context, tconn *chrome.TestConn, folderOpensOnCreation bool) error
- func DragIconAfterIcon(ctx context.Context, tconn *chrome.TestConn, srcIndex, destIndex int, ...) uiauto.Action
- func DragIconAtIndexToNextPage(tconn *chrome.TestConn, itemIndex int) uiauto.Action
- func DragIconToIcon(tconn *chrome.TestConn, srcIndex, destIndex int) uiauto.Action
- func DragIconToNeighbourPage(tconn *chrome.TestConn, item *nodewith.Finder, next bool) uiauto.Action
- func DragIconToNextPage(tconn *chrome.TestConn, item *nodewith.Finder) uiauto.Action
- func DragItemAfterItem(tconn *chrome.TestConn, src, dest *nodewith.Finder) uiauto.Action
- func DragItemInBubbleLauncherWithScrolling(ctx context.Context, tconn *chrome.TestConn, ui *uiauto.Context, ...) error
- func DragItemToItem(tconn *chrome.TestConn, src, dest *nodewith.Finder) uiauto.Action
- func FetchItemIndicesByName(ctx context.Context, ui *uiauto.Context, appNames []string, ...) ([]int, error)
- func FirstNonRecentAppItem(ctx context.Context, tconn *chrome.TestConn) (int, error)
- func GetFolderSize(ctx context.Context, tconn *chrome.TestConn, folder *nodewith.Finder) (int, error)
- func GetUndoButtonNameForSortType(sortType SortType) string
- func HideTabletModeLauncher(tconn *chrome.TestConn) uiauto.Action
- func IndexOfFirstVisibleItem(ctx context.Context, tconn *chrome.TestConn, minIndex int) (int, error)
- func IsFolderItem(ctx context.Context, tconn *chrome.TestConn, item *nodewith.Finder) (bool, error)
- func IsItemOnCurrentPage(ctx context.Context, tconn *chrome.TestConn, item *nodewith.Finder) (bool, error)
- func LaunchAndWaitForAppOpen(tconn *chrome.TestConn, app apps.App) uiauto.Action
- func LaunchApp(tconn *chrome.TestConn, appName string) uiauto.Action
- func Open(tconn *chrome.TestConn) uiauto.Action
- func OpenBubbleLauncher(tconn *chrome.TestConn) uiauto.Action
- func OpenExpandedView(tconn *chrome.TestConn) uiauto.Action
- func PinAppToShelf(tconn *chrome.TestConn, app apps.App, container *nodewith.Finder) uiauto.Action
- func ReadImageBytesFromFilePath(filePath string) ([]byte, error)
- func RemoveIconFromFolder(tconn *chrome.TestConn, folderFinder *nodewith.Finder) uiauto.Action
- func RenameFolder(tconn *chrome.TestConn, kb *input.KeyboardEventWriter, from *nodewith.Finder, ...) uiauto.Action
- func ScrollBubbleLauncherDuringItemDragUntilItemVisible(ctx context.Context, tconn *chrome.TestConn, ui *uiauto.Context, ...) error
- func Search(tconn *chrome.TestConn, kb *input.KeyboardEventWriter, query string) uiauto.Action
- func SearchAndLaunch(tconn *chrome.TestConn, kb *input.KeyboardEventWriter, appName string) uiauto.Action
- func SearchAndLaunchWithQuery(tconn *chrome.TestConn, kb *input.KeyboardEventWriter, query, appName string) uiauto.Action
- func SearchAndRightClick(tconn *chrome.TestConn, kb *input.KeyboardEventWriter, query, appName string) uiauto.Action
- func SearchAndWaitForAppOpen(tconn *chrome.TestConn, kb *input.KeyboardEventWriter, app apps.App) uiauto.Action
- func TriggerAppListSortAndWaitForUndoButtonExist(ctx context.Context, ui *uiauto.Context, sortType SortType, ...) error
- func UnpinAppFromShelf(tconn *chrome.TestConn, app apps.App, container *nodewith.Finder) uiauto.Action
- func VerifyFakeAppsOrdered(ctx context.Context, ui *uiauto.Context, appsGrid *nodewith.Finder, ...) error
- func WaitForStableNumberOfApps(ctx context.Context, tconn *chrome.TestConn) error
- type FakeAppInfoForSort
- type SortTestType
- type SortType
- type TestCase
Constants ¶
const BubbleAppsGridViewClass = "ScrollableAppsGridView"
BubbleAppsGridViewClass defines the class name of the bubble apps grid.
const ExpandedItemsClass = "AppListItemView"
ExpandedItemsClass define the class name of the expanded launcher view which is used as search parameters in ui.
const PagedAppsGridViewClass = "AppsGridView"
PagedAppsGridViewClass defines the class name of the paged apps grid.
Variables ¶
var SearchResultListItemFinder = nodewith.ClassName("ui/app_list/SearchResultView")
SearchResultListItemFinder is the finder of the list items in launcher search result.
var UnnamedFolderFinder = nodewith.Name("Folder Unnamed").ClassName(ExpandedItemsClass)
UnnamedFolderFinder is the finder of a newly created folder with the default name.
Functions ¶
func AddItemsToFolder ¶
func AddItemsToFolder(ctx context.Context, tconn *chrome.TestConn, folder *nodewith.Finder, numItemsToAdd int, paginatedAppList bool) error
AddItemsToFolder adds non-folder items to the specified folder. Assumes that the folder is on the current page. If the next available item to add is not on the current page, then the folder will be moved to the next page if app list is paginated. paginatedAppList indicates whether the app list supports pagination. If the folder is full, then the attempt will still be made to add the item to the folder, and no error will be returned for that case.
func AppItemViewFinder ¶
AppItemViewFinder returns a Finder to find the specified app in an open launcher's item view.
func AppSearchFinder ¶
AppSearchFinder returns a Finder to find the specified app in an open launcher's search results.
func CloseBubbleLauncher ¶
CloseBubbleLauncher closes launcher by mouse clicking at the home button.
func CloseFolderView ¶
CloseFolderView closes app list folder view - expects that the app list UI is currently showing a folder content.
func CreateAppSearchFinder ¶
func CreateAppSearchFinder(ctx context.Context, tconn *chrome.TestConn, appName string) *nodewith.Finder
CreateAppSearchFinder creates a finder for an app search result in the current launcher search UI. It expects the launcher search page to be open - search containers within which apps are searched depend on whether productivity launcher is enabled, which is inferred from the current app list search UI state.
func CreateFolder ¶
CreateFolder is a helper function to create a folder by dragging the first non-folder item on top of the second non-folder item. folderOpensOnCreation indicates whether the folder view expected to get opened after creation (with no extra user input).
func DragIconAfterIcon ¶
func DragIconAfterIcon(ctx context.Context, tconn *chrome.TestConn, srcIndex, destIndex int, appsGrid *nodewith.Finder) uiauto.Action
DragIconAfterIcon moves an app list item at srcIndex to destIndex by drag-and-drop. srcIndex and destIndex are app list item view indices in the provided apps grid.
func DragIconAtIndexToNextPage ¶
DragIconAtIndexToNextPage drags an icon which has itemIndex in the app list to the next page of the app list.
func DragIconToIcon ¶
DragIconToIcon drags from one icon to another icon.
func DragIconToNeighbourPage ¶
func DragIconToNeighbourPage(tconn *chrome.TestConn, item *nodewith.Finder, next bool) uiauto.Action
DragIconToNeighbourPage drags an icon to the next, or previous page of the app list. next indicates whether the icon should be dragged to the next page.
func DragIconToNextPage ¶
DragIconToNextPage drags an icon to the next page of the app list.
func DragItemAfterItem ¶
DragItemAfterItem drags an app list item returned by src node finder to a location after the app list item node returned by dest node finder.
func DragItemInBubbleLauncherWithScrolling ¶
func DragItemInBubbleLauncherWithScrolling(ctx context.Context, tconn *chrome.TestConn, ui *uiauto.Context, dragItem, targetItem *nodewith.Finder, up bool) error
DragItemInBubbleLauncherWithScrolling performs app list item drag in bubble launcher where the launcher is expected to scroll during the drag. dragItem is the item that will be dragged, and is expected to be visible when the method gets called. targetItem is an item used to determine the drag item drop spot - the drag item will be dropped just right of the targetItem. up describes the direction the app list should be scrolled for the targetItem to become visible NOTE: targetItem should be an item that's visible when the app list is fully scrolled.
func DragItemToItem ¶
DragItemToItem drags from the src item to the dest item. We cannot use simple mouse.Drag because the default UI behavior is now that the icon location changes after you start a drag. This function will delay the calculation of the destination point until after mouse press.
func FetchItemIndicesByName ¶
func FetchItemIndicesByName(ctx context.Context, ui *uiauto.Context, appNames []string, appsContainer *nodewith.Finder) ([]int, error)
FetchItemIndicesByName returns the view indices of the items specified by app names in the given apps container.
func FirstNonRecentAppItem ¶
FirstNonRecentAppItem returns the first app list item view shown in the current app list UI that is not in the recent apps container. If productivity launcher is disabled, in which case recent apps container does not exist, return 0 - the index of the first app list item view. The return value will be -1 on error.
func GetFolderSize ¶
func GetFolderSize(ctx context.Context, tconn *chrome.TestConn, folder *nodewith.Finder) (int, error)
GetFolderSize opens the given folder, gets the number of apps inside, and then closes the folder. This assumes that there is no folder open and may not work if a folder is already opened.
func GetUndoButtonNameForSortType ¶
GetUndoButtonNameForSortType returns the undo button's name based on the sorting method.
func HideTabletModeLauncher ¶
HideTabletModeLauncher returns a function that hides the launcher in tablet mode by launching the Chrome browser.
func IndexOfFirstVisibleItem ¶
func IndexOfFirstVisibleItem(ctx context.Context, tconn *chrome.TestConn, minIndex int) (int, error)
IndexOfFirstVisibleItem returns the index of the first item which is visible in the current app list UI, and whose index among app list item views is at least minIndex.
func IsFolderItem ¶
IsFolderItem returns whether the item is a folder. Assumes that there is no folder open.
func IsItemOnCurrentPage ¶
func IsItemOnCurrentPage(ctx context.Context, tconn *chrome.TestConn, item *nodewith.Finder) (bool, error)
IsItemOnCurrentPage will return whether the item is shown on the current launcher page. Assumes that there is no folder open, and may not work if a folder is opened.
func LaunchAndWaitForAppOpen ¶
LaunchAndWaitForAppOpen return a function that launches an app from the expanded launcher and waits for it to be open.
func OpenBubbleLauncher ¶
OpenBubbleLauncher opens launcher using search accelerator and waits until the bubble launcher UI becomes visible.
func OpenExpandedView ¶
OpenExpandedView return a function that opens the Launcher to the Apps list page.
func PinAppToShelf ¶
PinAppToShelf return a function that pins an app from the expanded launcher to shelf.
func ReadImageBytesFromFilePath ¶
ReadImageBytesFromFilePath reads a PNG image from the specified file path.
func RemoveIconFromFolder ¶
RemoveIconFromFolder opens a folder and drags an icon out of the folder.
func RenameFolder ¶
func RenameFolder(tconn *chrome.TestConn, kb *input.KeyboardEventWriter, from *nodewith.Finder, to string) uiauto.Action
RenameFolder return a function that renames a folder to a new name. from is the node finder for the folder to be renamed - RenameFolder will fail if the target node is not a folder item.
func ScrollBubbleLauncherDuringItemDragUntilItemVisible ¶
func ScrollBubbleLauncherDuringItemDragUntilItemVisible(ctx context.Context, tconn *chrome.TestConn, ui *uiauto.Context, targetItem *nodewith.Finder, up bool) error
ScrollBubbleLauncherDuringItemDragUntilItemVisible moves the pointer to top or the bottom of the app list bubble view, which is expected to scroll the view. It keeps the pointer in scrolling position until the item returned by targetItem becomes visible. up indicates whether the bubble app list view apps page should be scrolled up, or down. NOTE: This is intended to be used during app list item drag, otherwise just hovering the pointer over bubble bounds will not scroll the app list. This may be flaky if targetItem is not visible in fully scrolled state - in that case polling interval may miss the period when the view is visible.
func Search ¶
Search return a function that executes a search query. Launcher should be open already.
func SearchAndLaunch ¶
func SearchAndLaunch(tconn *chrome.TestConn, kb *input.KeyboardEventWriter, appName string) uiauto.Action
SearchAndLaunch return a function that searches an app in the launcher and executes it.
func SearchAndLaunchWithQuery ¶
func SearchAndLaunchWithQuery(tconn *chrome.TestConn, kb *input.KeyboardEventWriter, query, appName string) uiauto.Action
SearchAndLaunchWithQuery return a function that searches a query in the launcher and executes an app from the list.
func SearchAndRightClick ¶
func SearchAndRightClick(tconn *chrome.TestConn, kb *input.KeyboardEventWriter, query, appName string) uiauto.Action
SearchAndRightClick returns a function that searches a query in the launcher and right click the app from the list. It right clicks the app until a menu item is displayed.
func SearchAndWaitForAppOpen ¶
func SearchAndWaitForAppOpen(tconn *chrome.TestConn, kb *input.KeyboardEventWriter, app apps.App) uiauto.Action
SearchAndWaitForAppOpen return a function that searches for an app, launches it, and waits for it to be open.
func TriggerAppListSortAndWaitForUndoButtonExist ¶
func TriggerAppListSortAndWaitForUndoButtonExist(ctx context.Context, ui *uiauto.Context, sortType SortType, item *nodewith.Finder) error
TriggerAppListSortAndWaitForUndoButtonExist sorts app list items through the item context menu with the specified sorting method. Waits until the undo button exists.
func UnpinAppFromShelf ¶
func UnpinAppFromShelf(tconn *chrome.TestConn, app apps.App, container *nodewith.Finder) uiauto.Action
UnpinAppFromShelf return a function that unpins an app from the shelf using a context menu in the expanded launcher UI.
func VerifyFakeAppsOrdered ¶
func VerifyFakeAppsOrdered(ctx context.Context, ui *uiauto.Context, appsGrid *nodewith.Finder, namesInOrder []string, wait bool) error
VerifyFakeAppsOrdered checks that the visual order of the app list items specified by app names is consistent with namesInOrder. appsGrid specifies the apps grid on which item order is verified. If wait is true, wait until the specified app list items show before getting their view indices.
func WaitForStableNumberOfApps ¶
WaitForStableNumberOfApps waits for the number of apps shown in the app list to stabilize. As a special case, waits for all system web apps to finish installing, as web app installation may add an item to the app list.
Types ¶
type FakeAppInfoForSort ¶
type FakeAppInfoForSort struct { // AlphabeticalNames refers to an array of strings sorted in alphabetical order. These strings are used as app names when installing fake apps. AlphabeticalNames []string // ColorOrderNames refers to the app names whose corresponding icons follow the color order. ColorOrderNames []string // IconFileNames indicates the icon files used by fake apps. NOTE: IconFileNames is associated with ColorOrderNames, i.e. the app that uses // the i-th element of ColorOrderNames as the app name utilizes the i-th element of IconFileNames as the icon file. IconFileNames []string // AlphabeticalNamesAfterAppInstall defines the app names in alphabetical order after the extra app installation. The tests that verify app installation // with app list sorted use it. AlphabeticalNamesAfterAppInstall []string // ColorOrderNamesAfterAppInstall defines the app names in color order after the extra app installation. The tests that verify app installation // with app list sorted use it. ColorOrderNamesAfterAppInstall []string }
FakeAppInfoForSort defines the fake apps' info used in tests that verify app list sort.
type SortTestType ¶
type SortTestType struct { TabletMode bool // Whether the test runs in tablet mode SortMethod SortType // Indicates the sort method used in tests OrderedAppNames []string // Specifies the fake app names arranged in the expected sort order OrderedAppNamesAfterInstall []string // Indicates the fake app names in order after fake app installation. Used by the tests that verify app installation after sort }
SortTestType specifies the test parameters for sort-related tests.
type TestCase ¶
type TestCase struct { ProductivityLauncher bool // Whether productivity launcher feature should be enabled TabletMode bool // Whether the test runs in tablet mode }
TestCase describes modes in which the launcher UI can be shown, and by which launcher test should generally be parameterized.