v1

package
v0.175.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 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 = "cypress"

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

Config descriptors.

Functions

This section is empty.

Types

type Cypress

type Cypress struct {
	// ConfigFile is the path to "cypress.json".
	ConfigFile string `yaml:"configFile,omitempty" json:"configFile"`

	// Version represents the cypress framework version.
	Version string `yaml:"version" json:"version"`

	// Record represents the cypress framework record flag.
	Record bool `yaml:"record" json:"record"`

	// Key represents the cypress framework key flag.
	Key string `yaml:"key" json:"key"`

	// Reporters represents the customer reporters.
	Reporters []Reporter `yaml:"reporters" json:"reporters"`
}

Cypress represents crucial cypress configuration that is required for setting up a project.

type Project

type Project struct {
	config.TypeDef `yaml:",inline" mapstructure:",squash"`
	Defaults       config.Defaults        `yaml:"defaults" json:"defaults"`
	DryRun         bool                   `yaml:"-" json:"-"`
	ShowConsoleLog bool                   `yaml:"showConsoleLog" json:"-"`
	ConfigFilePath string                 `yaml:"-" json:"-"`
	CLIFlags       map[string]interface{} `yaml:"-" json:"-"`
	Sauce          config.SauceConfig     `yaml:"sauce,omitempty" json:"sauce"`
	Cypress        Cypress                `yaml:"cypress,omitempty" json:"cypress"`
	// 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:"-"`
	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 cypress project configuration.

func FromFile

func FromFile(cfgPath string) (*Project, error)

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

func (*Project) AppendTags

func (p *Project) AppendTags(tags []string)

AppendTags adds tags

func (*Project) ApplyFlags

func (p *Project) ApplyFlags(selectedSuite string) error

ApplyFlags applys cli flags on cypress project

func (*Project) CleanPackages

func (p *Project) CleanPackages()

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) FilterSuites

func (p *Project) FilterSuites(suiteName string) error

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

func (*Project) GetAPIVersion

func (p *Project) GetAPIVersion() string

GetAPIVersion returns APIVersion

func (*Project) GetArtifactsCfg

func (p *Project) GetArtifactsCfg() config.Artifacts

GetArtifactsCfg returns config.Artifacts

func (*Project) GetBeforeExec

func (p *Project) GetBeforeExec() []string

GetBeforeExec returns BeforeExec

func (*Project) GetCLIFlags

func (p *Project) GetCLIFlags() map[string]interface{}

GetCLIFlags returns CLIFlags

func (*Project) GetCfgPath

func (p *Project) GetCfgPath() string

GetCfgPath returns ConfigFilePath

func (*Project) GetKind

func (p *Project) GetKind() string

GetKind returns Kind

func (*Project) GetNotifications

func (p *Project) GetNotifications() config.Notifications

GetNotifications returns config.Notifications

func (*Project) GetNpm

func (p *Project) GetNpm() config.Npm

GetNpm returns config.Npm

func (*Project) GetReporters added in v0.157.0

func (p *Project) GetReporters() config.Reporters

GetReporter returns config.Reporters

func (*Project) GetRootDir

func (p *Project) GetRootDir() string

GetRootDir returns RootDir

func (*Project) GetRunnerVersion

func (p *Project) GetRunnerVersion() string

GetRunnerVersion returns RunnerVersion

func (*Project) GetSauceCfg

func (p *Project) GetSauceCfg() config.SauceConfig

GetSauceCfg returns sauce related config

func (*Project) GetSmartRetry added in v0.138.0

func (p *Project) GetSmartRetry(suiteName string) config.SmartRetry

GetSmartRetry returns the smartRetry config for the given suite. Returns an empty config if the suite could not be found.

func (*Project) GetSuite

func (p *Project) GetSuite() suite.Suite

GetSuite returns suite

func (*Project) GetSuiteCount

func (p *Project) GetSuiteCount() int

GetSuiteCount returns the amount of suites

func (*Project) GetSuiteNames

func (p *Project) GetSuiteNames() string

GetSuiteNames returns combined suite names

func (*Project) GetSuites

func (p *Project) GetSuites() []suite.Suite

GetSuites returns suites

func (*Project) GetVersion

func (p *Project) GetVersion() string

GetVersion returns cypress version

func (*Project) IsDryRun

func (p *Project) IsDryRun() bool

IsDryRun returns DryRun

func (*Project) IsSharded

func (p *Project) IsSharded() bool

IsSharded returns is it's sharded

func (*Project) IsShowConsoleLog

func (p *Project) IsShowConsoleLog() bool

IsShowConsoleLog returns ShowConsoleLog

func (*Project) IsSmartRetried added in v0.148.0

func (p *Project) IsSmartRetried() bool

IsSmartRetried checks if the suites contain a smartRetried suite

func (*Project) SetCLIFlags

func (p *Project) SetCLIFlags(flags map[string]interface{})

SetCLIFlags sets cli flags

func (*Project) SetDefaults

func (p *Project) SetDefaults()

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

func (*Project) SetRunnerVersion

func (p *Project) SetRunnerVersion(version string)

SetRunnerVersion sets runner version

func (*Project) SetVersion

func (p *Project) SetVersion(version string)

SetVersion sets cypress version

func (*Project) Validate

func (p *Project) Validate() 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.

type Reporter

type Reporter struct {
	Name    string                 `yaml:"name" json:"name"`
	Options map[string]interface{} `yaml:"options" json:"options"`
}

Reporter represents a cypress report configuration.

type Suite

type Suite struct {
	Name             string            `yaml:"name,omitempty" json:"name"`
	Browser          string            `yaml:"browser,omitempty" json:"browser"`
	BrowserVersion   string            `yaml:"browserVersion,omitempty" json:"browserVersion"`
	PlatformName     string            `yaml:"platformName,omitempty" json:"platformName"`
	Config           SuiteConfig       `yaml:"config,omitempty" json:"config"`
	ScreenResolution string            `yaml:"screenResolution,omitempty" json:"screenResolution"`
	Timeout          time.Duration     `yaml:"timeout,omitempty" json:"timeout"`
	Shard            string            `yaml:"shard,omitempty" json:"-"`
	ShardGrepEnabled bool              `yaml:"shardGrepEnabled,omitempty" json:"-"`
	Headless         bool              `yaml:"headless,omitempty" json:"headless"`
	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:"-"`
}

Suite represents the cypress test suite configuration.

type SuiteConfig

type SuiteConfig struct {
	TestingType        string            `yaml:"testingType,omitempty" json:"testingType"`
	SpecPattern        []string          `yaml:"specPattern,omitempty" json:"specPattern"`
	ExcludeSpecPattern []string          `yaml:"excludeSpecPattern,omitempty" json:"excludeSpecPattern,omitempty"`
	Env                map[string]string `yaml:"env,omitempty" json:"env"`
}

SuiteConfig represents the cypress config overrides.

Jump to

Keyboard shortcuts

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