seleniumtest

package
v0.9.10 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2022 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package seleniumtest provides tests to exercise package selenium. These tests are in a separate package to allow other test harnesses to validate their behavior.

Index

Constants

This section is empty.

Variables

View Source
var Handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
	path := r.URL.Path
	page, ok := map[string]string{
		"/":       homePage,
		"/other":  otherPage,
		"/search": searchPage,
		"/log":    logPage,
		"/frame":  framePage,
		"/title":  titleChangePage,
		"/alert":  alertPage,
	}[path]
	if !ok {
		http.NotFound(w, r)
		return
	}

	if path == "/search" {
		r.ParseForm()
		if len(r.Form) > 0 {
			page = fmt.Sprintf(page, r.Form["q"][0], r.Form["s"][0])
		}
	}

	for i := 0; i < 3; i++ {
		http.SetCookie(w, &http.Cookie{
			Name:  fmt.Sprintf("cookie-%d", i),
			Value: fmt.Sprintf("value-%d", i),
		})
	}
	fmt.Fprint(w, page)
})
View Source
var NewRemote = func(_ *testing.T, caps selenium.Capabilities, addr string) (selenium.WebDriver, error) {
	return selenium.NewRemote(caps, addr)
}

Functions

func RunChromeTests

func RunChromeTests(t *testing.T, c Config)

func RunCommonTests

func RunCommonTests(t *testing.T, c Config)

func RunFirefoxTests

func RunFirefoxTests(t *testing.T, c Config)

Types

type Config

type Config struct {
	Addr, Browser, Path, ServerURL string
	Sauce                          *sauce.Capabilities
	SeleniumVersion                semver.Version
	ServiceOptions                 []selenium.ServiceOption
	Headless                       bool
	SkipProxy                      bool
	SameSiteUnsupported            bool
}

Jump to

Keyboard shortcuts

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