environment

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package environment provides an interface for defining how browser environments are managed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	*metadata.Metadata
	diagnostics.Diagnostics
	// contains filtered or unexported fields
}

Base is a partial implementation of Env useful as the base struct for implementations of Env.

func NewBase

func NewBase(name string, m *metadata.Metadata, d diagnostics.Diagnostics) (*Base, error)

NewBase creates a new Base environment with the given component name.

func (*Base) Healthy

func (b *Base) Healthy(context.Context) error

Healthy returns nil (i.e., healthy) iff the environment has been started and has not yet been stopped.

func (*Base) Name

func (b *Base) Name() string

Name returns the name of this environment to be used in error messages.

func (*Base) SetUp

func (b *Base) SetUp(ctx context.Context) error

SetUp starts the Environment.

func (*Base) StartSession

func (b *Base) StartSession(ctx context.Context, id int, caps *capabilities.Capabilities) (*capabilities.Capabilities, error)

StartSession merges the passed in caps with b.Metadata.Capabilities and returns the merged capabilities that should be used when calling new session on the WebDriver server.

func (*Base) StopSession

func (b *Base) StopSession(ctx context.Context, _ int) error

StopSession is a no-op implementation of Env.StopSession.

func (*Base) TearDown

func (b *Base) TearDown(ctx context.Context) error

TearDown is a no-op implementation of Env.TearDown.

func (*Base) WDAddress

func (*Base) WDAddress(context.Context) string

WDAddress returns the empty string.

type Env

type Env interface {
	healthreporter.HealthReporter
	// SetUp is called once at the beginning of the test run, and should start a
	// WebDriver server. It is not necessary that the environment be healthy when
	// this returns.
	SetUp(ctx context.Context) error
	// StartSession is called for each new WebDriver session, before the new
	// session command is sent to the WebDriver server. caps is the capabilities
	// sent to the proxy from the client, and the return value is the capabilities
	// that should be actually sent to the WebDriver server new session command.
	StartSession(ctx context.Context, id int, caps *capabilities.Capabilities) (*capabilities.Capabilities, error)
	// StopSession is called for each new WebDriver session, before the delete
	// session command is sent to the WebDriver server.
	StopSession(ctx context.Context, id int) error
	// TearDown is called at the end of the test run.
	TearDown(ctx context.Context) error
	// WDAddress returns the address of the WebDriver server.
	WDAddress(context.Context) string
}

Env allows web_test environments to be started for controlling a browser using Selenium WebDriver.

Directories

Path Synopsis
Package external works with an externally started WebDriver server located at EXTERNAL_WEBDRIVER_SERVER_ADDRESS.
Package external works with an externally started WebDriver server located at EXTERNAL_WEBDRIVER_SERVER_ADDRESS.
Package local provides a basic environment for web tests locally.
Package local provides a basic environment for web tests locally.
Package sauce provides a simple environment for accessing a SauceLabs browser.
Package sauce provides a simple environment for accessing a SauceLabs browser.

Jump to

Keyboard shortcuts

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