feat(visual-regression): testes visuais para todos os fields#2792
Open
alinelariguet wants to merge 10 commits intomasterfrom
Open
feat(visual-regression): testes visuais para todos os fields#2792alinelariguet wants to merge 10 commits intomasterfrom
alinelariguet wants to merge 10 commits intomasterfrom
Conversation
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
feat(visual-regression): testes visuais para todos os fields
Summary
Adds Playwright-based visual regression testing for all 20 field components with multiple state combinations, plus 11 basic sample-based tests for non-field components.
What's included:
visual-appine2e/visual/app/) that renders components in isolation — separate from the existingprojects/app/e2e/visual/fields/po-{component}/, each with co-located HTML template, TypeScript component, and Playwright spectest-visual) with po-style branch detection, multi-layer caching, baseline generation, and HTML report + diff artifact uploadsplaywright.config.tswithtoHaveScreenshot()comparison (1% pixel diff tolerance, 5% for po-rich-text disabled)test:visual,test:visual:update,test:visual:report/listing all 20 field test scenarios and 12 sample component routes as clickable cardsComponents covered: po-input, po-decimal, po-email, po-login, po-number, po-password, po-url, po-combo, po-datepicker, po-datepicker-range, po-lookup, po-multiselect, po-select, po-textarea, po-rich-text, po-upload, po-checkbox, po-checkbox-group, po-switch, po-radio-group
CI Efficiency Optimizations
Phase 1:
node_modulesviaactions/cache@v4keyed onhashFiles('package.json')—npm iskipped on cache hit~/.cache/ms-playwright) — split into system deps (install-deps, always runs) and browser binary (install, skipped on cache hit)@po-ui/stylefrom npm when cache hits but no matching po-style branch existsrestore-keys— on cache miss, uses--update-snapshots(force-regenerate all) to avoid cross-environment baseline mismatchPhase 2:
dorny/paths-filter@v3— visual tests only run on PRs that touch relevant files (e2e/visual/**,projects/ui/src/lib/**,package.json,playwright.config.ts,angular.json,ci.yml). Always runs on push to master/development viaalways() && !cancelled().dist/ng-componentscached keyed onhashFiles('projects/ui/src/**', 'package.json')Estimated time savings: From ~5.7min to ~1.5min when all caches hit (~74% reduction). PRs not touching visual-relevant files skip the job entirely.
Review & Testing Checklist for Human
test-visualjob usesalways() && !cancelled()to run on push events even when thechangesjob is skipped. Verify that visual tests actually execute on direct pushes to master/development (cannot be tested from a PR context). If they don't run, thealways()workaround may not be sufficient.package.json(notpackage-lock.jsonsince it's gitignored). Transitive dependency updates won't invalidate cache. UI build cache keyed onhashFiles('projects/ui/src/**', 'package.json')— changes totsconfig.lib.jsonorng-package.jsonwon't invalidate. Monitor for stale artifacts.e2e/visual/**,projects/ui/src/lib/**,package.json,playwright.config.ts,angular.json,ci.yml. Changes to roottsconfig.jsonor global styles won't trigger visual tests. Verify scope is appropriate.test-visualjob: confirm (a) caches hit as expected, (b) execution time decreased vs. baseline, (c) on a PR without visual changes, job is skipped.Notes
<textarea>). Baselines cache ensures cross-run consistency.po-rich-textdisabled state uses 5% tolerance vs. global 1% due to minor rendering variationsactions/checkout@v3andactions/setup-node@v3(Node.js 20) — warnings in logs; consider v4 upgrade in follow-upVisualHomeComponent) uses inline styles andonmouseover/onmouseoutinstead of Angular best practices — acceptable for test utility pagedorny/paths-filter@v3added for change detection — ensure your org's security policies allow third-party actionsDevin Session: https://totvs.devinenterprise.com/sessions/5c85ab5d7935486484961f45a8077db3
Requested by: @alinelariguet