browsertests

package
v0.0.0-...-a7141ec Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2014 License: AGPL-3.0-or-later, AGPL-3.0 Imports: 6 Imported by: 0

README

This directory contains Selenium tests for Monsti.

You need a recent Chrome/Chromium and ChromeDriver[1]. Other browsers should
work too, but are not officially supported at the moment.

To run the tests, you first have to start the Monsti example instance
(go to the example directory and run start.sh) and ChromeDriver
(listening on the default port 9515)[2]. After that, run "make
test-browser" in the package's root.

The tests will change some of the example/ data files. Keep that in
mind when commiting any changes until Monsti gets a more sophisticated
Selenium test setup ;)

[1] http://code.google.com/p/chromedriver/downloads/list
[2] http://code.google.com/p/selenium/wiki/ChromeDriver#Running_the_server_as_a_standalone_process

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Must

func Must(err error, msg string, t *testing.T)

Must expects err to be nil. If err is not nil, it calls t.Fail with the given error msg and the error.

func MustErr

func MustErr(err error, contains string, msg string, t *testing.T)

MustErr expects err to be non nil. If err is nil, it calls t.Fail with the given error msg. If `contains` is a string of non zero length, it also checks if the error contains this string.

Types

type Browser

type Browser struct {
	// contains filtered or unexported fields
}

func (*Browser) Contains

func (b *Browser) Contains(text string) error

Contains checks if the given text is in the page source. If not, it returns an error.

func (*Browser) FillById

func (b *Browser) FillById(id, content string) error

FillById fills the element with the given id.

func (*Browser) FindElement

func (b *Browser) FindElement(selector string) (selenium.WebElement, error)

FindElement finds an element using the given css selector.

func (*Browser) Go

func (b *Browser) Go(url string) error

Go opens the given url.

func (*Browser) Quit

func (b *Browser) Quit()

func (*Browser) SubmitForm

func (b *Browser) SubmitForm(fields map[string]string) error

SubmitForm fills the given form with the fields in the map and submits it. The keys in fields are the field ids.

func (b *Browser) VisitLink(text string) error

Visit links opens the link with the given text.

Jump to

Keyboard shortcuts

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