Skip to content

Latest commit

 

History

History
84 lines (52 loc) · 2.04 KB

readme.markdown

File metadata and controls

84 lines (52 loc) · 2.04 KB

Flax

Flax is a good source of Selenium

Flax is a scala library that provides a purely functional interface to the popular testing tool Selenium.

Flax wraps Selenium's Java client in a set of Action values, which can be composed in order to write tests. The Actions performed are logged, and a tree of operations is displayed in the event of test failure, to aid debugging.

Flax integrates into the Specs2 testing framework, but other integrations are possible.

Flax has a dependency on scalaz for its functional abstractions.

binaries

code

Getting Started

Assuming you're using sbt:

  1. Download any browser drivers you need and ensure they're on your path. e.g.
  2. Add flax to your build.sbt file.
   resolvers += Resolver.bintrayRepo("ephox", "flax")

   libraryDependencies += "com.ephox" %% "flax" % FLAX_VERSION % Test withSources
  1. Disable parallel execution in your build settings parallelExecution := false

  2. Create a test base class. e.g. ExampleTestBase.scala

  3. Write tests TODO

Examples

TODO

Implementation Details

Actions

Actions wrap a stack of types which provide:

  • effect tracking (IO)
  • input of a Selenium WebDriver wrapper object (Reader[Driver, _])
  • logging (Writer[Log, _])
  • error reporting (/)

This stack is implemented as monad transformers in Scala.

Log

The Log data type is a tree structure with no root node. It's a list of nodes, and each node has a payload and a Log value representing its children.

flatMapping appends the logs. Action.nested adds a new level of structure - it makes a new Log, and takes the previous log as its children.

Developer notes

Acknowledgements

Thanks to JFrog Bintray for hosting Flax's binaries.