Skip to content

Fix hero demo#257

Merged
yamcodes merged 17 commits intomainfrom
demo.mp4
Nov 2, 2025
Merged

Fix hero demo#257
yamcodes merged 17 commits intomainfrom
demo.mp4

Conversation

@yamcodes
Copy link
Owner

@yamcodes yamcodes commented Nov 1, 2025

Closes #254


Note

Replaces the hero demo video with next-video (Mux-backed) and adds the required config, scripts, typings, and assets.

  • UI:
    • Replace custom <video> with next-video/background-video in components/page/video-demo.tsx, importing ~/videos/demo.mp4 with fallback to next/image.
  • Build/Config:
    • Wrap Next config with withNextVideo in apps/www/next.config.ts.
    • Add next-video dev workflow: update dev script to run next-video sync -w.
    • Add video.d.ts and include in tsconfig.json.
    • Update provider import to fumadocs-ui/provider/next in app/layout.tsx.
  • Assets:
    • Add Mux metadata files videos/demo.mp4.json and videos/get-started.mp4.json.
    • Update .gitignore to track only videos/*.json|.js|.ts and ignore generated public/_next-video.

Written by Cursor Bugbot for commit e7f3d44. This will update automatically on new commits. Configure here.

Summary by CodeRabbit

  • New Features

    • Interactive video demo added with a robust fallback to a static image when playback fails
  • Improvements

    • Better video playback reliability and error handling
    • Improved accessibility handling for decorative images in interactive contexts
  • Tests

    • Expanded automated test coverage for the demo, playback fallbacks, and accessibility scenarios
    • Reduced noisy test-console errors by filtering known media library messages

- Added `next-video` version 2.5.0 to `package.json` and updated the development command to include video synchronization.
- Configured TypeScript to recognize video types by adding `video.d.ts`.
- Updated `.gitignore` to manage video files while allowing specific formats.
- Created a sample video metadata file for `get-started.mp4` to facilitate video handling.

This commit enhances the project's video capabilities and ensures proper type support for video-related features.
- Updated import path for RootProvider to use the next version.
- Integrated `next-video` for background video playback, replacing the previous video element.
- Added support for a demo video file and adjusted dimensions for the video and fallback image.

This commit enhances the video playback experience and ensures proper integration with the latest video handling libraries.
@changeset-bot
Copy link

changeset-bot bot commented Nov 1, 2025

⚠️ No Changeset found

Latest commit: b781e58

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Nov 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
arkenv Ready Ready Preview Comment Nov 2, 2025 4:56pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 1, 2025

Warning

Rate limit exceeded

@yamcodes has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 0 minutes and 0 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 3e07748 and b781e58.

📒 Files selected for processing (1)
  • apps/www/components/page/video-demo.tsx (2 hunks)

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Integrates next-video: replaces native video with BackgroundVideo, adds next-video build/dev tooling and types, provides a Mux-backed demo video descriptor, updates tests/mocks and Playwright checks to handle HLS behaviors and fallback image flows, and adds test setup utilities.

Changes

Cohort / File(s) Summary
Config & deps
apps/www/next.config.ts, apps/www/package.json, apps/www/.gitignore, apps/www/tsconfig.json, apps/www/video.d.ts
Wrap Next config with withNextVideo, add next-video and concurrently, update dev script to run next-video sync, ignore video assets while re-allowing descriptor files, include video.d.ts and reference next-video global types.
Video asset
apps/www/videos/demo.mp4.json
New Mux-based JSON descriptor for demo MP4 (playback IDs, HLS src, poster, blurDataURL, metadata).
Component
apps/www/components/page/video-demo.tsx
Replace HTML5 <video> with BackgroundVideo, import demo asset, use Next Image for poster/fallback, wire BackgroundVideo onError to existing handler and keep external demo-open behavior.
Unit tests & test setup
apps/www/components/page/video-demo.test.tsx, apps/www/tests/setup.ts
Add mocks for next/image and next-video/background-video, mock global fetch, add global ResizeObserver and matchMedia mocks, update tests to assert video attributes and fallback flows, and guard error events.
E2E helpers & tests
tooling/playwright-www/tests/utils/console-errors.ts, tooling/playwright-www/tests/accessibility.test.ts, tooling/playwright-www/tests/homepage.test.ts
Extend console-errors filtering to ignore HLS.js-specific messages, refine accessibility check to permit decorative images in labeled/interactive ancestors, and change homepage test to accept either interactive video or fallback image with conditional assertions.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant VideoDemo
    participant BackgroundVideo
    participant Mux
    participant Fallback

    rect #dbeef7
    Note over VideoDemo,BackgroundVideo: New flow using next-video + Mux
    User->>VideoDemo: mount
    VideoDemo->>BackgroundVideo: mount with demo metadata & onError
    BackgroundVideo->>Mux: request HLS via playbackId
    alt success
        Mux-->>BackgroundVideo: playlist & segments
        BackgroundVideo-->>User: play (autoplay, loop, muted)
    else failure
        Mux-->>BackgroundVideo: error
        BackgroundVideo->>VideoDemo: onError
        VideoDemo->>Fallback: render fallback image (/assets/demo.gif)
        Fallback-->>User: show image
    end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–30 minutes

  • Review BackgroundVideo usage and onError wiring in video-demo.tsx.
  • Verify unit test mocks accurately reflect next-video and Next Image behavior.
  • Check Playwright console filter changes for over-broad suppression.

Possibly related PRs

Suggested reviewers

  • yamcodes

Poem

🐇 I hopped into code with a cheerful twitch,
Piped Mux streams in, wrapped with next-video's stitch.
BackgroundVideo hums, poster gleams bright,
If HLS trips, a GIF hops in to delight.
Tests clap their paws — the demo's back in sight!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive The title "Fix hero demo" is vague and generic, using non-descriptive phrasing that doesn't convey the substantial nature of the changes. While it is related to the actual changeset (which addresses the demo video issue), the title fails to communicate the core technical work involved: migrating from a custom video component to next-video with Mux integration, updating configuration files, adding typings, and refactoring tests. The PR description clarifies this was a "comprehensive refactoring," but the title alone doesn't indicate the scope or specificity of what was actually changed. Consider revising the title to be more descriptive and specific, such as "Migrate hero demo to next-video with Mux integration" or "Replace custom video component with next-video/background-video using Mux hosting." This would better communicate the primary technical change to reviewers scanning the commit history.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues Check ✅ Passed The pull request successfully addresses the main coding objectives from issue #254. The changeset migrates the hero demo video to Mux [#254], with demo.mp4.json providing complete Mux playback metadata (uploadId, assetId, playbackId, and HLS stream URL) [#254]. The VideoDemo component is updated to use next-video/background-video [#254], and the necessary configuration and tooling support has been added: next-video wrapper in next.config.ts, dev script updated with concurrently and next-video sync workflow, video.d.ts created with type references, and .gitignore configured to handle video assets appropriately [#254]. Tests have been updated to reflect the new component structure and video behavior.
Out of Scope Changes Check ✅ Passed All changes in the pull request are directly related to the objective of migrating hero.mp4 to Mux using next-video integration. Configuration changes (next.config.ts, package.json, tsconfig.json, video.d.ts) and the new video metadata asset (videos/demo.mp4.json) directly support this migration. The component refactoring (video-demo.tsx) and unit test updates (video-demo.test.tsx) are necessary to implement the new video behavior. The supporting changes to test infrastructure (setup.ts for ResizeObserver and matchMedia mocks, console-errors.ts for HLS.js error filtering, accessibility.test.ts for decorative image handling, and homepage.test.ts for video validation) are all essential for properly testing the new video integration and HLS stream delivery.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added the www Improvements or additions to arkenv.js.org label Nov 1, 2025
cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Nitpick comments (1)
apps/www/components/page/video-demo.tsx (1)

8-9: Consider passing HEIGHT to BackgroundVideo for consistency.

The HEIGHT constant is defined but only used for the Image fallback, not for BackgroundVideo. This asymmetry could potentially cause layout shifts or aspect ratio issues during the transition from video to fallback image.

Apply this diff to pass height to BackgroundVideo:

 				) : (
 					<BackgroundVideo
 						src={demo}
 						width={WIDTH}
+						height={HEIGHT}
 						onError={handleVideoError}
 					/>
 				)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f7934c7 and e7f3d44.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (9)
  • apps/www/.gitignore (1 hunks)
  • apps/www/app/layout.tsx (1 hunks)
  • apps/www/components/page/video-demo.tsx (2 hunks)
  • apps/www/next.config.ts (2 hunks)
  • apps/www/package.json (2 hunks)
  • apps/www/tsconfig.json (1 hunks)
  • apps/www/video.d.ts (1 hunks)
  • apps/www/videos/demo.mp4.json (1 hunks)
  • apps/www/videos/get-started.mp4.json (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-09-12T06:23:45.463Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-12T06:23:45.463Z
Learning: Applies to **/*.test.ts : Place tests alongside source files and use the .test.ts suffix (e.g., create-env.test.ts, types.test.ts, errors.test.ts, utils.test.ts)

