Write end2end web application tests using webdriver and hspec
|Version on this page:||1.2.0|
|LTS Haskell 11.22:||1.2.0|
|Stackage Nightly 2018-03-12:||1.2.0|
|Latest on Hackage:||1.2.1|
Module documentation for 1.2.0
This package integrates hspec with
hs-webdriver, allowing you to write webdriver tests
using hspec. This package contains no code testing the
hspec-webdriver package itself. The
webdriver-angular package contains some test code which test both the Angular webdriver commands
webdriver-angular and some tests of functions in
The way capabilities are handled was simplified. In the old API (1.1.0 and below) there was a typeclass TestCapabilities and you had to create an enumeration (or use the default provided by this library) and then there was a Using typeclass that allowed lists or a single capability. All this complexity and abuse of typeclasses turned out to be unnecessary. After using hspec-webdriver in my own projects for several years, the best way to handle capabilities is in a utility module to have a list
allBrowsers :: [Capabilities]and then each session in the spec just passes
using(the XKCD exaple in the documentation now uses this approach). The
allBrowsersvalue in the utility module can then be edited and changed to specify which browsers/caps to use for the examples.
The actual API changes are as follows:
- TestCapabilities was removed.
- BrowserDefaults was removed and instead there are symbols
chromeCaps, etc. which you can use instead of BrowserDefaults. Or you can ignore these and create your own capaiblities directly using utility functions from the
- The Using typeclass was removed but the
usinghelper function still exists as a standalone function. You must now pass list of capabilities to
usingbut otherwise the usage is the same. As mentioned above, I suggest the argument to
usingis a list defined in a utility module similar to the XKCD example. (In my large test code, no call to using needed to be changed).
sessionWithchanged to take a list of Capabilities, but when used with
usingthe output of
usingis still the input to
sessionWithtakes a descriptive string to be used to better describe capabilities.
In previous versions, as soon as an example had an error the entire session was aborted. This is still the default, but there are now functions
runWDWithOptionswhich take a setting which can cause the session to continue even if the example has an error. There is an API change in the definition of the
WdExampledata constructor to take the new options, but as long as you were using
runWDWithand not using
WdExampledirectly, there is no change needed to your code.
runWDWithstill have the same behavior as before; as soon as an error occurs, the entire session is aborted.
- Support for webdriver 0.8. The API in hspec-webdriver itself did not change, but we re-export WebDriver.Commands so I bumped the major version. In fact, there were only a few minor changes in the Commands module (most of the changes in webdriver were to session management which is handled internally), so it is likely that your test suite will compile without changes.
- Allow newer versions of hspec and HUnit
- Fix so that the package builds against webdriver 0.6.1
- Increase upper bound on hspec to allow hspec 2.1
- Update to hspec2. All the same features are present but some of the types changed to reflect hspec2 types.
- Update to the new hspec 1.12 API
- Convert inspectSession to turn into a pending example instead of throwing an error.
Add support for testing multiple sessions at once
- multiSession, multiSessionWith, and runWDWith are the new functions
- the type of runWD and WDExample changed
Update to hspec 0.11 and webdriver 0.6
- changed sessionOn to sessionWith to work with new webdriver WDConfig
- TestCapabilities(newCaps) changed type to @c -> IO W.Capabilities@
- Add inspectSession to assist debugging the test suite
- Allow newer version of hspec
- Allow newer version of hspec
- Convert to use webdriver sessions
- Initial Release