Repository navigation
test(engine): nightly motion blur run over generated compositions #7437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+1,482
−19
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
42aa5c9
test(engine): nightly motion blur run over generated compositions
vanceingalls a3a1547
test(engine): the nightly records every failure, ignores noisy refere…
vanceingalls aebfb99
test(engine): the nightly report resists injected failure text and ke…
vanceingalls cdba44b
fix(engine): nightly report escapes backslashes, test strips tags to …
vanceingalls File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| name: motion-blur-nightly | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| HYPERFRAMES_NO_TELEMETRY: "1" | ||
|
|
||
| concurrency: | ||
| group: motion-blur-nightly | ||
| cancel-in-progress: false | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| seeds: | ||
| description: "Seeds to run, a comma list or a-b range (default: today's 200)." | ||
| type: string | ||
| default: "" | ||
| schedule: | ||
| # Daily at 08:41 UTC, off the :00 pile and away from regression.yml's 06:17. | ||
| - cron: "41 8 * * *" | ||
|
|
||
| jobs: | ||
| plan: | ||
| name: Plan seeds | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
| outputs: | ||
| chunks: ${{ steps.plan.outputs.chunks }} | ||
| steps: | ||
| # Today's 200 seeds are days-since-2026-01-01 * 200 onward, in 4 chunks of 50. | ||
| - id: plan | ||
| env: | ||
| SEEDS: ${{ inputs.seeds }} | ||
| run: | | ||
| if [ -n "$SEEDS" ]; then | ||
| chunks="$(jq -cn --arg seeds "$SEEDS" '[{id: "custom", seeds: $seeds}]')" | ||
| else | ||
| days=$(( ($(date -u +%s) - $(date -u -d 2026-01-01 +%s)) / 86400 )) | ||
| start=$(( days * 200 )) | ||
| chunks="$(jq -cn --argjson start "$start" '[range(0; 4) | ($start + . * 50) as $from | {id: ($from | tostring), seeds: "\($from)-\($from + 49)"}]')" | ||
| fi | ||
| echo "chunks=$chunks" >> "$GITHUB_OUTPUT" | ||
| echo "$chunks" | ||
| generated: | ||
| name: Generated compositions (${{ matrix.flavour }}, ${{ matrix.chunk.seeds }}) | ||
| needs: plan | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 45 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| flavour: [pin, stable] | ||
| chunk: ${{ fromJSON(needs.plan.outputs.chunks) }} | ||
| steps: | ||
| - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 | ||
| - id: workspace | ||
| uses: ./.github/actions/setup-test-workspace | ||
| with: | ||
| engine: "true" | ||
| headless-shell: "true" | ||
| - id: pin | ||
| if: matrix.flavour == 'pin' | ||
| shell: bash | ||
| run: | | ||
| dir="$RUNNER_TEMP/headless-shell-pin" | ||
| bunx @puppeteer/browsers@3.2.2 install chrome-headless-shell@153.0.8010.36 --path "$dir" | ||
| echo "path=$(find "$dir" -type f -name chrome-headless-shell | head -n 1)" >> "$GITHUB_OUTPUT" | ||
| - name: Run the generated compositions | ||
| working-directory: packages/engine | ||
| env: | ||
| HYPERFRAMES_BROWSER_PATH: ${{ matrix.flavour == 'pin' && steps.pin.outputs.path || steps.workspace.outputs.headless-shell-path }} | ||
| HF_BLUR_SEEDS: ${{ matrix.chunk.seeds }} | ||
| HF_BLUR_FAILURES_FILE: ${{ github.workspace }}/blur-nightly-failures.json | ||
| HF_BLUR_REQUIRED: "1" | ||
| run: bunx vitest run --project browser src/services/captureMotionBlur.generated.browser.test.ts | ||
| - name: Keep the failing seeds | ||
| if: always() | ||
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | ||
| with: | ||
| name: blur-nightly-failures-${{ matrix.flavour }}-${{ matrix.chunk.id }} | ||
| path: blur-nightly-failures.json | ||
| if-no-files-found: ignore | ||
|
|
||
| report: | ||
| name: Report failures | ||
| needs: [plan, generated] | ||
| if: always() && needs.plan.result == 'success' | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| permissions: | ||
| contents: read | ||
| issues: write | ||
| steps: | ||
| - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 | ||
| continue-on-error: true | ||
| with: | ||
| pattern: blur-nightly-failures-* | ||
| path: failures | ||
| - name: Open issues, warn and summarize | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| GH_REPO: ${{ github.repository }} | ||
| GENERATED_RESULT: ${{ needs.generated.result }} | ||
| RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
| run: >- | ||
| node scripts/ci/motion-blur-nightly-report.mjs | ||
| --failures failures | ||
| --generated-result "$GENERATED_RESULT" | ||
| --date "$(date -u +%F)" | ||
| --run-url "$RUN_URL" | ||
| --summary "$GITHUB_STEP_SUMMARY" | ||
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
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
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
94 changes: 94 additions & 0 deletions
94
packages/engine/src/services/__fixtures__/motionBlur/generate.test.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| import { describe, expect, it } from "vitest"; | ||
| import { | ||
| EXCLUDED_FEATURES, | ||
| FEATURES, | ||
| generateComposition, | ||
| parseSeeds, | ||
| type Feature, | ||
| } from "./generate.js"; | ||
|
|
||
| const SEEDS = parseSeeds("1-200"); | ||
|
|
||
| const GSAP_SCRIPT = /<script>\/\*![\s\S]*?<\/script>/; | ||
|
|
||
| const withoutMatches = (text: string, pattern: RegExp): string => { | ||
| let current = text; | ||
| for ( | ||
| let next = current.replace(pattern, ""); | ||
| next !== current; | ||
| next = current.replace(pattern, "") | ||
| ) { | ||
| current = next; | ||
| } | ||
| return current; | ||
| }; | ||
|
|
||
| const visibleText = (html: string): string => | ||
| withoutMatches(withoutMatches(html, /<(script|style)[\s\S]*?<\/\1>/g), /<[^>]*>/g).trim(); | ||
|
|
||
| describe("generateComposition", () => { | ||
| it("is deterministic per seed", () => { | ||
| for (const seed of [1, 17, 200]) { | ||
| const a = generateComposition(seed); | ||
| const b = generateComposition(seed); | ||
| expect(b.features).toEqual(a.features); | ||
| expect(b.name).toBe(a.name); | ||
| expect(b.checkpoints).toEqual(a.checkpoints); | ||
| expect(b.html("on")).toBe(a.html("on")); | ||
| expect(b.html("off")).toBe(a.html("off")); | ||
| } | ||
| }); | ||
|
|
||
| it("varies with the seed", () => { | ||
| const documents = new Set(SEEDS.map((seed) => generateComposition(seed).html("on"))); | ||
| expect(documents.size).toBeGreaterThan(150); | ||
| }); | ||
|
|
||
| it("uses every feature within 200 seeds", () => { | ||
| const seen = new Set<Feature>(); | ||
| for (const seed of SEEDS) | ||
| for (const feature of generateComposition(seed).features) seen.add(feature); | ||
| expect([...FEATURES].filter((feature) => !seen.has(feature))).toEqual([]); | ||
| }); | ||
|
|
||
| it("holds each composition to 1 to 4 features at 320x180, 2 s, 30 fps", () => { | ||
| for (const seed of SEEDS) { | ||
| const f = generateComposition(seed); | ||
| expect(f.features.length).toBeGreaterThanOrEqual(1); | ||
| expect(f.features.length).toBeLessThanOrEqual(4); | ||
| expect(new Set(f.features).size).toBe(f.features.length); | ||
| expect([f.width, f.height, f.durationSeconds, f.fps, f.dpr]).toEqual([320, 180, 2, 30, 1]); | ||
| expect(f.checkpoints).toHaveLength(2); | ||
| expect(f.moving).toHaveLength(1); | ||
| expect(f.name).toBe(`seed ${seed} [${f.features.join(", ")}]`); | ||
| } | ||
| }); | ||
|
|
||
| it("keeps the features known wrong on the filter tier out", () => { | ||
| expect(EXCLUDED_FEATURES).toEqual({ ownClipPath: "E", visibilityToggle: "O" }); | ||
| for (const seed of SEEDS) { | ||
| const html = generateComposition(seed).html("on").replace(GSAP_SCRIPT, ""); | ||
| expect(html).not.toMatch(/#card[^{]*\{[^}]*(clip-path|mask)/); | ||
| expect(html).not.toMatch(/visibility/); | ||
| } | ||
| }); | ||
|
|
||
| it("draws no text", () => { | ||
| for (const seed of SEEDS) expect(visibleText(generateComposition(seed).html("on"))).toBe(""); | ||
| }); | ||
|
|
||
| it("pins no tier on the blur-on page", () => { | ||
| for (const seed of [1, 2, 3]) { | ||
| expect(generateComposition(seed).html("on")).not.toContain("data-motion-blur-tier"); | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| describe("parseSeeds", () => { | ||
| it("reads lists and ranges", () => { | ||
| expect(parseSeeds("1,2,3")).toEqual([1, 2, 3]); | ||
| expect(parseSeeds("5-8")).toEqual([5, 6, 7, 8]); | ||
| expect(parseSeeds("4,10-11")).toEqual([4, 10, 11]); | ||
| expect(() => parseSeeds("x")).toThrow("bad seed list"); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit — This checkout also runs third-party code (
bunxvitest and@puppeteer/browsers). Addpersist-credentials: falsehere as well, so thecontents: readtoken isn't left in.git/configwhile the job runs. The repo is public, so the risk is low, but this would match the report job.