Applied to files:

  • apps/www/tsconfig.json
  • apps/www/.gitignore
📚 Learning: 2025-09-12T06:23:45.463Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-12T06:23:45.463Z
Learning: Applies to **/*.test.ts : Mock process.env to cover different environment scenarios in tests

Applied to files:

  • apps/www/.gitignore
🧬 Code graph analysis (2)
apps/www/components/page/video-demo.tsx (1)
apps/www/components/page/video-demo.test.tsx (9)
  • render (244-261)
  • render (56-63)
  • render (152-163)
  • render (25-42)
  • render (217-242)
  • render (188-198)
  • render (175-186)
  • render (165-173)
  • render (65-84)
apps/www/videos/demo.mp4.json (1)
apps/www/components/page/video-demo.test.tsx (6)
  • render (175-186)
  • render (56-63)
  • render (44-54)
  • render (25-42)
  • render (165-173)
  • render (152-163)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: test-e2e
  • GitHub Check: Cursor Bugbot
🔇 Additional comments (5)
apps/www/next.config.ts (1)

60-62: LGTM!

The withNextVideo wrapper is correctly applied to the config chain, maintaining the existing Sentry and MDX wrappers.

apps/www/videos/demo.mp4.json (2)

14-14: The Mux video asset is accessible and functional; update metadata size field.

The Mux video is successfully uploaded and playable—both the HLS stream and thumbnail return HTTP 200 responses. However, the size field showing 0 indicates the metadata file wasn't properly regenerated after upload. Update the metadata to reflect the actual video size for consistency, though this doesn't prevent the video from working.


1-23: No action needed—component changes are properly included in this PR.

The component file apps/www/components/page/video-demo.tsx is present and correctly implements all requirements:

  • ✅ Uses BackgroundVideo from next-video/background-video (line 4)
  • ✅ Imports and references the video metadata via import demo from "~/videos/demo.mp4" (line 6)
  • ✅ Properly passes the source to the component with error handling (lines 45-48)

The PR includes the complete implementation.

apps/www/app/layout.tsx (1)

5-5: This import change is necessary for fumadocs-ui v16 with Next.js — no action needed.

The /provider/next import path is required for Next.js-specific usage with fumadocs-ui v16, replacing the older paths from previous versions. This is a legitimate dependency update, not scope creep.

apps/www/components/page/video-demo.tsx (1)

3-6: LGTM! Clean migration to next-video library.

The imports correctly set up the next-video integration with BackgroundVideo and local asset reference. The demo.mp4 import will be resolved to Mux via the accompanying .json metadata file, successfully addressing the Vercel Blob Storage issue.

- Mocked fetch behavior to prevent URL fetch errors during tests.
- Added mocks for Next.js Image component and next-video/background-video to ensure proper rendering and error handling in tests.
- Introduced a ResizeObserver mock and matchMedia mock to support responsive video testing.

These changes improve the reliability of tests related to video components and ensure they function correctly without external dependencies.
@github-actions github-actions bot added the tests This issue or PR is about adding, removing or changing tests label Nov 1, 2025
coderabbitai[bot]

This comment was marked as outdated.

- Updated `vitest` version in `pnpm-lock.yaml` to include `postcss@8.5.6` as a dependency for `jsdom`.
- Added `concurrently` version `9.2.1` to `package.json` to facilitate running multiple commands concurrently in the development script.
- Modified the `dev` script in `package.json` to use `conc` for improved command execution.

These changes enhance the development experience and ensure compatibility with the latest dependencies.
- Deleted the JSON metadata file for the `get-started.mp4` video, which included details such as status, provider metadata, and playback information. This cleanup helps streamline the project by removing unused files.
cursor[bot]

This comment was marked as outdated.

- Added `afterEach` to restore the original fetch implementation after tests to prevent test leakage.
- Updated mock implementations for Next.js Image and next-video/background-video components to ensure proper type handling and prevent fetch errors.
- Changed attribute checks for video elements to use lowercase for HTML compliance.
- Simplified video source validation in tests to ensure a valid source is rendered.

These changes enhance the robustness of the video demo tests and ensure they function correctly without external dependencies.
- Modified the mock implementation for `next-video/background-video` to include a `poster` prop and support forwarding additional props.
- Simplified the video source determination logic to handle both string URLs and asset objects.
- Ensured that the mock reflects the actual behavior of the video component, improving test reliability.

These changes improve the accuracy of the video demo tests and ensure they align with the expected component behavior.
- Adjusted the width to 800 and height to 653 for the BackgroundVideo component to improve layout and responsiveness.
- Removed outdated styling class to streamline the component's appearance.
cursor[bot]

This comment was marked as outdated.

- Improved accessibility checks by filtering out decorative images without alt attributes in the accessibility tests.
- Updated homepage video tests to verify the presence of either a video or a fallback image, ensuring proper attribute checks and visibility.
- Expanded console error assertions to include additional error types for better error handling during tests.

These changes enhance the robustness of accessibility and video component tests, ensuring compliance with best practices.
- Changed the expected width attribute for video and image elements from 958 to 800 in the VideoDemo component tests.
- This adjustment aligns with recent updates to the VideoDemo component, ensuring that tests accurately reflect the current design specifications.
…n navigation, examples, homepage, integrations, morphs, quickstart, and search functionality

- Deleted multiple test files that were no longer needed, streamlining the test suite and reducing maintenance overhead.
- This cleanup helps focus on relevant tests and improves overall project organization.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (2)
apps/www/components/page/video-demo.tsx (2)

8-9: Critical: Width mismatch will cause test failures.

The component defines WIDTH = 800, but the test suite expects width="958" in multiple assertions:

  • Line 118: expect(video).toHaveAttribute("width", "958")
  • Line 244: expect(video).toHaveAttribute("width", "958")
  • Line 306: expect(img).toHaveAttribute("width", "958")

This mismatch will cause test failures.

Apply this diff to match test expectations:

-const WIDTH = 800;
-const HEIGHT = 653;
+const WIDTH = 958;
+const HEIGHT = 600;

Or update all test assertions to expect the new dimensions.


42-48: Critical: Missing required video attributes and styling.

The BackgroundVideo component is missing several props that the test suite expects:

  1. Video playback attributes: autoPlay, loop, muted, playsInline
  2. Styling: className="block max-h-[600px] sm:max-h-[1000px] object-contain"

Tests explicitly check for these attributes (lines 114-117, 120-125, 251-254), so their absence will cause failures. According to the next-video documentation, BackgroundVideo accepts all native <video> props.

Apply this diff to add the missing props:

 <BackgroundVideo
 	src={demo}
 	width={WIDTH}
 	height={HEIGHT}
 	poster="/assets/demo.png"
+	autoPlay
+	loop
+	muted
+	playsInline
+	className="block max-h-[600px] sm:max-h-[1000px] object-contain"
 	onError={handleVideoError}
 />
🧹 Nitpick comments (1)
tooling/playwright-www/tests/accessibility.spec.ts (1)

221-249: Consider improving the decorative image detection logic.

The ancestor traversal logic has a few areas for improvement:

  1. Inconsistent text handling: Line 232 uses textContent?.trim() but line 238 checks textContent.length > 0 on the untrimmed value, which could incorrectly flag whitespace-only content as meaningful text.

  2. Missing aria-hidden check: Images with aria-hidden="true" on themselves or ancestors are explicitly decorative and should be filtered out.

  3. Hardcoded depth limit: The 5-level depth limit might miss decorative images nested deeper in the component tree.

Consider this refactor:

 const isDecorative = await img.evaluate((element) => {
+	// Check if image itself is aria-hidden
+	if (element.getAttribute("aria-hidden") === "true") {
+		return true;
+	}
+	
 	let current = element.parentElement;
 	let depth = 0;
 	
 	// Check up to 5 levels of ancestors
 	while (current && depth < 5) {
 		const tagName = current.tagName.toLowerCase();
 		const isInteractive = tagName === "button" || tagName === "a";
 		const role = current.getAttribute("role");
 		const ariaLabel = current.getAttribute("aria-label");
 		const ariaLabelledBy = current.getAttribute("aria-labelledby");
+		const ariaHidden = current.getAttribute("aria-hidden");
-		const textContent = current.textContent?.trim() || "";
+		const textContent = (current.textContent || "").trim();
 		
-		// If ancestor has aria-label, aria-labelledby, or is interactive with text
+		// If ancestor is hidden or has proper labeling
 		if (
+			ariaHidden === "true" ||
 			ariaLabel ||
 			ariaLabelledBy ||
 			(isInteractive && textContent.length > 0) ||
 			role === "button"
 		) {
 			return true; // Image is decorative
 		}
 		
 		current = current.parentElement;
 		depth++;
 	}
 	
 	return false; // Image is not decorative
 });
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2282abe and 23300b0.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (6)
  • apps/www/components/page/video-demo.test.tsx (7 hunks)
  • apps/www/components/page/video-demo.tsx (2 hunks)
  • apps/www/package.json (2 hunks)
  • tooling/playwright-www/tests/accessibility.spec.ts (1 hunks)
  • tooling/playwright-www/tests/homepage.spec.ts (1 hunks)
  • tooling/playwright-www/tests/utils/console-errors.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/www/package.json
🧰 Additional context used
🧠 Learnings (5)
📚 Learning: 2025-09-12T06:23:45.463Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-12T06:23:45.463Z
Learning: Applies to **/*.test.ts : Verify both runtime behavior and TypeScript types in tests

