-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Webdriver actions to assist with testing a webpage which uses Angular.Js
--   
--   For end to end testing of web applications from Haskell, the
--   <a>webdriver</a> package is a great tool but does not provide specific
--   commands to make testing a webpage using <a>AngularJS</a> easier. The
--   <a>protractor</a> project provides Angular-specific webdriver commands
--   but the test code must be written in javascript. This package fills
--   the gap by reusing some of the protractor code to allow end to end
--   tests of Angular applications to be written in Haskell.
@package webdriver-angular
@version 0.1.11


-- | This module exposes <a>webdriver</a> actions that can be used to
--   interact with a page which uses <a>AngularJs</a>. This provides
--   similar functionality as <a>protractor</a> and in fact we share some
--   code with protractor.
module Test.WebDriver.Commands.Angular

-- | Wait until Angular has finished rendering before continuing.
--   <tt>False</tt> indicates the timeout was hit (see
--   <a>setScriptTimeout</a>) and we stopped waiting and <tt>True</tt>
--   means that angular has finished rendering.
waitForAngular :: (MonadIO wd, WebDriver wd) => Text -> wd Bool

-- | Exceptions of this type will be thrown when an element is unable to be
--   located.
data NgException
NgException :: String -> NgException
data NgSelector

-- | Argument is the binding, e.g. {{dog.name}}
ByBinding :: Text -> NgSelector

-- | Argument is the model name. Searches for elements with the
--   <tt>ng-model="name"</tt> attribute.
ByModel :: Text -> NgSelector

-- | Argument is a model name. Searches for selected options within a
--   select element matching the modelname. That is, the
--   <tt>&lt;option:checked&gt;</tt> elements within a <tt>&lt;select
--   ng-model="name" ... &gt;</tt>.
BySelectedOption :: Text -> NgSelector

-- | 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 <a>NgException</a> is thrown.
findNg :: (MonadIO wd, WebDriver wd) => NgSelector -> wd Element

-- | Find elements from the document matching the given Angular selector.
findNgs :: WebDriver wd => NgSelector -> wd [Element]

-- | 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 <a>NgException</a> is thrown.
findNgFrom :: (MonadIO wd, WebDriver wd) => Element -> NgSelector -> wd Element

-- | Find elements from within the given element which match the given
--   Angular selector.
findNgsFrom :: WebDriver wd => Element -> NgSelector -> wd [Element]
data NgRepeater

-- | All the rows matching the repeater (e.g. 'dog in dogs')
ByRows :: Text -> NgRepeater

-- | A single row specified by the text of the repeater (e.g. 'dog in
--   dogs') and the row index
ByRow :: Text -> Int -> NgRepeater

-- | A single column matching the text of the repeater (e.g. 'dog in dogs')
--   and the column binding (e.g '{{dog.name}}').
ByColumn :: Text -> Text -> NgRepeater

-- | A single row and column, given (repeater, row index, column binding).
ByRowAndCol :: Text -> Int -> Text -> NgRepeater

-- | Finds elements from the document which match the <a>NgRepeater</a>.
--   
--   Note that when using ng-repeat-start and ng-repeat-end and looking up
--   using <a>ByRows</a>, all elements are returned in one big list, not
--   grouped by each instance of ng-repeat-start.
findRepeaters :: WebDriver wd => NgRepeater -> wd [Element]

-- | A variant on <a>findRepeaters</a> which throws an exception if the
--   return value from <a>findRepeaters</a> does not have length exactly
--   one.
findRepeater :: (MonadIO wd, WebDriver wd) => NgRepeater -> wd Element

-- | A variant of <tt>findRepater</tt> which allows searching only the
--   given element.
findRepeaterFrom :: (MonadIO wd, WebDriver wd) => Element -> NgRepeater -> wd Element

-- | A variant of <tt>findRepaters</tt> which allows searching only the
--   given element.
findRepeatersFrom :: WebDriver wd => Element -> NgRepeater -> wd [Element]

-- | Evaluate an angular expression, using the scope attached to the given
--   element.
ngEvaluate :: (WebDriver wd, FromJSON a) => Element -> Text -> wd a

-- | Return the current absolute url according to Angular (using
--   <tt>$location.absUrl()</tt>).
getLocationAbsUrl :: WebDriver wd => Text -> wd Text

-- | Browse to another page using in-page navigation (via
--   <tt>$location.url</tt>).
setNgLocation :: (MonadIO wd, WebDriver wd) => Text -> Text -> wd ()
instance GHC.Classes.Eq Test.WebDriver.Commands.Angular.NgRepeater
instance GHC.Show.Show Test.WebDriver.Commands.Angular.NgRepeater
instance GHC.Classes.Eq Test.WebDriver.Commands.Angular.NgSelector
instance GHC.Show.Show Test.WebDriver.Commands.Angular.NgSelector
instance GHC.Classes.Eq Test.WebDriver.Commands.Angular.NgException
instance GHC.Show.Show Test.WebDriver.Commands.Angular.NgException
instance GHC.Exception.Exception Test.WebDriver.Commands.Angular.NgException
