How it works
After the setup, every time you run your Playwright tests, the @test2doc/playwright reporter will attempt to cleanup previously generated files and directories and automatically generate a new markdown file in your specified Docusaurus docs directory for each test file and/or top-level describe block found in your Playwright test files.
Note: Any test files with a
.setup.ts(or.setup.js) extension are automatically ignored and will not generate documentation. This is to prevent Playwright global setup/auth files from appearing in your docs.
Cleanup Step
The cleanup step is designed to maintain a tidy output directory by removing outdated files and directories created by the Test2Doc reporter.
The cleanup step runs automatically at the beginning of each documentation generation process, ensuring a clean slate for new content.
What Happens During Cleanup
- File Deletion: Any files prefixed with
test2doc-(e.g.,test2doc-login.md) will be deleted from the output directory. This ensures that only the most recent documentation files are retained. - Directory Management: Directories that contain files not generated by the Test2Doc reporter will not be deleted. This prevents the loss of any handwritten documentation or other important files.
Note It is safe to place your handwritten files in directories generated by Test2Doc. However, be mindful that if you clean up tests associated with that directory and put handwritten files into it, that the directory may become an orphan and only contain the handwritten files.