Applied to files:

  • tooling/playwright-www/tests/homepage.spec.ts
  • apps/www/components/page/video-demo.test.tsx
📚 Learning: 2025-09-12T06:23:45.463Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-12T06:23:45.463Z
Learning: Applies to **/*.test.ts : Test both success and failure cases for environment validation and utilities

Applied to files:

  • tooling/playwright-www/tests/homepage.spec.ts
📚 Learning: 2025-09-12T06:23:45.463Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-12T06:23:45.463Z
Learning: Applies to **/*.test.ts : Mock process.env to cover different environment scenarios in tests

Applied to files:

  • apps/www/components/page/video-demo.test.tsx
📚 Learning: 2025-09-12T06:23:45.463Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-12T06:23:45.463Z
Learning: Applies to **/*.test.ts : In tests, save and restore process.env in setup/teardown (beforeEach/afterEach) to avoid leakage between cases

Applied to files:

  • apps/www/components/page/video-demo.test.tsx
📚 Learning: 2025-09-12T06:23:45.463Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-12T06:23:45.463Z
Learning: Applies to **/*.test.ts : Use Vitest's describe/it structure in tests

Applied to files:

  • apps/www/components/page/video-demo.test.tsx
🧬 Code graph analysis (2)
apps/www/components/page/video-demo.test.tsx (1)
apps/www/components/page/video-demo.tsx (1)
  • VideoDemo (11-53)
