Repository navigation
Add an opt-in screenshot hook for feature specs - #442
Draft
cycomachead wants to merge 1 commit into
Draft
cycomachead wants to merge 1 commit into
cycomachead wants to merge 1 commit into
Conversation
With SCREENSHOTS=1, every feature spec runs in a 1280-wide headless Chrome and saves full-page screenshots to tmp/screenshots, named by spec, example and route. A page is captured just before the spec navigates away and once more when the example ends. The hook waits for in-flight jQuery requests first: leaving a page while its DataTable is still loading raises an "Ajax error" alert that breaks the browser session. Faker, rand, factory sequences, SecureRandom short titles and the clock are pinned so two runs mostly match. Without the flag the suite is unchanged. Co-Authored-By: Claude Fable 5.2 <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.
Summary
Adds
spec/support/screenshots.rb, the first step of the visual regression plan in #441.SCREENSHOTS=1 bundle exec rspec spec/featuresWith the flag set, every feature spec runs in a 1280×900 headless Chrome and saves full-page screenshots to
tmp/screenshots(orSCREENSHOT_DIR), named<spec file>/<example>/<NN>-<controller>-<action>.png. Without the flag, the file does nothing and the suite runs as before.How it works
visit,click_link,click_button,click_on) and once more when the example ends.rand, factory sequences,SecureRandom.urlsafe_base64and the clock are pinned per example.Why this is a draft
Measured locally with two full runs of the feature suite in screenshot mode:
admin/events#index,admin/rolesandadmin/tracks#index. The causes have not been looked at yet.rack_test: unaccepted delete confirmations, and flash messages or record changes that do not appear after a form submit (venues_spec,tickets_spec,event_types_spec,resource_spec).event_schedules_spec.rb:41fails once time is frozen, and a few others come and go.Nothing runs this in CI yet.
Testing
spec/features/lodgings_spec.rbpasses with the hook file present (3 examples, 0 failures).rubocop spec/support/screenshots.rbis clean.🤖 Generated with Claude Code