Documentation ¶
Index ¶
- Constants
- func CheckPath(path string) error
- func ConstructServerURL(rawURL string) (string, error)
- func GeneratorCLI()
- func SaveFile(image []byte, path string, filename string) error
- func Screenshot(ctx context.Context, config *Configuration, pageConfig *PageConfig)
- func Server(path string) *http.Server
- func Start(configPath string)
- type Configuration
- type DEVICE
- type PageConfig
- type SCREENSHOTSIZE
- type VisualTesting
Constants ¶
View Source
const DEFAULT_URL = "http://localhost:3000"
Variables ¶
This section is empty.
Functions ¶
func ConstructServerURL ¶
ConstructServerURL is cleaning server urls so: 1. To allow users even define localhost:3000 and still work
- Remove trailing slash from URL
func GeneratorCLI ¶ added in v0.1.3
func GeneratorCLI()
GeneratorCLI is a helper CLI function to generate a cyclopes.yml file
func Screenshot ¶
func Screenshot( ctx context.Context, config *Configuration, pageConfig *PageConfig)
Screenshot takes a screenshot for a specific PageConfig
Types ¶
type Configuration ¶
type Configuration struct { // Directory to save/retrieve images ImagesDir string `yaml:"imagesDir"` Visual *VisualTesting Adapters map[string]interface{} // contains filtered or unexported fields }
Configuration struct
func (*Configuration) ExtractServerURL ¶
func (config *Configuration) ExtractServerURL() string
ExtractServerURL is returning: 1: the default server url if the user has not defined a remoteURL 2: the user's remoteURL if it is defined
type PageConfig ¶
type PageConfig struct { // Relative path to visit Path string // Device to screenshot Device DEVICE // Delay in ms Delay int // Code (Javascript code to execute) Code string // Selector to wait WaitSelector string `yaml:"waitSelector"` // If the screenshot should be fullpage or viewport Screenshot SCREENSHOTSIZE }
PageConfig is a struct holding information about individual pages that will be screenshotted
type SCREENSHOTSIZE ¶
type SCREENSHOTSIZE string
SCREENSHOTSIZE Fullpage or Viewport screenshot
const FULLPAGE SCREENSHOTSIZE = "fullpage"
const VIEWPORT SCREENSHOTSIZE = "viewport"
type VisualTesting ¶
type VisualTesting struct { Pages []PageConfig // If users want to debug Headless *bool // Base url to visit in our session RemoteURL string `yaml:"remoteURL" head_comment:"Enable or disable."` // BuildDir is used only if // remoteURL is not defined // (to serve the static assets) // served on localhost:3000 BuildDir string `yaml:"buildDir"` }
VisualTesting is a struct holding information about visual testing sessions
Click to show internal directories.
Click to hide internal directories.