Repository navigation
Conversation
Records every top-level page visited during a run and writes it as a sitemap XML file. Pages are collected from browser navigation events (Playwright/Puppeteer framenavigated, WebDriver BiDi browsingContext events), so no extra browser calls are added to test steps. Results from run-workers are merged into a single sitemap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Listen to browser context/page creation (Playwright 'context'/'page', Puppeteer 'targetcreated') and record URLs on page 'load' plus main-frame 'framenavigated' for pushState routes, instead of checking the page on every step. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
sitemapplugin that collects all pages visited while tests run and saves them asoutput/sitemap.xml(sitemap protocol).or
npx codeceptjs run -p sitemapHow it works
Listeners are attached once per browser instance on
test.started. Nothing is added to test steps:browser.on('context')→context.on('page'), so contexts created later bysession()are covered. Each page records its URL onload, and on main-frameframenavigatedforhistory.pushStateroutes.browser.on('targetcreated')attaches the sameloadandframenavigatedlisteners to every new page.browsingContext.load,historyUpdatedandcontextCreatedonce per session, and filters out iframe contexts. Without BiDi nothing is collected, and a debug message says so.http(s)URLs are skipped.run-workers: each worker writes its URLs to a temporary file, and the main process merges them into one sitemap.Beforehook on a freshly started browser are recorded only from the first test onward.Options:
outputName(defaultsitemap.xml),output(directory),stripQuery(defaultfalse).Testing
test/unit/plugin/sitemap_test.js: 8 tests covering dedup, SPA routes and iframe filtering, Puppeteer tabs opened later, Playwright contexts created later, WebDriver BiDi events,stripQuery, the worker merge, and the empty run.session_test.js: pages opened only insidesession()contexts are recorded.withintests locally, both in a single process and withrun-workers 2. Both runs passed and wrote the same 7-page sitemap.withintests: same sitemap. One@Playwright-only test fails both with and without the plugin.🤖 Generated with Claude Code