steputils

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StepUtils

type StepUtils struct {
	Settings *config.Settings
	Page     interfaces.PageService
	Session  interfaces.SessionService
}

StepUtils is a set of utility functions tailored to a given Settings object and Agouti Page

func NewStepUtils

func NewStepUtils(settings *config.Settings, page interfaces.PageService) *StepUtils

NewStepUtils creates a new StepUtils struct

func (*StepUtils) FormatDate

func (s *StepUtils) FormatDate(t time.Time) string

FormatDate converts a `time.Time` to a string using the `dateFormat` value specified in the settings file

func (*StepUtils) GetFieldType

func (s *StepUtils) GetFieldType(name string, sel *agouti.Selection) (string, error)

GetFieldType attempts to determine which type of form field an element is. `name` is just the string used to identify the field in the user's gherkin script. This may be the label, name, or ID of the field; it, also, may be a key to a selector entry in the selectors file.

func (*StepUtils) GetMaxWindowSize

func (s *StepUtils) GetMaxWindowSize() (int, int)

GetMaxWindowSize attempts to determine and return the window size set

func (*StepUtils) GetSelectOptions

func (s *StepUtils) GetSelectOptions(htmlSelect *agouti.Selection) map[string]bool

GetSelectOptions returns a map where the keys are the visible text of each option and the values are bools indicating the selected statuses of those options

func (*StepUtils) IsFormField

func (s *StepUtils) IsFormField(field string, sel *agouti.Selection) bool

IsFormField determines if the selection provided is an HTML form field

func (*StepUtils) IsTextBased

func (s *StepUtils) IsTextBased(field string, sel *agouti.Selection) bool

IsTextBased determines if a given field is a form of textbox or textarea

func (*StepUtils) ParseDate

func (s *StepUtils) ParseDate(date string) time.Time

ParseDate parses a given string to a `time.Time` using the `dateFormat` value specified in the settings file

func (*StepUtils) ReplaceVariables added in v1.2.0

func (s *StepUtils) ReplaceVariables(text string) (string, error)

ReplaceVariables interpolates variables found in step arguments

func (*StepUtils) ResolvePage

func (s *StepUtils) ResolvePage(pageName string) (string, error)

ResolvePage takes a page name and returns its full URL

func (*StepUtils) ResolveSelector

func (s *StepUtils) ResolveSelector(name string) ([]*agouti.Selection, error)

ResolveSelector attempts to retrieve the selector specified by `name` and convert it into an Agouti selector for the provided page. If no selector is found, `name` is used to search by label, name, and ID (in that order).

Jump to

Keyboard shortcuts

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