interfaces

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UnitTestingMockDriver = new(MockDriver)

UnitTestingMockDriver is the driver returned when unit testing

Functions

This section is empty.

Types

type AgoutiDriver

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

AgoutiDriver wraps an agouti driver as an adapter

func (*AgoutiDriver) NewPage

func (d *AgoutiDriver) NewPage(options ...agouti.Option) (PageService, error)

NewPage opens a new browser session/page

func (*AgoutiDriver) Start

func (d *AgoutiDriver) Start() error

Start starts the driver

func (*AgoutiDriver) Stop

func (d *AgoutiDriver) Stop() error

Stop stops the driver

func (*AgoutiDriver) URL

func (d *AgoutiDriver) URL() string

URL returns the URL of the driver endpoint

type AgoutiPage

type AgoutiPage struct {
	SelectorService
	// contains filtered or unexported fields
}

AgoutiPage wraps an agouti.Page as an adapter

func (*AgoutiPage) CancelPopup

func (m *AgoutiPage) CancelPopup() error

CancelPopup is a mock method

func (*AgoutiPage) ConfirmPopup

func (m *AgoutiPage) ConfirmPopup() error

ConfirmPopup is a mock method

func (*AgoutiPage) EnterPopupText

func (m *AgoutiPage) EnterPopupText(text string) error

EnterPopupText is a mock method

func (*AgoutiPage) Navigate

func (m *AgoutiPage) Navigate(url string) error

Navigate is a mock method

func (*AgoutiPage) PopupText

func (m *AgoutiPage) PopupText() (string, error)

PopupText is a mock method

func (*AgoutiPage) Refresh

func (m *AgoutiPage) Refresh() error

Refresh is a mock method

func (*AgoutiPage) RunScript

func (m *AgoutiPage) RunScript(body string, arguments map[string]interface{}, result interface{}) error

RunScript is a mock method

func (*AgoutiPage) Screenshot

func (m *AgoutiPage) Screenshot(filename string) error

Screenshot is a mock method

func (*AgoutiPage) Session

func (m *AgoutiPage) Session() SessionService

Session is a mock method

func (*AgoutiPage) Size

func (m *AgoutiPage) Size(width, height int) error

Size is a mock method

func (*AgoutiPage) SwitchToRootFrame

func (m *AgoutiPage) SwitchToRootFrame() error

SwitchToRootFrame is a mock method

func (*AgoutiPage) Title added in v1.9.0

func (m *AgoutiPage) Title() (string, error)

Title is a mock method

func (*AgoutiPage) URL

func (m *AgoutiPage) URL() (string, error)

URL is a mock method

func (*AgoutiPage) WindowCount

func (m *AgoutiPage) WindowCount() (int, error)

WindowCount is a mock method

type AgoutiSelector

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

AgoutiSelector wraps an *agouti.Page to adapt its selectable methods

func (*AgoutiSelector) All

func (m *AgoutiSelector) All(selector string) *agouti.MultiSelection

All is a mock method

func (*AgoutiSelector) AllByButton

func (m *AgoutiSelector) AllByButton(text string) *agouti.MultiSelection

AllByButton is a mock method

func (*AgoutiSelector) AllByClass

func (m *AgoutiSelector) AllByClass(text string) *agouti.MultiSelection

AllByClass is a mock method

func (*AgoutiSelector) AllByID

func (m *AgoutiSelector) AllByID(text string) *agouti.MultiSelection

AllByID is a mock method

func (*AgoutiSelector) AllByLabel

func (m *AgoutiSelector) AllByLabel(text string) *agouti.MultiSelection

AllByLabel is a mock method

func (m *AgoutiSelector) AllByLink(text string) *agouti.MultiSelection

AllByLink is a mock method

func (*AgoutiSelector) AllByName

func (m *AgoutiSelector) AllByName(name string) *agouti.MultiSelection

AllByName is a mock method

func (*AgoutiSelector) AllByXPath

func (m *AgoutiSelector) AllByXPath(selector string) *agouti.MultiSelection

AllByXPath is a mock method

func (*AgoutiSelector) First

func (m *AgoutiSelector) First(selector string) *agouti.Selection

First is a mock method

func (m *AgoutiSelector) FirstByLink(text string) *agouti.Selection

FirstByLink is a mock method

type DriverService

type DriverService interface {
	URL() string
	Start() error
	Stop() error
	NewPage(options ...agouti.Option) (PageService, error)
}

DriverService allows mocking of agouti.WebDriver

func NewDriverService

func NewDriverService(agoutiDriver *agouti.WebDriver) DriverService

NewDriverService either wraps an agouti.WebDriver (if one is provided) or a MockDriver (if nil is provided) in a DriverService.

type MockDriver

type MockDriver struct {
	mock.Mock
}

MockDriver serves as a mock for unit testing

func (*MockDriver) NewPage

func (d *MockDriver) NewPage(options ...agouti.Option) (PageService, error)

NewPage is a mock method for unit testing

func (*MockDriver) Start

func (d *MockDriver) Start() error

Start is a mock method for unit testing

func (*MockDriver) Stop

func (d *MockDriver) Stop() error

Stop is a mock method for unit testing

func (*MockDriver) URL

func (d *MockDriver) URL() string

URL is a mock method for unit testing

type MockPage

type MockPage struct {
	MockSelectable
	mock.Mock
}

MockPage is a mock of agouti.Page

func (*MockPage) CancelPopup

func (m *MockPage) CancelPopup() error

