Repository navigation
feat: add testing helpers for sitemap-driven smoke tests - #316
Merged
Merged
Conversation
Add `@smartive/utils/testing` (sitemap parsing, route limits, ignore rules, browserless URL check) and `@smartive/utils/testing/playwright` (fixtures that fail a test on client-side errors, third-party request blocking, global setup that hands sitemap routes to the specs). `@playwright/test` is an optional peer and only imported as types, so each project runs the version pinned to its CI image. Both subpaths have a `default` export condition so CommonJS projects can require them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…xture server Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… first-party checks
`test.use({ smokeOptions })` replaced the options passed to `smokeFixtures()`, silently
dropping the project-wide `allowHosts` and `ignore` rules. Overrides are now merged:
`ignore` and `allowHosts` add to the base options, the other fields replace them.
`checkFirstPartyRequests: false` still failed on first-party 404s through Chromium's
"Failed to load resource" console error. That message is now always skipped for
first-party URLs, since the response and requestfailed handlers own those failures.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…etches The smoke fixture only knew Chromium's abort error, so cancelled first-party requests (video range requests, navigating away) failed tests in Firefox (`NS_BINDING_ABORTED`) and WebKit (`cancelled`, `Load request cancelled` on Linux). The never-matching `ERR_BLOCKED_BY_CLIENT` entry is gone. Firefox reports a blocked script as a console warning that names the URL in its text but gives the page as location, which failed every page with a blocked tracker. Console messages naming a blocked URL are now skipped. `fetchSitemapRoutes` takes a `timeoutMs` (default 30 s) per request and adds the sitemap URL to network and timeout errors, so a hanging sitemap fails the global setup instead of stalling it. The fixture e2e spec now also runs in Firefox and WebKit on CI (opt-in locally via `E2E_ALL_BROWSERS`). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🎉 This PR is included in version 4.4.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
What
Adds two new subpaths for sitemap-driven smoke tests:
@smartive/utils/testing: no dependencies, no browser.fetchSitemapRoutesfollows sitemap indexes, includeshreflangalternates, applies excludes and limits, and fails when the sitemap is empty.checkUrlschecks every URL's status without following redirects and retries 5xx and network errors.parseSitemap,limitRoutes,excludeRoutes,toPath,isIgnored).@smartive/utils/testing/playwright: an automaticsmokefixture.allowHostsallowlist).gotoAndSettle, andsmokeGlobalSetup/readRoutesto generate one test per sitemap route.@playwright/testis an optional peer dependency. Only its types are imported, so the project's pinned version is the one that runs. Both subpaths have adefaultexport condition, so CommonJS projects (most Next.js apps) can use them.Notes
test.use({ smokeOptions })overrides are merged over thesmokeFixtures()options:ignoreandallowHostsadd to them, the other fields replace them.Tests
npm run test:e2e), plus a check that both subpaths load viarequire(). A new CI job runs it.