-
Notifications
You must be signed in to change notification settings - Fork 0
chore(ci): import-cycle ratchet + mobile viewport regression suite #808
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
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
79ef02a
chore(ci): import-cycle ratchet + mobile viewport regression suite
claude 5be6490
chore(ci): run public mobile viewport checks on PRs via pr-smoke
claude 32a9e72
fix(ci): single dev-server lifecycle for mobile suite + fail-loud bot…
claude 915c110
fix(ci): madge API over CLI, skipped-file ratchet, shared bottom-nav …
615db04
fix(ci): single dev-server lifecycle in pr-smoke's a11y + mobile steps
f1aa62a
Merge branch 'main' into chore/ci-guardrails-cycles-mobile
njrini99-code cd9494f
fix(ci): fail fast when the pr-smoke dev server dies during startup
2ca1475
fix(e2e): tabs join the clipping scan; public routes assert final pat…
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
Some comments aren't visible on the classic Files Changed page.
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,35 @@ | ||
| [ | ||
| "app/golf/actions/stats-data.ts > lib/golf/detailed-stats-admin-bridge.ts", | ||
| "components/baseball/living-annual/index.ts > components/baseball/living-annual/molecules/index.ts > components/baseball/living-annual/molecules/CoverHero.tsx", | ||
| "components/baseball/living-annual/index.ts > components/baseball/living-annual/molecules/index.ts > components/baseball/living-annual/molecules/EmptyIssue.tsx", | ||
| "components/baseball/living-annual/index.ts > components/baseball/living-annual/molecules/index.ts > components/baseball/living-annual/molecules/GradeStampGrid.tsx", | ||
| "components/baseball/living-annual/index.ts > components/baseball/living-annual/molecules/index.ts > components/baseball/living-annual/molecules/KPIContentsStrip.tsx", | ||
| "components/baseball/living-annual/index.ts > components/baseball/living-annual/molecules/index.ts > components/baseball/living-annual/molecules/PlayerRowPlate.tsx", | ||
| "components/baseball/living-annual/index.ts > components/baseball/living-annual/molecules/index.ts > components/baseball/living-annual/molecules/RecruitCard.tsx", | ||
| "components/baseball/living-annual/index.ts > components/baseball/living-annual/molecules/index.ts > components/baseball/living-annual/molecules/SlashLine.tsx", | ||
| "components/baseball/living-annual/index.ts > components/baseball/living-annual/molecules/index.ts > components/baseball/living-annual/molecules/StatLineStack.tsx", | ||
| "components/baseball/living-annual/index.ts > components/baseball/living-annual/molecules/index.ts > components/baseball/living-annual/molecules/TearSheet.tsx", | ||
| "components/baseball/living-annual/index.ts > components/baseball/living-annual/molecules/index.ts > components/baseball/living-annual/molecules/ToolRailStack.tsx", | ||
| "components/baseball/stat-visuals/StatVisualsSection.tsx > components/baseball/stat-visuals/index.ts", | ||
| "components/fairway/cards-insight/themes/CauseRow.tsx > components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/FairwayPlayerCoachHelm.tsx > components/fairway/cards-insight/themes/index.ts", | ||
| "components/fairway/cards-insight/themes/ThemeCard.tsx > components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/FairwayPlayerCoachHelm.tsx > components/fairway/cards-insight/themes/index.ts", | ||
| "components/fairway/cards-insight/themes/ThemesPanel.tsx > components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/FairwayPlayerCoachHelm.tsx > components/fairway/cards-insight/themes/index.ts", | ||
| "components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/FairwayBrief.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/FairwayEffectiveness.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/FairwayMyDevelopment.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/FairwayMyDevelopment.tsx > components/fairway/pages/coachhelm/CausalWhyPanel.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/FairwayMyDevelopment.tsx > components/fairway/pages/coachhelm/FocusAreaCard.tsx > components/fairway/pages/coachhelm/PracticeRxForInsight.tsx > components/fairway/pages/coachhelm/PracticeRxPanel.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/FairwayMyDevelopment.tsx > components/fairway/pages/coachhelm/GoalsSection.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/FairwayMyDevelopment.tsx > components/fairway/pages/coachhelm/GoalsSection.tsx > components/fairway/pages/coachhelm/FairwayGoalCard.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/FairwayPlayerCoachHelm.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/GenomeCompareView.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/GenomeDetailView.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/PlayersGridView.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/dashboard/index.ts > components/fairway/pages/dashboard/FairwayPlayerDashboard.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/dashboard/index.ts > components/fairway/pages/dashboard/FairwayPlayerDashboard.tsx > components/fairway/pages/dashboard/PlayerActionCenter.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/dashboard/index.ts > components/fairway/pages/dashboard/FairwayPlayerDashboard.tsx > components/fairway/pages/dashboard/PlayerActionCenter.tsx > components/fairway/pages/dashboard/player-dashboard-parts.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/dashboard/index.ts > components/fairway/pages/dashboard/FairwayPlayerDashboard.tsx > components/fairway/pages/dashboard/PlayerActionCenter.tsx > components/fairway/pages/hub/hub-parts.tsx", | ||
| "components/fairway/pages/coachhelm/FairwayBrief.tsx > components/fairway/pages/coachhelm/index.ts", | ||
| "components/golf/coachhelm/insights/DiagnosisPanel.tsx > components/golf/coachhelm/insights/EvidencePanel.tsx", | ||
| "lib/admin/data/incident-feed.ts > lib/admin/data/triage.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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "fileExtensions": ["ts", "tsx"], | ||
| "tsConfig": "tsconfig.json", | ||
| "detectiveOptions": { | ||
| "ts": { "skipTypeImports": true }, | ||
| "tsx": { "skipTypeImports": true } | ||
| } | ||
| } |
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,169 @@ | ||
| import { test, expect, type Page } from '@playwright/test'; | ||
|
|
||
| /** | ||
| * Mobile viewport regression suite. | ||
| * | ||
| * Encodes the phone-width defect classes that have repeatedly shipped and | ||
| * been fixed by hand (PR #799 FAB/bottom-nav collisions, PR #806 calendar | ||
| * "Today" pill clipped at 390px) as functional assertions at real device | ||
| * widths, per docs/MOBILE_DOCTRINE.md: | ||
| * | ||
| * 1. No horizontal page pan — the page never scrolls sideways. | ||
| * 2. No partially-clipped header/nav controls — a control that is visible | ||
| * but cut off by the viewport edge (the #806 class). Fully off-screen | ||
| * elements are ignored: closed drawers/sheets legitimately park at | ||
| * translateX(100%). | ||
| * 3. No fixed element overlapping the bottom navigation (the #799 class). | ||
| * | ||
| * Projects (see playwright.config.ts): `mobile-public` runs unauthenticated; | ||
| * `mobile-coach` / `mobile-player` reuse the CI-seeded baseball storageState | ||
| * from the `setup` project, same as the mandatory smoke suite. | ||
| */ | ||
|
|
||
| const VIEWPORTS = [ | ||
| { width: 320, height: 568 }, | ||
| { width: 390, height: 844 }, | ||
| { width: 430, height: 932 }, | ||
| ] as const; | ||
|
|
||
| const PUBLIC_ROUTES = ['/', '/golf/login', '/baseball/login']; | ||
|
|
||
| const COACH_ROUTES = [ | ||
| '/baseball/dashboard/command-center', | ||
| '/baseball/dashboard/calendar', | ||
| '/baseball/dashboard/roster', | ||
| '/baseball/dashboard/stats-center', | ||
| '/baseball/dashboard/settings', | ||
| ]; | ||
|
|
||
| const PLAYER_ROUTES = [ | ||
| '/baseball/player/today', | ||
| '/baseball/dashboard/calendar', | ||
| '/baseball/dashboard/roster', | ||
| '/baseball/dashboard/my-stats', | ||
| ]; | ||
|
|
||
| async function gotoSettled(page: Page, route: string): Promise<void> { | ||
| // Reduced motion stabilizes geometry: entrance animations otherwise leave | ||
| // elements mid-transform when we measure. | ||
| await page.emulateMedia({ reducedMotion: 'reduce' }); | ||
| await page.goto(route, { waitUntil: 'domcontentloaded' }); | ||
| await page.waitForLoadState('networkidle', { timeout: 8000 }).catch(() => {}); | ||
| await page.waitForTimeout(250); | ||
| } | ||
|
|
||
| async function expectNoHorizontalPan(page: Page, route: string): Promise<void> { | ||
| const { scrollWidth, innerWidth } = await page.evaluate(() => ({ | ||
| scrollWidth: document.documentElement.scrollWidth, | ||
| innerWidth: window.innerWidth, | ||
| })); | ||
| expect | ||
| .soft(scrollWidth, `${route}: page pans horizontally (scrollWidth ${scrollWidth} > viewport ${innerWidth})`) | ||
| .toBeLessThanOrEqual(innerWidth + 1); | ||
| } | ||
|
|
||
| async function expectNoClippedControls(page: Page, route: string): Promise<void> { | ||
| const clipped = await page.evaluate(() => { | ||
| const offenders: string[] = []; | ||
| const containers = Array.from( | ||
| document.querySelectorAll('header, nav, [role="navigation"], [role="toolbar"]'), | ||
| ); | ||
| const seen = new Set<Element>(); | ||
| for (const container of containers) { | ||
| for (const el of Array.from(container.querySelectorAll('a, button, [role="button"]'))) { | ||
|
njrini99-code marked this conversation as resolved.
Outdated
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| if (seen.has(el)) continue; | ||
| seen.add(el); | ||
| const r = el.getBoundingClientRect(); | ||
| if (r.width === 0 || r.height === 0) continue; | ||
| if (r.bottom < 0 || r.top > window.innerHeight) continue; | ||
| // Only flag PARTIAL clipping: visible in the viewport but cut off at | ||
| // an edge. Fully off-screen = intentional off-canvas UI, not a bug. | ||
| const partiallyVisible = r.left < window.innerWidth && r.right > 0; | ||
| const cutRight = r.right > window.innerWidth + 1 && r.left < window.innerWidth - 8; | ||
| const cutLeft = r.left < -1 && r.right > 8; | ||
| if (partiallyVisible && (cutRight || cutLeft)) { | ||
| const label = (el.textContent || el.getAttribute('aria-label') || el.tagName) | ||
| .trim() | ||
| .slice(0, 40); | ||
| offenders.push(`"${label}" [left ${Math.round(r.left)}, right ${Math.round(r.right)}] vs viewport ${window.innerWidth}`); | ||
| } | ||
| } | ||
| } | ||
| return offenders; | ||
| }); | ||
| expect.soft(clipped, `${route}: header/nav controls clipped at viewport edge`).toEqual([]); | ||
| } | ||
|
|
||
| async function expectNoBottomNavCollision(page: Page, route: string): Promise<void> { | ||
| const collisions = await page.evaluate(() => { | ||
| const fixedEls: Element[] = []; | ||
| for (const el of Array.from(document.body.querySelectorAll('*'))) { | ||
| const style = getComputedStyle(el); | ||
| if (style.position !== 'fixed') continue; | ||
| if (style.pointerEvents === 'none') continue; // toast portals, inset-0 wrappers | ||
| const r = el.getBoundingClientRect(); | ||
| if (r.width === 0 || r.height === 0) continue; | ||
| fixedEls.push(el); | ||
| } | ||
| const bottomNav = fixedEls.find((el) => { | ||
| const isNav = el.tagName === 'NAV' || el.getAttribute('role') === 'navigation' || el.querySelector('nav') !== null; | ||
| const r = el.getBoundingClientRect(); | ||
| return isNav && r.top > window.innerHeight - 140 && r.width > window.innerWidth * 0.6; | ||
| }); | ||
|
njrini99-code marked this conversation as resolved.
Outdated
|
||
| if (!bottomNav) return []; | ||
| const navRect = bottomNav.getBoundingClientRect(); | ||
| const offenders: string[] = []; | ||
| for (const el of fixedEls) { | ||
| if (el === bottomNav || bottomNav.contains(el) || el.contains(bottomNav)) continue; | ||
| const r = el.getBoundingClientRect(); | ||
| const overlapX = Math.min(r.right, navRect.right) - Math.max(r.left, navRect.left); | ||
| const overlapY = Math.min(r.bottom, navRect.bottom) - Math.max(r.top, navRect.top); | ||
| if (overlapX > 8 && overlapY > 8) { | ||
| const label = (el.getAttribute('aria-label') || el.textContent || el.className.toString()) | ||
| .trim() | ||
| .slice(0, 40); | ||
| offenders.push(`"${label}" overlaps bottom nav by ${Math.round(overlapX)}×${Math.round(overlapY)}px`); | ||
| } | ||
| } | ||
| return offenders; | ||
| }); | ||
| expect.soft(collisions, `${route}: fixed element collides with bottom navigation`).toEqual([]); | ||
| } | ||
|
|
||
| async function expectMobileFit(page: Page, route: string): Promise<void> { | ||
| await gotoSettled(page, route); | ||
| await expectNoHorizontalPan(page, route); | ||
| await expectNoClippedControls(page, route); | ||
| await expectNoBottomNavCollision(page, route); | ||
| } | ||
|
|
||
| for (const viewport of VIEWPORTS) { | ||
| test.describe(`public routes @ ${viewport.width}px`, { tag: '@public' }, () => { | ||
| test.use({ viewport }); | ||
| for (const route of PUBLIC_ROUTES) { | ||
| test(`${route} fits ${viewport.width}px`, async ({ page }) => { | ||
| await expectMobileFit(page, route); | ||
| }); | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| } | ||
| }); | ||
|
|
||
| test.describe(`baseball coach routes @ ${viewport.width}px`, { tag: '@coach' }, () => { | ||
| test.use({ viewport }); | ||
| for (const route of COACH_ROUTES) { | ||
| test(`${route} fits ${viewport.width}px (coach)`, async ({ page }) => { | ||
| await expectMobileFit(page, route); | ||
| expect(page.url(), `expected ${route} to render without bouncing to /login`).not.toContain('/login'); | ||
| }); | ||
|
njrini99-code marked this conversation as resolved.
|
||
| } | ||
| }); | ||
|
|
||
| test.describe(`baseball player routes @ ${viewport.width}px`, { tag: '@player' }, () => { | ||
| test.use({ viewport }); | ||
| for (const route of PLAYER_ROUTES) { | ||
| test(`${route} fits ${viewport.width}px (player)`, async ({ page }) => { | ||
| await expectMobileFit(page, route); | ||
| expect(page.url(), `expected ${route} to render without bouncing to /login`).not.toContain('/login'); | ||
| }); | ||
| } | ||
| }); | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.