tooling/playwright-www/tests/utils/console-errors.ts (5)
tooling/playwright-www/tests/examples.spec.ts (1)
  • assertNoConsoleErrors (91-93)
tooling/playwright-www/tests/hello-world.spec.ts (1)
  • assertNoConsoleErrors (34-36)
apps/www/components/page/edit-on-github.test.tsx (1)
  • consoleError (173-195)
tooling/playwright-www/tests/morphs.spec.ts (1)
  • assertNoConsoleErrors (146-148)
tooling/playwright-www/tests/quickstart.spec.ts (1)
  • assertNoConsoleErrors (178-180)
🔇 Additional comments (5)
tooling/playwright-www/tests/homepage.spec.ts (1)

98-131: Well-structured test handling both video and fallback scenarios.

The test correctly handles the dual rendering paths:

  • Validates video attributes (autoplay, loop, muted, playsInline) when video is present
  • Validates fallback image properties when video fails to load
  • Includes optional poster check to avoid false failures
  • Throws clear error when neither element is visible

The implementation aligns well with the component's error handling strategy.

apps/www/components/page/video-demo.test.tsx (4)

12-13: Excellent: Proper mock cleanup prevents test leakage.

The fetch mock is now correctly stored, set up in beforeEach, and restored in afterEach. This addresses the previous review concern and follows testing best practices to prevent state leakage between tests.

