webassert

package
v0.0.0-...-77d204d Latest Latest
Warning

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

Go to latest
Published: May 31, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package webassert contains test helpers to the check the rooms web pages for certain aspects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CSRFTokenPresent

func CSRFTokenPresent(t *testing.T, sel *goquery.Selection) url.Values

CSRFTokenPresent checks a CSRF token is in side the passed selection (ususally a form). The function returns a url.Values map with the token, which can be used to craft further requests.

func ElementsInForm

func ElementsInForm(t *testing.T, form *goquery.Selection, elems []FormElement)

ElementsInForm checks a list of defined elements. It tries to find them by input[name=$name] and then proceeds with asserting their value, type or placeholder (if the fields in FormElement are not "")

func HasFlashMessages

func HasFlashMessages(t *testing.T, client *tester.Tester, url *url.URL, labels ...string)

func Localized

func Localized(t *testing.T, html *goquery.Document, elems []LocalizedElement)

Localized checks that a certain selector has a certain label. This relies on the fact that the test code doesn't return a localized version but just the labels

Types

type FormElement

type FormElement struct {
	Tag, Name, Value, Type, Placeholder string
}

type LocalizedElement

type LocalizedElement struct {
	Selector, Label string
}

Jump to

Keyboard shortcuts

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