videocuj

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

Documentation

Overview

Package videocuj contains the test code for VideoCUJ.

Index

Constants

View Source
const (
	// YoutubeWeb indicates to test against Youtube web.
	YoutubeWeb = "YoutubeWeb"
	// YoutubeApp indicates to test against Youtube app.
	YoutubeApp = "YoutubeApp"
)

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, resources TestResources, param TestParams) error

Run runs the VideoCUJ test.

Types

type TestParams

type TestParams struct {
	OutDir          string
	App             string
	TabletMode      bool
	Tier            cuj.Tier
	ExtendedDisplay bool
}

TestParams holds the cuj test parameters passed in from main test case.

type TestResources

type TestResources struct {
	Cr        *chrome.Chrome
	LFixtVal  lacrosfixt.FixtValue
	Tconn     *chrome.TestConn
	A         *arc.ARC
	Kb        *input.KeyboardEventWriter
	UIHandler cuj.UIActionHandler
}

TestResources holds the cuj test resources passed in from main test case.

type VideoApp

type VideoApp interface {
	// OpenAndPlayVideo opens a video.
	OpenAndPlayVideo(ctx context.Context) error
	// EnterFullscreen switches video to fullscreen.
	EnterFullscreen(ctx context.Context) error
	// PauseAndPlayVideo verifies video playback.
	PauseAndPlayVideo(ctx context.Context) error
	// Close closes the resources related to video.
	Close(ctx context.Context)
}

VideoApp declares video operation.

type VideoSrc

type VideoSrc struct {
	URL   string
	Title string
	// Quality is the string that test will look for in youtube
	// "Settings / Quality" menu to change video playback quality.
	Quality string
}

VideoSrc struct defines video src for testing.

type YtApp

type YtApp struct {
	// contains filtered or unexported fields
}

YtApp defines the members related to youtube app.

func NewYtApp

func NewYtApp(tconn *chrome.TestConn, kb *input.KeyboardEventWriter, a *arc.ARC, d *androidui.Device, video VideoSrc) *YtApp

NewYtApp creates an instance of YtApp.

func (*YtApp) Close

func (y *YtApp) Close(ctx context.Context)

Close closes the resources related to video.

func (*YtApp) EnterFullscreen

func (y *YtApp) EnterFullscreen(ctx context.Context) error

EnterFullscreen switches youtube video to fullscreen.

func (*YtApp) OpenAndPlayVideo

func (y *YtApp) OpenAndPlayVideo(ctx context.Context) (err error)

OpenAndPlayVideo opens a video on youtube app.

func (*YtApp) PauseAndPlayVideo

func (y *YtApp) PauseAndPlayVideo(ctx context.Context) error

PauseAndPlayVideo verifies video playback on youtube app.

type YtWeb

type YtWeb struct {
	// contains filtered or unexported fields
}

YtWeb defines the struct related to youtube web.

func NewYtWeb

func NewYtWeb(br *browser.Browser, tconn *chrome.TestConn, kb *input.KeyboardEventWriter, video VideoSrc,
	extendedDisplay bool, ui *uiauto.Context, uiHdl cuj.UIActionHandler) *YtWeb

NewYtWeb creates an instance of YtWeb.

func (*YtWeb) Close

func (y *YtWeb) Close(ctx context.Context)

Close closes the resources related to video.

func (*YtWeb) EnterFullscreen

func (y *YtWeb) EnterFullscreen(ctx context.Context) error

EnterFullscreen switches youtube video to fullscreen.

func (*YtWeb) IsPaused

func (y *YtWeb) IsPaused() uiauto.Action

IsPaused checks if the video is paused now.

func (*YtWeb) IsPlaying

func (y *YtWeb) IsPlaying() uiauto.Action

IsPlaying checks if the video is playing now.

func (*YtWeb) MaximizeWindow

func (y *YtWeb) MaximizeWindow(ctx context.Context) error

MaximizeWindow maximizes the youtube video.

func (*YtWeb) MinimizeWindow

func (y *YtWeb) MinimizeWindow(ctx context.Context) error

MinimizeWindow minimizes the youtube video.

func (*YtWeb) OpenAndPlayVideo

func (y *YtWeb) OpenAndPlayVideo(ctx context.Context) (err error)

OpenAndPlayVideo opens a youtube video on chrome.

func (*YtWeb) Pause

func (y *YtWeb) Pause() uiauto.Action

Pause pauses the video by clicking the video itself.

func (*YtWeb) PauseAndPlayVideo

func (y *YtWeb) PauseAndPlayVideo(ctx context.Context) error

PauseAndPlayVideo verifies video playback on youtube web.

func (*YtWeb) PerformFrameDropsTest

func (y *YtWeb) PerformFrameDropsTest(ctx context.Context) error

PerformFrameDropsTest checks for dropped frames percent and checks if it is below the threshold.

func (*YtWeb) Play

func (y *YtWeb) Play() uiauto.Action

Play plays the video by clicking the video itself. If the video has already started playing, the function does nothing.

func (*YtWeb) RestoreWindow

func (y *YtWeb) RestoreWindow(ctx context.Context) error

RestoreWindow restores the youtube video to normal state.

func (*YtWeb) SkipAd

func (y *YtWeb) SkipAd() uiauto.Action

SkipAd skips the ad.

func (*YtWeb) YtWebConn

func (y *YtWeb) YtWebConn() *chrome.Conn

YtWebConn returns connection of youtube web.

Jump to

Keyboard shortcuts

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