Based on learnings

Also applies to: 86-98


41-80: Well-structured mock that accurately reflects BackgroundVideo behavior.

The mock implementation:

  • Correctly handles both string URLs and asset objects for src
  • Forwards all props including onError, width, and className
  • Uses appropriate fallbacks for poster and className
  • Includes accessibility fallback text
  • Properly removed the hardcoded Vercel Blob Storage URL from previous versions

This mock accurately represents the expected behavior of the next-video/background-video component.


114-114: Correct attribute naming for HTML elements.

The changes from autoPlay/playsInline to autoplay/playsinline are correct. While React props use camelCase, the actual HTML attributes rendered in the DOM are lowercase. This aligns the tests with the actual rendered output.

Also applies to: 117-117, 251-251, 254-254


296-298: Good defensive programming with element existence checks.

Adding if (video) guards before firing error events prevents potential test failures when the video element is unexpectedly absent. This makes the tests more robust and easier to debug.

Also applies to: 322-324

- Introduced a new function to specifically identify HLS.js library errors, ensuring that only relevant errors are filtered out during console error assertions.
- Updated the `assertNoConsoleErrors` function to skip both known non-critical errors and HLS.js-specific errors, improving the accuracy of error reporting in tests.
- These changes enhance the robustness of the testing framework by preventing the suppression of legitimate media errors while still filtering out known issues.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (5)
tooling/playwright-www/tests/accessibility.test.ts (3)

