PER-8985 feat: Playwright drop-in baseline seeding — build attributes + exec orchestration#2335
Open
Shivanshu-07 wants to merge 3 commits into
Open
PER-8985 feat: Playwright drop-in baseline seeding — build attributes + exec orchestration#2335Shivanshu-07 wants to merge 3 commits into
Shivanshu-07 wants to merge 3 commits into
Conversation
…orchestration - @percy/client createBuild: allow-listed drop-in build sources via PERCY_BUILD_SOURCE, plus dropin-baseline-candidate / dropin-baseline-setup attributes (env or explicit options) the API keys baseline auto-approval on. - @percy/cli-exec: generic baseline-provider discovery (any installed SDK package can declare "@percy/cli".baselineProvider). On an empty project, percy exec uploads the committed baseline screenshots as an auto-approved build #1 before the user's command runs; established projects get a notice pointing at the SDK's explicit setup command. Seeding helpers exported for SDK-contributed commands. - @percy/core: expose the server-decided build source on percy.build so SDKs can key on it through the healthcheck. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Verified E2E against a local percy-api: a web project's snapshot create requires a root resource, so raw-PNG comparison tiles are rejected. Seed uploads now use client.sendSnapshot with the same generated root-DOM + image-resource shape 'percy upload' uses for web projects — Percy renders the baseline in the project's own browsers, so it pairs with the head run's DOM snapshots by (name, browser, width). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Seeding dispatches by project type: web projects seed rendered snapshots (root DOM + image resource); app projects seed raw comparison uploads (tag + tile), exactly how App Percy ingests screenshots. Exec seeding now engages for app tokens too. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
| let found = []; | ||
|
|
||
| while (dir !== path.dirname(dir)) { | ||
| let modulesDir = path.join(dir, 'node_modules'); |
| if (fs.existsSync(modulesDir)) { | ||
| for (let name of fs.readdirSync(modulesDir)) { | ||
| if (name === '@percy') { | ||
| for (let scoped of fs.readdirSync(path.join(modulesDir, name))) { |
| if (fs.existsSync(modulesDir)) { | ||
| for (let name of fs.readdirSync(modulesDir)) { | ||
| if (name === '@percy') { | ||
| for (let scoped of fs.readdirSync(path.join(modulesDir, name))) { |
| for (let name of fs.readdirSync(modulesDir)) { | ||
| if (name === '@percy') { | ||
| for (let scoped of fs.readdirSync(path.join(modulesDir, name))) { | ||
| found.push(path.join(modulesDir, name, scoped)); |
| for (let name of fs.readdirSync(modulesDir)) { | ||
| if (name === '@percy') { | ||
| for (let scoped of fs.readdirSync(path.join(modulesDir, name))) { | ||
| found.push(path.join(modulesDir, name, scoped)); |
| found.push(path.join(modulesDir, name, scoped)); | ||
| } | ||
| } else if (name.startsWith('percy-')) { | ||
| found.push(path.join(modulesDir, name)); |
| found.push(path.join(modulesDir, name, scoped)); | ||
| } | ||
| } else if (name.startsWith('percy-')) { | ||
| found.push(path.join(modulesDir, name)); |
| // none is installed (the overwhelmingly common case — one existsSync walk, negligible cost). | ||
| export async function findBaselineProvider({ cwd = process.cwd(), log } = {}) { | ||
| for (let pkgPath of findPercyPackages(cwd)) { | ||
| let pkgFile = path.join(pkgPath, 'package.json'); |
| let providerPath = pkg['@percy/cli']?.baselineProvider; | ||
| if (!providerPath) continue; | ||
|
|
||
| let module = await import(url.pathToFileURL(path.join(pkgPath, providerPath)).href); |
| let providerPath = pkg['@percy/cli']?.baselineProvider; | ||
| if (!providerPath) continue; | ||
|
|
||
| let module = await import(url.pathToFileURL(path.join(pkgPath, providerPath)).href); |
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
CLI-side support for the
@percy/playwrighttoHaveScreenshot drop-in's baseline flow:createBuildaccepts allow-listed drop-in build sources viaPERCY_BUILD_SOURCE(playwright-dropin/playwright-dropin-baseline) plusdropin-baseline-candidate/dropin-baseline-setupattributes (env or explicit options). The API keys baseline auto-approval on these."@percy/cli": { "baselineProvider": "..." }(no framework code enters the CLI, same scaling model as command discovery). On an EMPTY project,percy execuploads the committed baseline screenshots as an auto-approved build ⬆️ Bump @babel/register from 7.10.4 to 7.10.5 #1 before the user's command runs (the suite never executes for the baseline), then starts the head build. Established projects get a notice pointing at the SDK's explicitplaywright:setup-baselinecommand — the API's no-build-persisted sentinel guarantees no stray builds. Seeding dispatches by project type: web → rendered web snapshots (root DOM + image resource, thepercy uploadshape); app → comparison ingest (tag + tile, no render).sourceis kept onpercy.buildso SDKs can key on it through the healthcheck.Depends on
Testing
Client + exec suites green incl. 11 new seeding specs; E2E verified against a local percy-api and on staging (empty web/app seed → head diff flow, established-project sentinel, explicit setup command).
🤖 Generated with Claude Code