justgook/elm-webdriver/1.0.0

NOTE: the latest version is 1.0.2

Now

Getting Started

To run the example tests in this repo, do the following.

  1. Download ChromeDriver
  2. Follow the instructions in the url above to put the ChromeDriver binary (the file you downloaded) into your PATH (google something like 'how to put a file in your path' to learn more)
  3. Install yarn from here
  4. Clone this repo (for more info on how to clone a repo, checkout Atlassian's tutorial)
  5. cd into elm-webdriver/test
  6. Run yarn && yarn test
    1. If you get an error similar to Problem with Webdriver host (Unable to make a connection. Is your network working?), you may need to run ChromeDriver manually. Go here and find where it describes how to 'Start the ChromeDriver server separately'.

For Publishing

Elm-WebDriver

WebDriver is a remote control interface that enables introspection and control of user agents. It provides a platform- and language-neutral wire protocol as a way for out-of-process programs to remotely instruct the behavior of web browsers.

elm-webdriver is framework that allows write scripts for WebDriver with plain Node.js runner that just executes compiled elm

Suported Drivers

Setup

Quick Start

import Task
import WebDriver
import WebDriver.Runner exposing (TestRunner, run)

suite : WebDriver.Test
suite =
    describe "Web Page Navigate"
        [ test "star elm-webdriver" <|
            \{ url, element, attribute } ->
                url "https://github.com/justgook/elm-webdriver"
                    |> Task.andThen (\_ -> "h1" |> Selector.css |> element)
                    |> Task.andThen (.value >> attribute "innerText")
                    |> Task.andThen (.value >> Expect.equal "justgook/elm-webdriver")
        ]

main : TestRunner
main = run suite

Running From CLI

Note: To be able run from node you need install XMLHttpRequest replacement (node don't have build in). Install xhr2 and append it:

var XMLHttpRequest = require(\"xhr2\");

compile Your tests

elm-make Main.elm --output=bundle.js

and run compiled code

node -e 'var XMLHttpRequest = require(\"xhr2\"); require(\"./bundle.js\").Main.worker().ports.log.subscribe((a)=>process.stdout.write(a))'