playwright

package
v0.169.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: Apache-2.0 Imports: 16 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 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"`
	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"`
	EnvFlag       map[string]string    `yaml:"-" json:"-"`
	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.

func (*Project) FilterFailedTests added in v0.138.0

func (p *Project) FilterFailedTests(suiteName string, report saucereport.SauceReport) error

FilterFailedTests takes the failed tests in the report and sets them as a test filter in the suite. The test filter remains unchanged if the report does not contain any failed tests.

func (*Project) IsSmartRetried added in v0.148.0

func (p *Project) IsSmartRetried() bool

IsSmartRetried checks if the suites contain a smartRetried suite

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"`
	ExcludedTestFiles []string          `yaml:"excludedTestFiles,omitempty" json:"testIgnore"`
	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:"-"`
	PreExec           []string          `yaml:"preExec,omitempty" json:"preExec"`
	TimeZone          string            `yaml:"timeZone,omitempty" json:"timeZone"`
	PassThreshold     int               `yaml:"passThreshold,omitempty" json:"-"`
	SmartRetry        config.SmartRetry `yaml:"smartRetry,omitempty" json:"-"`
	ShardGrepEnabled  bool              `yaml:"shardGrepEnabled,omitempty" json:"-"`
}

Suite represents the playwright test suite configuration.

func SortByHistory added in v0.105.0

func SortByHistory(suites []Suite, history insights.JobHistory) []Suite

SortByHistory sorts the suites in the order of job history

type SuiteConfig

type SuiteConfig struct {
	BrowserName string `yaml:"browserName,omitempty" json:"browserName,omitempty"`
	// BrowserVersion for playwright is not specified by the user, but determined by Test-Composer
	BrowserVersion string `yaml:"-" json:"-"`

	// 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"`
	GrepInvert      string `yaml:"grepInvert,omitempty" json:"grepInvert,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"`
	UpdateSnapshots bool   `yaml:"updateSnapshots,omitempty" json:"updateSnapshots"`
	Workers         int    `yaml:"workers,omitempty" json:"workers,omitempty"`

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

SuiteConfig represents the configuration specific to a suite

Directories

Path Synopsis
Package grep implements functions to parse and filter spec files like playwright is doing.
Package grep implements functions to parse and filter spec files like playwright is doing.

Jump to

Keyboard shortcuts

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