CancelPopup is a mock method

func (*MockPage) ConfirmPopup

func (m *MockPage) ConfirmPopup() error

ConfirmPopup is a mock method

func (*MockPage) EnterPopupText

func (m *MockPage) EnterPopupText(text string) error

EnterPopupText is a mock method

func (*MockPage) Navigate

func (m *MockPage) Navigate(url string) error

Navigate is a mock method

func (*MockPage) PopupText

func (m *MockPage) PopupText() (string, error)

PopupText is a mock method

func (*MockPage) Refresh

func (m *MockPage) Refresh() error

Refresh is a mock method

func (*MockPage) RunScript

func (m *MockPage) RunScript(body string, arguments map[string]interface{}, result interface{}) error

RunScript is a mock method

func (*MockPage) Screenshot

func (m *MockPage) Screenshot(filename string) error

Screenshot is a mock method

func (*MockPage) Session

func (m *MockPage) Session() SessionService

Session is a mock method

func (*MockPage) Size

func (m *MockPage) Size(width, height int) error

Size is a mock method

func (*MockPage) SwitchToRootFrame

func (m *MockPage) SwitchToRootFrame() error

SwitchToRootFrame is a mock method

func (*MockPage) Title added in v1.9.0

func (m *MockPage) Title() (string, error)

Title is a mock method

func (*MockPage) URL

func (m *MockPage) URL() (string, error)

URL is a mock method

func (*MockPage) WindowCount

func (m *MockPage) WindowCount() (int, error)

WindowCount is a mock method

type MockSelectable

type MockSelectable struct {
	mock.Mock
}

MockSelectable is a mock of agouti.selectable

func (*MockSelectable) All

func (m *MockSelectable) All(selector string) *agouti.MultiSelection

All is a mock method

func (*MockSelectable) AllByButton

func (m *MockSelectable) AllByButton(text string) *agouti.MultiSelection

AllByButton is a mock method

func (*MockSelectable) AllByClass

func (m *MockSelectable) AllByClass(text string) *agouti.MultiSelection

AllByClass is a mock method

func (*MockSelectable) AllByID

func (m *MockSelectable) AllByID(text string) *agouti.MultiSelection

AllByID is a mock method

func (*MockSelectable) AllByLabel

func (m *MockSelectable) AllByLabel(text string) *agouti.MultiSelection

AllByLabel is a mock method

func (m *MockSelectable) AllByLink(text string) *agouti.MultiSelection

AllByLink is a mock method

func (*MockSelectable) AllByName

func (m *MockSelectable) AllByName(name string) *agouti.MultiSelection

AllByName is a mock method

func (*MockSelectable) AllByXPath

func (m *MockSelectable) AllByXPath(selector string) *agouti.MultiSelection

AllByXPath is a mock method

func (*MockSelectable) First

func (m *MockSelectable) First(selector string) *agouti.Selection

First is a mock method

func (m *MockSelectable) FirstByLink(text string) *agouti.Selection

FirstByLink is a mock method

type MockSession

type MockSession struct {
	mock.Mock
}

MockSession serves as a mock for unit testing

func (*MockSession) GetActiveElement

func (m *MockSession) GetActiveElement() (*api.Element, error)

GetActiveElement is a mock method

func (*MockSession) GetWindows

func (m *MockSession) GetWindows() ([]*api.Window, error)

GetWindows is a mock method

func (*MockSession) SetWindow

func (m *MockSession) SetWindow(window *api.Window) error

SetWindow is a mock method

type PageService

type PageService interface {
	SelectorService
	Size(width, height int) error
	Screenshot(filename string) error
	WindowCount() (int, error)
	Session() SessionService
	Refresh() error
	RunScript(body string, arguments map[string]interface{}, result interface{}) error
	Navigate(url string) error
	SwitchToRootFrame() error
	ConfirmPopup() error
	CancelPopup() error
	EnterPopupText(text string) error
	PopupText() (string, error)
	Title() (string, error)
	URL() (string, error)
}

PageService allows mocking of agouti.Page

func NewPageServiceFromAgoutiPage

func NewPageServiceFromAgoutiPage(page *agouti.Page) PageService

NewPageServiceFromAgoutiPage either wraps an agouti.Page (if one is provided) or a MockPage (if nil is provided) in a PageService

type SelectorService

type SelectorService interface {
	All(selector string) *agouti.MultiSelection
	AllByXPath(selector string) *agouti.MultiSelection
	AllByLabel(text string) *agouti.MultiSelection
	AllByButton(text string) *agouti.MultiSelection
	AllByName(name string) *agouti.MultiSelection
	AllByLink(text string) *agouti.MultiSelection
	AllByID(text string) *agouti.MultiSelection
	AllByClass(text string) *agouti.MultiSelection
	FirstByLink(text string) *agouti.Selection
	First(selector string) *agouti.Selection
}

SelectorService allows mocking agouti selectables

func NewSelectorServiceFromAgoutiPage

func NewSelectorServiceFromAgoutiPage(page *agouti.Page) SelectorService

NewSelectorServiceFromAgoutiPage either wraps an agouti.Page (if one is provided) or a MockSelector (if nil is provided) in a SelectorService

type SessionService

type SessionService interface {
	GetActiveElement() (*api.Element, error)
	GetWindows() ([]*api.Window, error)
	SetWindow(window *api.Window) error
}

SessionService allows mocking agouti.api.Session

Jump to

Keyboard shortcuts

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