Skip to content

sitemap

Collects all pages visited while tests are running and saves them as a sitemap XML file.

The plugin listens to browser navigation events, so it doesn’t slow down test steps. Page loads and SPA route changes (history.pushState) of the top-level page are recorded, iframes are ignored. Every unique http(s) URL is added to the sitemap. URL fragments (#...) are dropped.

Supported helpers: Playwright, Puppeteer, and WebDriver with BiDi protocol enabled (default). The sitemap is written once all tests finish.

"plugins": {
"sitemap": {
"enabled": true
}
}

Possible config options:

  • file: path to the sitemap file, relative to the output directory. Default: sitemap.xml, saved as output/sitemap.xml.
  • stripQuery: remove query strings so /posts?page=1 and /posts?page=2 become one /posts entry. Set to false to keep them. Default: true.

CLI examples:

npx codeceptjs run -p sitemap
npx codeceptjs run -p sitemap:file=visited.xml
npx codeceptjs run -p sitemap:stripQuery=false

Works with run-workers: URLs from all workers are merged into a single sitemap.

  • config any