web

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2017 License: BSD-3-Clause Imports: 8 Imported by: 0

README

Venom - Executor Web

Navigate in a web application

Use case: You have a web application and you want to check some behaviours ? Venom allows you to navigate into it and execute actions.

Input

Parameters debug (default: false) and timeout (default: 180 seconds) are optional.

name: TestSuite Web
testcases:
- name: TestCase Google search
  context:
    type: web
    width: 1920
    height: 1080
    driver: phantomjs
    timeout: 60
    debug: true
  steps:
  - action:
      navigate:
        url: https://www.google.fr
    assertions:
    - result.title ShouldEqual Google
    - result.url ShouldEqual https://www.google.fr
  - action:
      find: input[name="q"]
    assertions:
     - result.find ShouldEqual 1
  - action:
      fill:
      - find: input[name="q"]
        text: "venom runabove"
  - action:
      click:
        find: input[value="Recherche Google"]
        wait: 1
    screenshot: googlesearch.jpg

Output

  • result.url
  • result.timeseconds
  • result.timehuman
  • result.title
  • result.find

Documentation

Index

Constants

View Source
const Name = "web"

Name of executor

Variables

View Source
var Keys = map[string]string{
	"NULL":            "\uE000",
	"CANCEL":          "\uE001",
	"HELP":            "\uE002",
	"BACK_SPACE":      "\uE003",
	"TAB":             "\uE004",
	"CLEAR":           "\uE005",
	"RETURN":          "\uE006",
	"ENTER":           "\uE007",
	"SHIFT":           "\uE008",
	"LEFT_SHIFT":      "\uE008",
	"CONTROL":         "\uE009",
	"LEFT_CONTROL":    "\uE009",
	"ALT":             "\uE00A",
	"LEFT_ALT":        "\uE00A",
	"PAUSE":           "\uE00B",
	"ESCAPE":          "\uE00C",
	"SPACE":           "\uE00D",
	"PAGE_UP":         "\uE00E",
	"PAGE_DOWN":       "\uE00F",
	"END":             "\uE010",
	"HOME":            "\uE011",
	"LEFT":            "\uE012",
	"ARROW_LEFT":      "\uE012",
	"UP":              "\uE013",
	"ARROW_UP":        "\uE013",
	"RIGHT":           "\uE014",
	"ARROW_RIGHT":     "\uE014",
	"DOWN":            "\uE015",
	"ARROW_DOWN":      "\uE015",
	"INSERT":          "\uE016",
	"DELETE":          "\uE017",
	"SEMICOLON":       "\uE018",
	"EQUALS":          "\uE019",
	"NUMPAD0":         "\uE01A",
	"NUMPAD1":         "\uE01B",
	"NUMPAD2":         "\uE01C",
	"NUMPAD3":         "\uE01D",
	"NUMPAD4":         "\uE01E",
	"NUMPAD5":         "\uE01F",
	"NUMPAD6":         "\uE020",
	"NUMPAD7":         "\uE021",
	"NUMPAD8":         "\uE022",
	"NUMPAD9":         "\uE023",
	"MULTIPLY":        "\uE024",
	"ADD":             "\uE025",
	"SEPARATOR":       "\uE026",
	"SUBTRACT":        "\uE027",
	"DECIMAL":         "\uE028",
	"DIVIDE":          "\uE029",
	"F1":              "\uE031",
	"F2":              "\uE032",
	"F3":              "\uE033",
	"F4":              "\uE034",
	"F5":              "\uE035",
	"F6":              "\uE036",
	"F7":              "\uE037",
	"F8":              "\uE038",
	"F9":              "\uE039",
	"F10":             "\uE03A",
	"F11":             "\uE03B",
	"F12":             "\uE03C",
	"META":            "\uE03D",
	"COMMAND":         "\uE03D",
	"ZENKAKU_HANKAKU": "\uE040",
}

Keys map returning key code by its name

Functions

func New

func New() venom.Executor

New returns a new Executor

Types

type Action

type Action struct {
	Click    *Click    `yaml:"click,omitempty"`
	Fill     []Fill    `yaml:"fill,omitempty"`
	Find     string    `yaml:"find,omitempty"`
	Navigate *Navigate `yaml:"navigate,omitempty"`
	Wait     int64     `yaml:"wait,omitempty"`
}

Action represents what can be done with web executor

type Click added in v0.0.4

type Click struct {
	Find string `yaml:"find,omitempty"`
	Wait int64  `yaml:"wait"`
}

type Executor

type Executor struct {
	Action     Action `json:"action,omitempty" yaml:"action"`
	Screenshot string `json:"screenshot,omitempty" yaml:"screenshot"`
}

Executor struct

func (Executor) Run

func (Executor) Run(testCaseContext venom.TestCaseContext, l venom.Logger, step venom.TestStep) (venom.ExecutorResult, error)

Run execute TestStep

type Fill

type Fill struct {
	Find string  `yaml:"find,omitempty"`
	Text string  `yaml:"text,omitempty"`
	Key  *string `yaml:"key,omitempty"`
}

Fill represents informations needed to fill input/textarea

type Navigate struct {
	Url   string `yaml:"url,omitempty"`
	Reset bool   `yaml:"reset,omitempty"`
}

type Result

type Result struct {
	Executor    Executor `json:"executor,omitempty" yaml:"executor,omitempty"`
	Find        int      `json:"find,omitempty" yaml:"find,omitempty"`
	HTML        string   `json:"html,omitempty" yaml:"html,omitempty"`
	TimeSeconds float64  `json:"timeseconds,omitempty" yaml:"timeseconds,omitempty"`
	TimeHuman   string   `json:"timehuman,omitempty" yaml:"timehuman,omitempty"`
	Title       string   `json:"title,omitempty" yaml:"title,omitempty"`
	URL         string   `json:"url,omitempty" yaml:"url,omitempty"`
}

Result represents a step result

Jump to

Keyboard shortcuts

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