testcafe

package
v0.124.1-alpha1 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

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

Config descriptors.

Functions

func FilterSuites added in v0.51.1

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.51.1

func SetDefaults(p *Project)

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

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.50.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 CompilerOptions added in v0.78.0

type CompilerOptions struct {
	TypeScript TypescriptCompilerOptions `yaml:"typescript,omitempty" json:"typescript,omitempty"`
}

CompilerOptions represents the compiler options.

type Filter added in v0.70.0

type Filter struct {
	Test        string            `yaml:"test,omitempty" json:"test,omitempty"`
	TestGrep    string            `yaml:"testGrep,omitempty" json:"testGrep,omitempty"`
	Fixture     string            `yaml:"fixture,omitempty" json:"fixture,omitempty"`
	FixtureGrep string            `yaml:"fixtureGrep,omitempty" json:"fixtureGrep,omitempty"`
	TestMeta    map[string]string `yaml:"testMeta,omitempty" json:"testMeta,omitempty"`
	FixtureMeta map[string]string `yaml:"fixtureMeta,omitempty" json:"fixtureMeta,omitempty"`
}

Filter represents the testcafe filters configuration

type Project

type Project struct {
	config.TypeDef `yaml:",inline" mapstructure:",squash"`
	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"`
	// 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"`
	Testcafe      Testcafe             `yaml:"testcafe,omitempty" json:"testcafe"`
	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 testcafe project configuration.

func FromFile

func FromFile(cfgPath string) (Project, error)

FromFile creates a new testcafe project based on the filepath.

type Screenshots

type Screenshots struct {
	TakeOnFails bool `yaml:"takeOnFails,omitempty" json:"takeOnFails"`
	FullPage    bool `yaml:"fullPage,omitempty" json:"fullPage"`
}

Screenshots represents screenshots configuration.

type Suite

type Suite struct {
	Name              string            `yaml:"name,omitempty" json:"name"`
	BrowserName       string            `yaml:"browserName,omitempty" json:"browserName"`
	BrowserVersion    string            `yaml:"browserVersion,omitempty" json:"browserVersion"`
	BrowserArgs       []string          `yaml:"browserArgs,omitempty" json:"browserArgs"`
	Src               []string          `yaml:"src,omitempty" json:"src"`
	Screenshots       Screenshots       `yaml:"screenshots,omitempty" json:"screenshots"`
	PlatformName      string            `yaml:"platformName,omitempty" json:"platformName"`
	ScreenResolution  string            `yaml:"screenResolution,omitempty" json:"screenResolution"`
	Env               map[string]string `yaml:"env,omitempty" json:"env"`
	Timeout           time.Duration     `yaml:"timeout,omitempty" json:"timeout"`
	PreExec           []string          `yaml:"preExec,omitempty" json:"preExec"`
	ExcludedTestFiles []string          `yaml:"excludedTestFiles,omitempty" json:"-"`
	// Deprecated as of TestCafe v1.10.0 https://testcafe.io/documentation/402638/reference/configuration-file#tsconfigpath
	TsConfigPath       string                 `yaml:"tsConfigPath,omitempty" json:"tsConfigPath"`
	ClientScripts      []string               `yaml:"clientScripts,omitempty" json:"clientScripts,omitempty"`
	SkipJsErrors       bool                   `yaml:"skipJsErrors,omitempty" json:"skipJsErrors"`
	QuarantineMode     map[string]interface{} `yaml:"quarantineMode,omitempty" json:"quarantineMode,omitempty"`
	SkipUncaughtErrors bool                   `yaml:"skipUncaughtErrors,omitempty" json:"skipUncaughtErrors"`
	SelectorTimeout    int                    `yaml:"selectorTimeout,omitempty" json:"selectorTimeout"`
	AssertionTimeout   int                    `yaml:"assertionTimeout,omitempty" json:"assertionTimeout"`
	PageLoadTimeout    int                    `yaml:"pageLoadTimeout,omitempty" json:"pageLoadTimeout"`
	Speed              float64                `yaml:"speed,omitempty" json:"speed"`
	StopOnFirstFail    bool                   `yaml:"stopOnFirstFail,omitempty" json:"stopOnFirstFail"`
	DisablePageCaching bool                   `yaml:"disablePageCaching,omitempty" json:"disablePageCaching"`
	DisableScreenshots bool                   `yaml:"disableScreenshots,omitempty" json:"disableScreenshots"`
	Filter             Filter                 `yaml:"filter,omitempty" json:"filter,omitempty"`
	DisableVideo       bool                   `yaml:"disableVideo,omitempty" json:"disableVideo"` // This field is for sauce, not for native testcafe config.
	Mode               string                 `yaml:"mode,omitempty" json:"-"`
	Shard              string                 `yaml:"shard,omitempty" json:"-"`
	Headless           bool                   `yaml:"headless,omitempty" json:"headless"`
	TimeZone           string                 `yaml:"timeZone,omitempty" json:"timeZone"`
	PassThreshold      int                    `yaml:"passThreshold,omitempty" json:"-"`
	// TypeScript compiling options
	CompilerOptions CompilerOptions `yaml:"compilerOptions,omitempty" json:"compilerOptions"`
	// Deprecated. Reserved for future use for actual devices.
	Devices    []config.Simulator `yaml:"devices,omitempty" json:"devices"`
	Simulators []config.Simulator `yaml:"simulators,omitempty" json:"simulators"`
}

Suite represents the testcafe 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 Testcafe

type Testcafe struct {
	// Version represents the testcafe framework version.
	Version string `yaml:"version,omitempty" json:"version"`
}

Testcafe represents the configuration for testcafe.

type TypescriptCompilerOptions added in v0.78.0

type TypescriptCompilerOptions struct {
	ConfigPath               string            `yaml:"configPath,omitempty" json:"configPath,omitempty"`
	CustomCompilerModulePath string            `yaml:"customCompilerModulePath,omitempty" json:"customCompilerModulePath,omitempty"`
	Options                  map[string]string `yaml:"options,omitempty" json:"options,omitempty"`
}

TypescriptCompilerOptions represents the typescript compiler options.

Jump to

Keyboard shortcuts

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