Skip to content
Peter Thomas edited this page Sep 18, 2019 · 23 revisions

With the karate-chrome Docker image, you can run a Web-UI automation test in 3 steps, with only Docker installed. Yes, you don't need a browser or Java or Maven. You can even view the test in real-time and get a video recording.

You can use the karate-example project, here are the steps.

right now you can use 0.9.5.RC2, advanced users can also follow the Developer Guide

  • start docker and make sure it is running
  • in a terminal, change to the root of the karate-example project
    • Change the <karate.version>X.X.X</karate.version> part to use the latest version.
  • docker run --name karate --rm -p 5900:5900 --cap-add=SYS_ADMIN -v "$PWD":/src ptrthomas/karate-chrome
  • leave the above command "hanging" in that terminal and switch to a new one, again be in the project root
  • optional step on a mac: open vnc://localhost:5900', the password is karate` - yes you can see the Chrome browser !
    • for non-mac users, you just need to use a VNC client
  • Option 1: run maven via a docker exec command from the host directly
    • docker exec -it -w /src karate mvn clean test -DargLine='-Dkarate.env=docker' -Dtest=WebRunner
  • Option 2: enter the running docker container via a bash shell, remain there and run tests. This is great because you can keep editing the files (on your real host) and re-run tests without re-starting the docker container running the browser !
    • docker exec -it -w /src karate bash
    • now you are within the container and you can run normal maven commands !
    • mvn clean test -DargLine='-Dkarate.env=docker' -Dtest=WebRunner