dsl

package
v2.0.0-...-b920a9c Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2015 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package dsl uses Ginkgo to implement a Capybara-like DSL for writing acceptance tests. This package is provided entirely for convenience. This DSL is not required to write Ginkgo acceptance tests. Unlike the base agouti package, the dsl package only permits a single running WebDriver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Back

func Back(page ActionPage)

Back is comparable to Expect(page.Back()).To(Succeed())

func Background

func Background(body interface{}, timeout ...float64) bool

Background is equivalent to Ginkgo BeforeEach.

func CancelPopup

func CancelPopup(page ActionPage)

CancelPopup is comparable to Expect(page.CancelPopup()).To(Succeed())

func Check

func Check(selection ActionSelection)

Check is comparable to Expect(selection.Check()).To(Succeed())

func ClearCookies

func ClearCookies(page ActionPage)

ClearCookies is comparable to Expect(page.ClearCookies()).To(Succeed())

func Click

func Click(selection ActionSelection)

Click is comparable to Expect(selection.Click()).To(Succeed())

func CloseWindow

func CloseWindow(page ActionPage)

CloseWindow is comparable to Expect(page.CloseWindow()).To(Succeed())

func ConfirmPopup

func ConfirmPopup(page ActionPage)

ConfirmPopup is comparable to Expect(page.ConfirmPopup()).To(Succeed())

func CreatePage

func CreatePage(browserName ...string) *agouti.Page

CreatePage creates a new session using the current running WebDriver. For Selenium, the browserName determines which browser to use for the session.

func CustomPage

func CustomPage(capabilities agouti.Capabilities) *agouti.Page

CustomPage creates a new session with a custom set of desired capabilities using the current running WebDriver. The agouti.Use() function may be used to generate this set of capabilities. For Selenium, the capabilities Browser(string) method sets which browser to use for the session.

func DeleteCookie

func DeleteCookie(page ActionPage, name string)

DeleteCookie is comparable to Expect(page.DeleteCookie("cookie-name")).To(Succeed())

func Destroy

func Destroy(page ActionPage)

Destroy is comparable to Expect(page.Destroy()).To(Succeed())

func DoubleClick

func DoubleClick(selection ActionSelection)

DoubleClick is comparable to Expect(selection.DoubleClick()).To(Succeed())

func EnterPopupText

func EnterPopupText(page ActionPage, text string)

EnterPopupText is comparable to Expect(page.EnterPopupText("some text")).To(Succeed())

func FFeature

func FFeature(text string, body func()) bool

FFeature is equilavent to Ginkgo FDescribe (Focused Describe).

func FScenario

func FScenario(description string, body func(), timeout ...float64) bool

FScenario is equivalent to Ginkgo FIt (Focused It).

func Feature

func Feature(text string, body func()) bool

Feature is equivalent to Ginkgo Describe.

func Fill

func Fill(selection ActionSelection, text string)

Fill is comparable to Expect(selection.Fill(text)).To(Succeed())

func Forward

func Forward(page ActionPage)

Forward is comparable to Expect(page.Forward()).To(Succeed())

func Navigate(page ActionPage, url string)

Navigate is comparable to Expect(page.Navigate(url)).To(Succeed())

func NextWindow

func NextWindow(page ActionPage)

NextWindow is comparable to Expect(page.NextWindow()).To(Succeed())

func PFeature

func PFeature(text string, body func()) bool

PFeature is equilavent to Ginkgo PDescribe (Pending Describe).

func PScenario

func PScenario(description string, ignored ...interface{}) bool

PScenario is equivalent to Ginkgo PIt (Pending It).

func Refresh

func Refresh(page ActionPage)

Refresh is comparable to Expect(page.Refresh()).To(Succeed())

func RegisterAgoutiFailHandler

func RegisterAgoutiFailHandler(handler func(message string, callerSkip ...int))

RegisterAgoutiFailHandler connects the implied assertions is Agouti's dsl with Gingko. When set to ginkgo.Fail (the default), failures in Agouti's dsl-provided methods will cause test failures in Ginkgo.

