browsertests

package
v0.0.0-...-76a3325 Latest Latest
Warning

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

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

README

This directory contains Selenium tests for Monsti CMS.

You need a recent Chrome/Chromium and ChromeDriver[1]. Other browsers should
work too, but the Firefox driver has problems with filling out the Aloha editor
fields.

To run the tests, you first have to start the Monsti example instance and
ChromeDriver. After that, run "go test" in this directory.

The tests will change the example/ data files. Keep that in mind 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
⌂ 换网址