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. There are many server options. Live Server is a free utility that creates a local server that monitors your files for changes and updates the browser window automatically.
-
Download TestExamples.zip and expand the file to your local disk.
-
In a terminal, navigate to the expanded folder:
cd <path-to-expanded-test-examples>
Replace
<path-to-expanded-test-examples>
with the actual path where you expanded theTestExamples.zip
file. -
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 will do, but here are a few easy options (unassociated with Doc Detective):
- Python
- Node.js
- VSCode
To run a local server with Python, you can use the built-in
http.server
module:python -m http.server 8080
To run a local server with Node.js, you can use the
http-server
package:npx http-server <path-to-expanded-test-examples>
In VSCode, search for and install the Live Server extension. It gives you a local development server with live reload capability.
infoYou need to set the port number to
8080
in your VSCode settings to match the Doc Detective tutorials.Once the server is started, you can open a browser window to
http://localhost:8080
. If you see a rendered page, you're ready to start testing!