webdriver-angular-0.1.1: Webdriver actions to assist with testing a webpage which uses Angular.Js

Safe HaskellNone

Test.WebDriver.Commands.Angular

Contents

Description

This module exposes webdriver actions that can be used to interact with a page which uses AngularJs. This provides similar functionality as protractor and in fact we share some code with protractor.

Synopsis

Loading

waitForAngularSource

Arguments

:: WebDriver wd 
=> Text

CSS selector to element which has ng-app

-> wd Bool 

Wait until Angular has finished rendering before continuing. False indicates the timeout was hit (see setScriptTimeout) and we stopped waiting and True means that angular has finished rendering.

Searching for elements

data NgException Source

Exceptions of this type will be thrown when an element is unable to be located.

Constructors

NgException String 

data NgSelector Source

Constructors

ByBinding Text

Argument is the binding, e.g. {{dog.name}}

ByModel Text

Argument is the model name. This is just a combination of ByInput, ByTextarea, and BySelect

ByInput Text

Input element with matching model name, e.g. <input ng-model="name" ...>.

ByTextarea Text

Textarea element with matching model name, e.g. <textarea ng-model="name" ... >

BySelect Text

Select element with matching model name, e.g. <select ng-model="name" ... >

BySelectedOption Text

Selected options with a select element matching the modelname. That is, The <option:checked> elements within a <select ng-model="name" ... >.

findNg :: (MonadIO wd, WebDriver wd) => NgSelector -> wd ElementSource

Find a single element from the document matching the given Angular selector. If zero or more than one element is returned, an exception of type NgException is thrown.

findNgs :: WebDriver wd => NgSelector -> wd [Element]Source

Find elements from the document matching the given Angular selector.

findNgFrom :: (MonadIO wd, WebDriver wd) => Element -> NgSelector -> wd ElementSource

Find a single element from within the given element which matches the given Angular selector. If zero or more than one element is returned, an exception of type NgException is thrown.

findNgsFrom :: WebDriver wd => Element -> NgSelector -> wd [Element]Source

Find elements from within the given element which match the given Angular selector.

data NgRepeater Source

Constructors

ByRows Text

All the rows matching the repeater (e.g. 'dog in dogs')

ByRow Text Int

A single row specified by the text of the repeater (e.g. 'dog in dogs') and the row index

ByColumn Text Text

A single column matching the text of the repeater (e.g. 'dog in dogs') and the column binding (e.g '{{dog.name}}').

ByRowAndCol Text Int Text

A single row and column, given (repeater, row index, column binding).

findRepeater :: (MonadIO wd, WebDriver wd) => NgRepeater -> wd ElementSource

Find an element from the document which matches the Angular repeater. If zero or more than one element are returned, an exception of type NgException is thrown.

findRepeaters :: WebDriver wd => NgRepeater -> wd [Element]Source

Find elements from the document which match the Angular repeater.

findRepeaterFrom :: (MonadIO wd, WebDriver wd) => Element -> NgRepeater -> wd ElementSource

Find an element from the given element which matches the Angular repeater. If zero or more than one are returned, an exception of type NgException is thrown.

findRepeatersFrom :: WebDriver wd => Element -> NgRepeater -> wd [Element]Source

Find elements from the given element which match the Angular repeater.

Misc

ngEvaluateSource

Arguments

:: (WebDriver wd, FromJSON a) 
=> Element

element in whose scope to evaluate

-> Text

expression to evaluate, e.g. "dog.name | reverse"

-> wd a 

Evaluate an angular expression, using the scope attached to the given element.

getLocationAbsUrlSource

Arguments

:: WebDriver wd 
=> Text

CSS selector to element which has ng-app

-> wd Text 

Return the current absolute url according to Angular (using $location.absUrl()).