playwright

package
v0.85.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Kind represents the type definition of this config.
	Kind = "playwright"

	// APIVersion represents the supported config version.
	APIVersion = "v1alpha"
)

Config descriptors.

Functions

func FilterSuites added in v0.53.0

func FilterSuites(p *Project, suiteName string) error

FilterSuites filters out suites in the project that don't match the given suite name.

func IsSharded added in v0.82.0

func IsSharded(suites []Suite) bool

func SetDefaults added in v0.53.0

func SetDefaults(p *Project)

SetDefaults applies config defaults in case the user has left them blank.

func ShardSuites added in v0.73.0

func ShardSuites(p *Project) error

ShardSuites applies sharding by NumShards or by Shard (based on pattern)

func SplitSuites added in v0.38.0

func SplitSuites(p Project) (Project, Project)

SplitSuites divided Suites to dockerSuites and sauceSuites

func Validate added in v0.53.0

func Validate(p *Project) error

Validate validates basic configuration of the project and returns an error if any of the settings contain illegal values. This is not an exhaustive operation and further validation should be performed both in the client and/or server side depending on the workflow that is executed.

Types

type Playwright

type Playwright struct {
	Version    string `yaml:"version,omitempty" json:"version,omitempty"`
	ConfigFile string `yaml:"configFile,omitempty" json:"configFile,omitempty"`
}

Playwright represents crucial playwright configuration that is required for setting up a project.

type Project

type Project struct {
	config.TypeDef `yaml:",inline" mapstructure:",squash"`
	ShowConsoleLog bool                   `yaml:"showConsoleLog" json:"-"`
	DryRun         bool                   `yaml:"-" json:"-"`
	ConfigFilePath string                 `yaml:"-" json:"-"`
	CLIFlags       map[string]interface{} `yaml:"-" json:"-"`
	Sauce          config.SauceConfig     `yaml:"sauce,omitempty" json:"sauce"`
	Playwright     Playwright             `yaml:"playwright,omitempty" json:"playwright"`
	// Suite is only used as a workaround to parse adhoc suites that are created via CLI args.
	Suite         Suite                `yaml:"suite,omitempty" json:"-"`
	Suites        []Suite              `yaml:"suites,omitempty" json:"suites"`
	BeforeExec    []string             `yaml:"beforeExec,omitempty" json:"beforeExec"`
	Docker        config.Docker        `yaml:"docker,omitempty" json:"docker"`
	Npm           config.Npm           `yaml:"npm,omitempty" json:"npm"`
	RootDir       string               `yaml:"rootDir,omitempty" json:"rootDir"`
	RunnerVersion string               `yaml:"runnerVersion,omitempty" json:"runnerVersion"`
	Artifacts     config.Artifacts     `yaml:"artifacts,omitempty" json:"artifacts"`
	Reporters     config.Reporters     `yaml:"reporters,omitempty" json:"-"`
	Defaults      config.Defaults      `yaml:"defaults,omitempty" json:"defaults"`
	Env           map[string]string    `yaml:"env,omitempty" json:"env"`
	Notifications config.Notifications `yaml:"notifications,omitempty" json:"-"`
}

Project represents the playwright project configuration.

func FromFile

func FromFile(cfgPath string) (Project, error)

FromFile creates a new playwright Project based on the filepath cfgPath.

type Suite

type Suite struct {
	Name              string            `yaml:"name,omitempty" json:"name"`
	Mode              string            `yaml:"mode,omitempty" json:"-"`
	Timeout           time.Duration     `yaml:"timeout,omitempty" json:"timeout"`
	PlaywrightVersion string            `yaml:"playwrightVersion,omitempty" json:"playwrightVersion,omitempty"`
	TestMatch         []string          `yaml:"testMatch,omitempty" json:"testMatch,omitempty"`
	PlatformName      string            `yaml:"platformName,omitempty" json:"platformName,omitempty"`
	Params            SuiteConfig       `yaml:"params,omitempty" json:"param,omitempty"`
	ScreenResolution  string            `yaml:"screenResolution,omitempty" json:"screenResolution,omitempty"`
	Env               map[string]string `yaml:"env,omitempty" json:"env,omitempty"`
	NumShards         int               `yaml:"numShards,omitempty" json:"-"`
	Shard             string            `yaml:"shard,omitempty" json:"-"`
}

Suite represents the playwright test suite configuration.

type SuiteConfig

type SuiteConfig struct {
	BrowserName string `yaml:"browserName,omitempty" json:"browserName,omitempty"`

	// Fields appeared in v1.12+
	Headless      bool   `yaml:"headless,omitempty" json:"headless,omitempty"`
	GlobalTimeout int    `yaml:"globalTimeout,omitempty" json:"globalTimeout,omitempty"`
	Timeout       int    `yaml:"timeout,omitempty" json:"timeout,omitempty"`
	Grep          string `yaml:"grep,omitempty" json:"grep,omitempty"`
	RepeatEach    int    `yaml:"repeatEach,omitempty" json:"repeatEach,omitempty"`
	Retries       int    `yaml:"retries,omitempty" json:"retries,omitempty"`
	MaxFailures   int    `yaml:"maxFailures,omitempty" json:"maxFailures,omitempty"`
	Project       string `yaml:"project" json:"project,omitempty"`

	// Shard is set by saucectl (not user) based on Suite.NumShards.
	Shard string `yaml:"-" json:"shard,omitempty"`

	// Deprecated fields in v1.12+
	HeadFul             bool `yaml:"headful,omitempty" json:"headful,omitempty"`
	ScreenshotOnFailure bool `yaml:"screenshotOnFailure,omitempty" json:"screenshotOnFailure,omitempty"`
	SlowMo              int  `yaml:"slowMo,omitempty" json:"slowMo,omitempty"`
	Video               bool `yaml:"video,omitempty" json:"video,omitempty"`

	// Will be deprecated since `headless` is introduced
	Headed bool `yaml:"headed,omitempty" json:"headed,omitempty"`
}

SuiteConfig represents the configuration specific to a suite

Jump to

Keyboard shortcuts

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