210-257: Improved alt text validation logic.

The new approach correctly distinguishes decorative images from content images by examining ancestor context, which aligns better with WCAG guidelines. This is a significant improvement over the previous blanket requirement.

Minor note: The test name "should not have accessibility violations" is overly broad since it only validates image alt attributes. Consider renaming to something like "should have alt attributes on non-decorative images" for clarity.


221-249: Consider extracting decorative image detection logic.

The ancestor traversal logic is well-implemented but could benefit from:

  1. Extraction into a reusable utility function (e.g., utils/is-decorative-image.ts) for potential reuse and unit testing.
  2. Documentation explaining why the depth limit is set to 5 levels.

This would improve maintainability and make the test more readable.


228-240: Optional: Consider additional interactive roles.

The logic currently checks for role="button" but could be expanded to include other interactive roles such as "link", "tab", "menuitem", etc., where decorative images are commonly used. This would make the detection more comprehensive.

apps/www/components/page/video-demo.test.tsx (2)

86-93: Defensive fetch mock is harmless but likely unnecessary.

Since the BackgroundVideo component is fully mocked (lines 41-80), it won't execute real next-video code that might make fetch calls. This fetch mock is likely unnecessary, but it's properly cleaned up in afterEach and serves as defensive coding against potential fetch calls from unmocked code paths.

If you find the mock isn't needed in practice, consider removing it to simplify the test setup. However, there's no harm in keeping it as a safety measure.


114-119: Test assertions correctly updated for new mock behavior.

The attribute checks are correctly updated:

  • Width assertions now expect "800" (lines 118, 244, 306), resolving the past mismatch issue
  • Boolean attributes use correct lowercase HTML names (autoplay, playsinline) which properly match the JSX camelCase equivalents rendered to HTML
  • Null safety checks (lines 296-298) are good defensive coding

Consider adding assertions for the height attribute as well, since the component passes height={HEIGHT} to BackgroundVideo. For consistency with width checks:

expect(video).toHaveAttribute("height", "450"); // or whatever HEIGHT value is

Also applies to: 244-245, 296-306

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 23300b0 and 9d46d45.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • apps/www/components/page/video-demo.test.tsx (7 hunks)
  • tooling/playwright-www/tests/accessibility.test.ts (1 hunks)
  • tooling/playwright-www/tests/homepage.test.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.test.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.test.ts: Place tests alongside source files and use the .test.ts suffix (e.g., create-env.test.ts, types.test.ts, errors.test.ts, utils.test.ts)
Use Vitest's describe/it structure in tests
Test both success and failure cases for environment validation and utilities
Mock process.env to cover different environment scenarios in tests
In tests, save and restore process.env in setup/teardown (beforeEach/afterEach) to avoid leakage between cases
Verify both runtime behavior and TypeScript types in tests

Files:

  • tooling/playwright-www/tests/homepage.test.ts
  • tooling/playwright-www/tests/accessibility.test.ts
🧠 Learnings (5)
📚 Learning: 2025-09-12T06:23:45.463Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-12T06:23:45.463Z
Learning: Applies to **/*.test.ts : Mock process.env to cover different environment scenarios in tests

Applied to files:

  • apps/www/components/page/video-demo.test.tsx
📚 Learning: 2025-09-12T06:23:45.463Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-12T06:23:45.463Z
Learning: Applies to **/*.test.ts : Verify both runtime behavior and TypeScript types in tests

