Set up your test environment
You can use Doc Detective directly against your production site. For testing, it’s often useful to set up a local HTML server to run your tests against. The tutorials that follow fill in a sample intake form, so you need to serve that form locally before you run them.
The sample test specs themselves are hosted online, so you don’t need to download them. You pass each one to Doc Detective by URL with the --input argument, as shown in the following tutorials.
-
Download the sample intake form, watson_and_holmes_intake_form.html, into an empty folder. The file is self-contained, so it’s the only file you need.
-
In a terminal, navigate to the folder that contains the form:
Replace
<path-to-form-folder>with the actual path to the folder where you saved the form. -
Install and run a webserver. Running your tests against a local server allows you to make edits and see them in real time. Also, you need to serve the files in a web browser to experiment with video recording and other features.
Any web server works, but here are a few options (unassociated with Doc Detective):
Python
Node.js
VSCode
To run a local server with Python, you can use the built-in
http.servermodule:Once the server is started, you can open a browser window to
http://localhost:8080/watson_and_holmes_intake_form.html. If you see the rendered intake form, you’re ready to start testing.