func RunScript

func RunScript(page ActionPage, body string, arguments map[string]interface{}, result interface{})

RunScript is comparable to Expect(page.RunScript(script, args, &result)).To(Succeed())

func Scenario

func Scenario(description string, body func(), timeout ...float64) bool

Scenario is equivalent to Ginkgo It.

func Screenshot

func Screenshot(page ActionPage, filename string)

Screenshot is comparable to Expect(page.Screenshot("screenshot-file.png")).To(Succeed())

func Select

func Select(selection ActionSelection, text string)

Select is comparable to Expect(selection.Select(text)).To(Succeed())

func SetCookie

func SetCookie(page ActionPage, cookie agouti.Cookie)

SetCookie is comparable to Expect(page.SetCookie(cookie)).To(Succeed())

func Size

func Size(page ActionPage, width, height int)

Size is comparable to Expect(page.Size(windowWidth, windowHeight)).To(Succeed())

func StartChrome

func StartChrome()

StartChrome starts a ChromeDriver WebDriver service for use with CreatePage.

DEPRECATED: Use StartChromeDriver instead.

func StartChromeDriver

func StartChromeDriver()

StartChrome starts a ChromeDriver WebDriver service for use with CreatePage.

func StartPhantomJS

func StartPhantomJS()

StartPhantomJS starts a PhantomJS WebDriver service for use with CreatePage.

func StartSelenium

func StartSelenium()

StartSelenium starts a Selenium WebDriver service for use with CreatePage.

func Step

func Step(text string, callbacks ...func())

Step is equivalent to Ginkgo By.

func StopWebDriver

func StopWebDriver()

StopWebDriver stops the current running WebDriver.

func StopWebdriver

func StopWebdriver()

StopWebDriver stops the current running WebDriver.

DEPRECATED: Use StopWebDriver instead.

func Submit

func Submit(selection ActionSelection)

Submit is comparable to Expect(selection.Submit()).To(Succeed())

func SwitchToFrame

func SwitchToFrame(selection ActionSelection)

SwitchToFrame is comparable to Expect(selection.SwitchToFrame()).To(Succeed())

func SwitchToParentFrame

func SwitchToParentFrame(page ActionPage)

SwitchToParentFrame is comparable to Expect(page.SwitchToParentFrame()).To(Succeed())

func SwitchToRootFrame

func SwitchToRootFrame(page ActionPage)

SwitchToRootFrame is comparable to Expect(page.SwitchToRootFrame()).To(Succeed())

func SwitchToWindow

func SwitchToWindow(page ActionPage, name string)

SwitchToWindow is comparable to Expect(page.SwitchToWindow("window name")).To(Succeed())

func Uncheck

func Uncheck(selection ActionSelection)

Uncheck is comparable to Expect(selection.Uncheck()).To(Succeed())

func XFeature

func XFeature(text string, body func()) bool

XFeature is equilavent to Ginkgo XDescribe (Pending Describe).

func XScenario

func XScenario(description string, ignored ...interface{}) bool

XScenario is equivalent to Ginkgo XIt (Pending It).

Types

type ActionPage

type ActionPage interface {
	Destroy() error
	Navigate(url string) error
	SetCookie(cookie agouti.Cookie) error
	DeleteCookie(name string) error
	ClearCookies() error
	Size(width, height int) error
	Screenshot(filename string) error
	RunScript(body string, arguments map[string]interface{}, result interface{}) error
	EnterPopupText(text string) error
	ConfirmPopup() error
	CancelPopup() error
	Forward() error
	Back() error
	Refresh() error
	SwitchToParentFrame() error
	SwitchToRootFrame() error
	SwitchToWindow(name string) error
	NextWindow() error
	CloseWindow() error
}

type ActionSelection

type ActionSelection interface {
	SwitchToFrame() error
	Click() error
	DoubleClick() error
	Fill(text string) error
	Check() error
	Uncheck() error
	Select(text string) error
	Submit() error
}

type AgoutiFailHandler

type AgoutiFailHandler func(message string, callerSkip ...int)

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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