Applied to files:

  • apps/www/components/page/video-demo.test.tsx
  • tooling/playwright-www/tests/homepage.test.ts
📚 Learning: 2025-09-12T06:23:45.463Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-12T06:23:45.463Z
Learning: Applies to **/*.test.ts : Test both success and failure cases for environment validation and utilities

Applied to files:

  • apps/www/components/page/video-demo.test.tsx
  • tooling/playwright-www/tests/homepage.test.ts
📚 Learning: 2025-09-12T06:23:45.463Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-12T06:23:45.463Z
Learning: Applies to **/*.test.ts : In tests, save and restore process.env in setup/teardown (beforeEach/afterEach) to avoid leakage between cases

Applied to files:

  • apps/www/components/page/video-demo.test.tsx
📚 Learning: 2025-09-12T06:23:45.463Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-12T06:23:45.463Z
Learning: Applies to **/*.test.ts : Use Vitest's describe/it structure in tests

Applied to files:

  • apps/www/components/page/video-demo.test.tsx
🧬 Code graph analysis (1)
apps/www/components/page/video-demo.test.tsx (1)
apps/www/components/page/video-demo.tsx (1)
  • VideoDemo (11-53)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: test-e2e
  • GitHub Check: Cursor Bugbot
🔇 Additional comments (5)
tooling/playwright-www/tests/homepage.test.ts (1)

98-131: Test paths are correct and verified against implementation.

All hardcoded paths in the test have been verified:

  • Line 121: Poster path /assets/demo.png matches the component implementation (apps/www/components/page/video-demo.tsx:46) and the file exists at apps/www/public/assets/demo.png.
  • Line 127: Fallback image demo.gif is correct—the component intentionally uses /assets/demo.gif (line 35), not a PNG, and the file exists at apps/www/public/assets/demo.gif. The video source (demo.mp4) and fallback image (demo.gif) are separate assets used appropriately.

The dual-path validation approach is sound and well-structured. The error message on line 130 is generic but functional; improving it for better debugging is optional.

apps/www/components/page/video-demo.test.tsx (4)

2-2: Excellent fix: Fetch mock cleanup prevents test leakage.

The addition of afterEach, storing originalFetch, and restoring it in afterEach correctly addresses the previous review feedback about mock cleanup. This follows testing best practices and prevents state leakage between tests.

Based on learnings

Also applies to: 12-13, 96-98


15-39: LGTM: Image mock appropriately simplifies Next.js Image for testing.

The mock correctly renders a plain img element while preserving all relevant props (src, alt, width, height, className). The type annotations ensure type-safe usage, and the biome-ignore is appropriately justified for test mocks.


41-80: Excellent: BackgroundVideo mock addresses past feedback and implements correct behavior.

This mock successfully addresses the critical issue from the previous review by removing the hardcoded Vercel Blob Storage URL. The implementation correctly:

  • Handles both string and object src formats (lines 56-57)
  • Forwards all props including onError, width, height via the spread operator
  • Uses poster={poster || "/assets/demo.png"} to respect actual poster props
  • Properly destructures to avoid prop conflicts

The mock now accurately reflects the BackgroundVideo component's behavior and aligns with the PR's objective to migrate away from Vercel Blob Storage to Mux-backed hosting.


101-334: Comprehensive test coverage with proper structure.

The test suite provides excellent coverage of the VideoDemo component:

  • ✅ Basic rendering and attributes
  • ✅ Video source validation
  • ✅ Fallback behavior on error (video → gif)
  • ✅ User interactions (clicks, focus)
  • ✅ Accessibility (aria-label)
  • ✅ Edge cases (window.open failure, multiple clicks, post-fallback interactions)
  • ✅ Styling and layout

The structure follows Vitest best practices with proper describe/it organization and setup/teardown.

Based on learnings

… VideoDemo component

- Enhanced the VideoDemo component by adding autoplay, loop, muted, and playsInline attributes to the video element.
- Updated the className for better responsiveness and visual consistency across different screen sizes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests This issue or PR is about adding, removing or changing tests www Improvements or additions to arkenv.js.org

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix hero.mp4 video loading - Vercel Blob Storage data transfer limit exceeded

1 participant