testutil

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: 23 Imported by: 0

Documentation

Overview

Package testutil contains functionality shared by tast tests for android apps on Chromebooks.

Index

Constants

View Source
const (
	AndroidButtonClassName = "android.widget.Button"

	DefaultUITimeout = 20 * time.Second
	ShortUITimeout   = 30 * time.Second
	LongUITimeout    = 90 * time.Second
)

Variables used by other tast tests

Variables

View Source
var ClamshellCommonTests = []TestCase{

	{Name: "Clamshell: Touchscreen Scroll", Fn: TouchScreenScroll},

	{Name: "Clamshell: Fullscreen app", Fn: ClamshellFullscreenApp},
	{Name: "Clamshell: Minimise and Restore", Fn: MinimizeRestoreApp},

	{Name: "Clamshell: Reopen app", Fn: ReOpenWindow},
	{Name: "Clamshell: Resize Lock", Fn: ResizeLock},
}

ClamshellCommonTests is a list of all tests common to all apps in clamshell mode.

View Source
var ClamshellOnlyModels = []string{
	"sarien",
	"elemi",
	"berknip",
	"dratini",

	"careena",
	"kasumi",
	"treeya",
	"grunt",
	"barla",
	"aleena",
	"liara",
	"nuwani",

	"bluebird",
	"apel",
	"blooglet",
	"blorb",
	"bobba",
	"casta",
	"dorp",
	"droid",
	"fleex",
	"foob",
	"garfour",
	"garg",
	"laser14",
	"lick",
	"mimrock",
	"nospike",
	"orbatrix",
	"phaser",
	"sparky",
}

ClamshellOnlyModels is a list of clamshell only models to be skipped from tablet mode runs.

View Source
var ClamshellSmokeTests = []TestCase{
	{Name: "Clamshell: Touchscreen Scroll", Fn: TouchScreenScroll},
	{Name: "Clamshell: Physical Keyboard", Fn: TouchAndTextInputs},
	{Name: "Clamshell: Mouse click", Fn: MouseClick},
	{Name: "Clamshell: Resize window", Fn: ClamshellResizeWindow},
}

ClamshellSmokeTests is a list of clamshell tests common to apps in appcompat_smoke suite.

View Source
var TabletOnlyModels = []string{
	"dru",
	"krane",
}

TabletOnlyModels is a list of tablet only models to be skipped from clamshell mode runs.

View Source
var TouchviewCommonTests = []TestCase{

	{Name: "Touchview: Rotate", Fn: TouchviewRotate},

	{Name: "Touchview: Minimise and Restore", Fn: MinimizeRestoreApp},
	{Name: "Touchview: Reopen app", Fn: ReOpenWindow},
}

TouchviewCommonTests is a list of all tests common to all apps in touchview mode.

View Source
var TouchviewSmokeTests = []TestCase{
	{Name: "Touchview: Minimise and Restore", Fn: MinimizeRestoreApp},
	{Name: "Touchview: Reopen app", Fn: ReOpenWindow},
}

TouchviewSmokeTests is a list of touchview tests common to apps in appcompat_smoke suite.

Functions

func ClamshellFullscreenApp

func ClamshellFullscreenApp(ctx context.Context, s *testing.State, tconn *chrome.TestConn, a *arc.ARC, d *ui.Device, appPkgName, appActivity string)

ClamshellFullscreenApp Test launches the app in full screen window and verifies launch successfully without crash or ANR on ARC-P devices

func ClamshellResizeWindow

func ClamshellResizeWindow(ctx context.Context, s *testing.State, tconn *chrome.TestConn, a *arc.ARC, d *ui.Device, appPkgName, appActivity string)

ClamshellResizeWindow Test "resize and restore back to original state of the app" and verifies app launch successfully without crash or ANR on ARC-P devices.

func CurrentAppPackage

func CurrentAppPackage(ctx context.Context, d *ui.Device, s *testing.State) (string, error)

CurrentAppPackage func to get info on current package name.

func DetectAndHandleCloseCrashOrAppNotResponding

func DetectAndHandleCloseCrashOrAppNotResponding(ctx context.Context, s *testing.State, d *ui.Device)

DetectAndHandleCloseCrashOrAppNotResponding func to handle Crash or ANR.

func EscKey

func EscKey(ctx context.Context, s *testing.State, tconn *chrome.TestConn, a *arc.ARC, d *ui.Device, appPkgName, appActivity string)

EscKey Test verifies if app doesn't quit on pressing esc key and without crash or ANR.

func GetAppVersion

func GetAppVersion(ctx context.Context, s *testing.State, a *arc.ARC, d *ui.Device, appPkgName string) (string, error)

GetAppVersion provides info on app version.

func HandleDialogBoxes

func HandleDialogBoxes(ctx context.Context, s *testing.State, d *ui.Device, appPkgName string)

