Ensure animation screenshot test walks back nested forms#4083
Ensure animation screenshot test walks back nested forms#4083shai-almog wants to merge 10 commits intomasterfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| private void captureAnimationFrames(Demo demo, Form form) throws IOException { | ||
| String sanitized = sanitizeFileName(demo.getTitle()); | ||
| String baseKey = storageKeyFor(demo.getTitle()); | ||
| boolean baseSaved = false; | ||
| List<String> frameKeys = new ArrayList<>(FRAMES_PER_ANIMATION); | ||
| Image finalFrameImage = null; | ||
|
|
||
| for (int frameIndex = 0; frameIndex < FRAMES_PER_ANIMATION; frameIndex++) { | ||
| if (!isAnimating(form) && frameIndex == 0) { | ||
| break; | ||
| } | ||
|
|
||
| Image frameImage = capture(form); | ||
| if (!baseSaved) { | ||
| saveScreenshot(baseKey, frameImage); | ||
| baseSaved = true; | ||
| } | ||
|
|
||
| String frameKey = stageStorageKeyFor(sanitized, frameIndex); | ||
| saveScreenshot(frameKey, frameImage); | ||
| frameKeys.add(frameKey); | ||
| finalFrameImage = frameImage; | ||
|
|
||
| if (frameIndex >= FRAMES_PER_ANIMATION - 1) { | ||
| break; | ||
| } | ||
|
|
||
| if (!advanceAnimation(form)) { | ||
| finalFrameImage = capture(form); | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| if (!baseSaved) { | ||
| Image screenshot = capture(form); | ||
| saveScreenshot(baseKey, screenshot); | ||
| finalFrameImage = screenshot; | ||
| } | ||
|
|
||
| if (finalFrameImage == null) { | ||
| finalFrameImage = capture(form); | ||
| } | ||
|
|
||
| while (frameKeys.size() < FRAMES_PER_ANIMATION) { | ||
| String frameKey = stageStorageKeyFor(sanitized, frameKeys.size()); | ||
| saveScreenshot(frameKey, finalFrameImage); | ||
| frameKeys.add(frameKey); | ||
| } | ||
|
|
||
| if (!frameKeys.isEmpty()) { | ||
| recordFrameManifest(sanitized, frameKeys); |
There was a problem hiding this comment.
Frame capture produces unmatched screenshots
The new code captures animation sequences by writing developer-guide.animations.<title>-frame-*.png files and a manifest for each demo, but the workflow that follows (.github/scripts/compare-animation-screenshots.sh) still diffs every PNG in the storage directory against docs/developer-guide/img. No baseline assets exist for these newly produced frame images, so every run will report “No baseline found for …” and mark the job as failed even though the frames are expected. Either update the comparison script to skip or specially handle *-frame-*.png files (e.g. consult the manifest) or add matching baseline images, otherwise the CI build will consistently fail after this change.
Useful? React with 👍 / 👎.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_68fe3b8b4ef483319f960dd8db55bc8f