&      !"#$%None&PA session example, which contains an expectation and also transforms the state.  SessionExample*s must be located as a child to a call to ' and the type s must match between  the example and the call to '<. Sessions cannot be nested, so if there is no parent call  to ' or the types s& do not match, the example will fail. (?Traverse a spec, but only if forceSpec has already been called )ITraverse a list of specs, but only if forceSpecs has already been called *LProcess the items in a depth-first walk, passing in the item counter value. '_This function causes all child examples (sessions cannot be nested) to be executed serially in - depth-first order, tracking a state of type s2 throughout the examples as they are processed in  order. Examples which are &#s (which are essentially functions  s -> IO s ) can view  and modify the state.  If an example is not a &8, the example is executed and there is no change in the  state.  If an example is a &; but throws an exception, there is no change in the state.  If an example is a &9 and completes successfully, the state returned from the # example is used as the new state. aJust before the first example is run, the create action is executed to obtain the initial state. 8 If the create action throws an error, all of the child & will report this error. ` Once the final example is run, the cleanup action is executed with the current state (which is a the intial state passed through all successful examples). An exception in the cleanup function  is ignored.  If you use G, the child examples in the session will still be executed serially in c depth-first order so that the state is processed through properly. But multiple sessions will be  executed in parallel. +Create an example to pass to > which accesses and modifies the state using the state monad.  For example, &it "checks the state" $ runState $ do  s <- get ) liftIO $ s `shouldBe` "Hello, World" ,Create an example to pass to < which only reads the state. This is useful for bracketing ) tests with some resource. For example, openDb :: IO DbConnection  openDb = ...  !closeDb :: DbConnection -> IO () closeDb = ...  )dbSessionWhich :: String -> Spec -> Spec ;dbSessionWhich msg = session openDb closeDb . describe msg   spec :: Spec spec =  ... % dbSessionWhich "checks users" $ do * it "adds a user" $ with $ \db -> do $ ... something with db ...  - it "loads the user" $ with $ \db -> do $ ... something with db ... -./012&34567()*89'create the state cleanup the state spec tree to process +,:;<=>&367'+,-./012&34567()*89'+,:;<=>None !An example that can be passed to 9 containing a webdriver action. It must be created with  $ or %. ?4Used to signal that a previous example had an error @State passed between examples Ainitial config Bthe webdriver sessions CJhas an error occured in an earlier example? We rely on the serialization ; of examples to ensure that at most one thread is reading/ writing this  ioref. ZA typeclass of things which can be converted to a list of capabilities. It has two uses. ^ First, it allows you to create a datatype of grouped capabilities in addition to your actual 2 capabilities. These psudo-caps can be passed to using* to convert them to a list of your actual - capabilities. Secondly, it allows the word using to be used with  so that the session $ description reads like a sentance. 1session "for the home page" $ using Firefox $ do % it "loads the page" $ runWD $ do  ... * it "scrolls the carosel" $ runWD $ do  ... <session "for the users page" $ using [Firefox, Chrome] $ do  ... `Provides information about the browser capabilities used for testing. If you want more control $ over capabilities, you should hide ) and then make an enumeration of all the @ webdriver capabilities you will be testing with. For example,  data TestCaps = Firefox ) | FirefoxWithoutJavascript  | Chrome  | IE8  | IE9 & deriving (Show, Eq, Bounded, Enum) TestCaps" must then be made an instance of TestCapabilities. Also, instances of Using  should be created. The capabilities to pass to D. 3Webdriver expectations consist of a set of browser E to use and the actual test as  a  Z monad. The browser capabilities are specified by an enumeration which is an instance of  . The BrowserDefaults> enumeration provides items that represent the default set of $ capabilities for each browser (see F). ^To obtain more control over the capabilities (e.g. to test multiple versions of IE or to test * Firefrox without javascript), you should 4import Test.Hspec.WebDriver hiding (BrowserDefaults) > and then create your own enumeration which is an instance of  and  . _Combine the examples nested inside this call into a webdriver session. For each capability in ^ the list, before the first example is executed, a new webdriver session is created using the a capabilities. The examples are then executed in depth-first order using this webdriver session ` (so later examples can rely on the browser state created by earlier examples). Once the final 7 example has executed, the session is closed. If some   fails (throws an exception), < all remaining examples in the session will become pending. Note that when using :, the examples within a single session will still execute Y serially. Different sessions (including the multiple sessions created if more than one  capability is passed to  ) will be executed in parallel. LThis function uses the default webdriver host (127.0.0.1), port (4444), and  basepath (/wd/hub). A variation of E which allows you to specify the webdriver configuration. Note that  the capabilities in the G> will be ignored, instead the capabilities will come from the  list of . 2Allows testing multiple browser sessions at once. (The way this works is you create a type a3 to index the sessions, pass an undefined value to  , and then use values of type a with % to identify which session the * example should run with. The first time %/ sees a value, a new session is created. Note @ that the examples are still run serially in depth-first order. ?Note that in hspec1, the requirement that every example inside  must use %  with the same type a is not checked by types. In  )http://hackage.haskell.org/package/hspec2hspec2 ` the types are expressive enough so that this can be checked by the type system (and also means  + does not need the undefined value of type a). VI use this for testing multiple users at once, with one user in each browser session.  *data TestUser = Gandolf | Bilbo | Legolas 1 deriving (Show, Eq, Enum, Bounded, Typeable)  GusersSession :: TestCapabilities cap => String -> ([cap],Spec) -> Spec 4usersSession = multiSession (undefined :: TestUser)  3runUser :: TestUser -> WD () -> WDExample TestUser runUser = runWDWith   spec :: Spec ;spec = usersSession "tests some page" $ using Firefox $ do < it "does something with Gandolf" $ runUser Gandolf $ do  openPage ... 8 it "does something with Bilbo" $ runUser Bilbo $ do  openPage ... A it "goes back to the Gandolf session" $ runUser Gandolf $ do  e <- findElem ....  ... `In the above code, two sessions are created and the examples will go back and forth between the c two sessions. Note that a session for Legolas will only be created the first time he shows up in  a call to runUserJ. To share information between the sessions (e.g. some data that Gandolf H creates that Bilbo should expect), the best way I have found is to use  to create an H IORef while constructing the spec. Note this can be hidden inside the  usersSession function. A variation of E which allows you to specify the webdriver configuration. Note that  the capabilities in the G> will be ignored, instead the capabilities will come from the  list of . /Abort the session without closing the session.  Normally, M will automatically close the session either when the tests complete without ^ error or when any of the tests within the session throws an error. When developing the test [ suite, this can be annoying since closing the session causes the browser window to close. F Therefore, while developing the test suite, you can insert a call to  . This will ` immedietly halt the session (all later tests will fail) but will not close the session so that  the browser window stays open. H lifted into the   monad. 6Asserts that the given element matches the given tag. 3Asserts that the given element has the given text. !9Asserts that the given elemnt has the attribute given by (attr name, value). "5Asserts that the action returns the expected result. #-Asserts that the action throws an exception. ICreate the internal WdState JThe  WDSession6 passed in is used for its host, port, and base path. $Create an example from a   action. This must be nested inside a call to  or  . %Create an example from a  0 action, parameterized by which session to run.  This must be nested inside a call to  or  and can only be used 5 when multiple sessions are running. Also, the type a must match the type given to  . * K?L@MABC MCan be an undefined value of type a, this is used only to determine the type  the message %the list of capabilites and the spec MCan be an undefined value of type a, this is used only to determine the type  the message %the list of capabilites and the spec  !"#INJ$%OPQR STUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~D  !"#$%&$ %  !"#  K?L@MABC   !"#INJ$%OPQR      !"#$%&'()*+,-./01$234567789:;1<<==>?@ABCDEFGHIJKLMLNOPQR)STUEFVWXYZJ[J\J]J^J_J`JaJbJcJdJeJfJgJhJiJjJkJlJmJnJoJpJqJrJsJtJuJvJwJxJyJzJ{J|J}J~JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJLLLLLLLLLLhspec-webdriver-0.3.2Test.Hspec.WebDriverTest.Hspec.WebDriver.Internal hspec-1.12.2 Test.HspecparallelitcontextdescribeTest.Hspec.RunnerhspecTest.Hspec.Core.Type pendingWithpendingrunIOSpectransformers-0.3.0.0Control.Monad.IO.ClassliftIOwebdriver-0.6.0.1Test.WebDriver.MonadWD WDExampleUsing UsingListusingTestCapabilitiesnewCapsBrowserDefaultsAndroidIPadIPhoneOperaIEChromeFirefoxsession sessionWith multiSessionmultiSessionWithinspectSessionshouldBe shouldBeTagshouldHaveTextshouldHaveAttr shouldReturn shouldThrowrunWD runWDWithSessionExample traverseTree traverseSpecmapWithCounterrunStatewithSession sessionCount sessionMVars sessionCreate sessionClose SessionTestAbortSessionEx countItems sessionItem$fExampleSessionExample$fExceptionSessionTest$fShowSessionTest$fShowAbortSessionEx$fExceptionAbortSessionEx PrevHasErrorWdStatestInitialConfig stSessionsstErrorTest.WebDriver.Commands createSessionTest.WebDriver.Capabilities Capabilities defaultCapsTest.WebDriver.ConfigWDConfighspec-expectations-0.6.1Test.Hspec.ExpectationscreateSt hSessionWd WdExamplecloseSt$fExceptionPrevHasError $fUsing[]$fUsingBrowserDefaults!$fTestCapabilitiesBrowserDefaultsgetApplicationCacheStatus getLogTypesgetLogs serverStatus deleteKeysetKeygetKey deleteAllKeys getAllKeys storageSizeuploadZipEntry uploadRawFile uploadFile setLocation getLocationtouchFlickFrom touchFlicktouchLongClicktouchDoubleClicktouchScrollFrom touchScroll touchMovetouchUp touchDown touchClick doubleClickmouseUp mouseDown withMouseDown clickWith moveToFrom moveToCentermoveTo dismissAlert acceptAlert replyToAlert getAlertTextsetOrientationgetOrientation<==>elemSizeelemPoscssPropattr isDisplayed isEnabled isSelected clearInputtagName sendRawKeyssendKeysgetTextsubmitclickelemInfo findElemsFrom findElemFrom activeElem findElemsfindElemgetTitle getSourcedeleteVisibleCookiesdeleteCookieByName deleteCookie setCookiecookiesmkCookie setWindowPos getWindowPos setWindowSize getWindowSizemaximize closeWindow focusWindowwindowsgetCurrentWindow focusFrame deactivateIME activateIMEcheckIMEActiveactiveIMEEngineavailableIMEEnginesscreenshotBase64 screenshotasyncJS executeJSrefreshbackforwardopenPage getCurrentURLsetPageLoadTimeoutsetScriptTimeoutsetImplicitWait closeSessiongetCapssessionsJSArg WithIndexWithName WithElement DefaultFrame FrameSelector cookExpiry cookSecure cookDomaincookPath cookValuecookNameCookieByIdByNameByClassByTag ByLinkTextByPartialLinkTextByCSSByXPathSelector LandscapePortrait Orientation LeftButton MiddleButton RightButton MouseButton LocalStorageSessionStorageWebStorageTypelogMsglogLevellogTimeLogEntryLogTypeUncachedIdleChecking Downloading UpdateReadyObsoleteApplicationCacheStatus Test.WebDriver.Commands.Internal currentWindowElement WindowHandleLogOff LogSevere LogWarningLogInfo LogConfigLogFineLogFiner LogFinestLogAllLogLevel