HandleDialogBoxes func will handle the dialog box

func KeyboardNavigations

func KeyboardNavigations(ctx context.Context, s *testing.State, tconn *chrome.TestConn, a *arc.ARC, d *ui.Device, appPkgName, appActivity string)

KeyboardNavigations func verifies app perform keyboard navigations successfully without crash or ANR.

func Largescreenlayout

func Largescreenlayout(ctx context.Context, s *testing.State, tconn *chrome.TestConn, a *arc.ARC, d *ui.Device, appPkgName, appActivity string)

Largescreenlayout Test verifies if app utilizes large screen after maximizing the app and without crash or ANR.

func MinimizeRestoreApp

func MinimizeRestoreApp(ctx context.Context, s *testing.State, tconn *chrome.TestConn, a *arc.ARC, d *ui.Device, appPkgName, appActivity string)

MinimizeRestoreApp Test "minimize and relaunch the app" and verifies app relaunch successfully without crash or ANR.

func MouseClick

func MouseClick(ctx context.Context, s *testing.State, tconn *chrome.TestConn, a *arc.ARC, d *ui.Device, appPkgName, appActivity string)

MouseClick func verifies mouse click work successfully in the app without crash or ANR.

func MouseScrollAction

func MouseScrollAction(ctx context.Context, s *testing.State, tconn *chrome.TestConn, a *arc.ARC, d *ui.Device, appPkgName, appActivity string)

MouseScrollAction func verifies app perform mouse scroll actions successfully without crash or ANR.

func OrientationSize

func OrientationSize(ctx context.Context, s *testing.State, tconn *chrome.TestConn, a *arc.ARC, d *ui.Device, appPkgName, appActivity string)

OrientationSize Test verifies orientation size of the app after launch.

func ReOpenWindow

func ReOpenWindow(ctx context.Context, s *testing.State, tconn *chrome.TestConn, a *arc.ARC, d *ui.Device, appPkgName, appActivity string)

ReOpenWindow Test "close and relaunch the app" and verifies app launch successfully without crash or ANR.

func ResizeLock

func ResizeLock(ctx context.Context, s *testing.State, tconn *chrome.TestConn, a *arc.ARC, d *ui.Device, appPkgName, appActivity string)

ResizeLock Test verifies if app has resize lock feature available or not and verifies if app launch successfully without crash or ANR.

func RunTestCases

func RunTestCases(ctx context.Context, s *testing.State, appPkgName, appActivity string, testCases TestParams)

RunTestCases setups the device and runs all app compat test cases.

func SplitScreen

func SplitScreen(ctx context.Context, s *testing.State, tconn *chrome.TestConn, a *arc.ARC, d *ui.Device, appPkgName, appActivity string)

SplitScreen Test verifies if app supports split screen and check if app performs split screen without crash or ANR.

func StylusClick

func StylusClick(ctx context.Context, s *testing.State, tconn *chrome.TestConn, a *arc.ARC, d *ui.Device, appPkgName, appActivity string)

StylusClick func verifies if stylus click works properly in the app without crash or ANR.

func TouchAndPlayVideo

func TouchAndPlayVideo(ctx context.Context, s *testing.State, tconn *chrome.TestConn, a *arc.ARC, d *ui.Device, appPkgName, appActivity string)

TouchAndPlayVideo func verifies app perform touch and play video successfully without crash or ANR.

func TouchAndTextInputs

func TouchAndTextInputs(ctx context.Context, s *testing.State, tconn *chrome.TestConn, a *arc.ARC, d *ui.Device, appPkgName, appActivity string)

TouchAndTextInputs func verify touch and text inputs in the app are working properly without crash or ANR.

func TouchScreenScroll

func TouchScreenScroll(ctx context.Context, s *testing.State, tconn *chrome.TestConn, a *arc.ARC, d *ui.Device, appPkgName, appActivity string)

TouchScreenScroll Test verifies app perform scrollForward successfully without crash or ANR.

func TouchviewRotate

func TouchviewRotate(ctx context.Context, s *testing.State, tconn *chrome.TestConn, a *arc.ARC, d *ui.Device, appPkgName, appActivity string)

TouchviewRotate Test verifies if app performs rotation successfully without crash or ANR.

Types

type TestCase

type TestCase struct {
	Name    string
	Fn      TestFunc
	Timeout time.Duration
}

TestCase represents the name of test, the function to call.

type TestFunc

type TestFunc func(ctx context.Context, s *testing.State, tconn *chrome.TestConn, a *arc.ARC, d *ui.Device, appPkgName, appActivity string)

TestFunc represents the "test" function.

type TestParams

type TestParams struct {
	LaunchTests      []TestCase
	CommonTests      []TestCase
	AppSpecificTests []TestCase
}

TestParams represents the collection of tests to run in tablet mode or clamshell mode.

Jump to

Keyboard shortcuts

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