Skip to content

384 add tests for vite config in www#387

Merged
yamcodes merged 13 commits intomainfrom
384-add-tests-for-vite-config-in-www
Nov 21, 2025
Merged

384 add tests for vite config in www#387
yamcodes merged 13 commits intomainfrom
384-add-tests-for-vite-config-in-www

Conversation

@yamcodes
Copy link
Owner

@yamcodes yamcodes commented Nov 20, 2025

Closes #384.

Summary by CodeRabbit

  • Tests
    • Enhanced test coverage for vite-plugin documentation with new accessibility smoke tests and navigation validation.
    • Introduced comprehensive documentation switcher test suite covering tab switching, keyboard navigation, content verification, and ARIA accessibility standards to ensure UI reliability.

✏️ Tip: You can customize this high-level summary in your review settings.

- Included new tests for loading and navigating Vite plugin documentation pages.
- Updated existing tests to verify the presence of Vite plugin links and titles in the documentation navigation.
- Enhanced accessibility tests by adding Vite plugin routes to ensure proper landmarks.

This update improves test coverage for the Vite plugin documentation, ensuring users have a seamless experience navigating the relevant pages.
- Updated test definitions in `docs-switcher.test.ts` and `vite-plugin-viteconfig.test.ts` to enhance code clarity by formatting parameters across multiple lines.
- Ensured consistent formatting for expect statements to improve maintainability and readability of the test code.

This change aims to streamline the test code structure, making it easier for future developers to understand and modify the tests.
@yamcodes yamcodes linked an issue Nov 20, 2025 that may be closed by this pull request
@changeset-bot
Copy link

changeset-bot bot commented Nov 20, 2025

⚠️ No Changeset found

Latest commit: 6ec2b8c

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 20, 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 21, 2025 2:03pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 20, 2025

Walkthrough

Added Playwright test coverage for new Vite plugin documentation pages. Changes include expanding A11y smoke tests with new routes, adding navigation tests for the Vite plugin pages, introducing a comprehensive documentation switcher UI test suite, and adding specific tests validating the Vite config documentation page.

Changes

Cohort / File(s) Summary
A11y and Navigation Test Updates
tooling/playwright-www/tests/a11y.test.ts, tooling/playwright-www/tests/docs-navigation.test.ts
Added /docs/vite-plugin and /docs/vite-plugin/arkenv-in-viteconfig routes to A11y smoke tests. Introduced new test suite for vite-plugin page loading and expanded existing test data to include new pages with expected titles and console error checks.
Documentation Switcher Tests
tooling/playwright-www/tests/docs-switcher.test.ts
New comprehensive test suite validating Documentation Switcher UI behavior, including helper utilities getSwitcherTabs() and findTabByText(). Tests cover switcher visibility, tab navigation, ARIA attributes, keyboard interactions, URL updates, content accuracy for both arkenv and vite-plugin sections, and state persistence across sub-pages.
Vite Plugin Config Tests
tooling/playwright-www/tests/vite-plugin-viteconfig.test.ts
New test suite for the Vite config documentation page (/docs/vite-plugin/arkenv-in-viteconfig). Validates page load, headings, content sections (loadEnv explanations, code examples), callouts, schema reuse documentation, external Vite links with proper attributes, environment variable examples, and page structure integrity.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • docs-switcher.test.ts: Most complex addition with comprehensive test scenarios, helper functions, and multiple assertion types. Requires careful review of test logic and selectors.
  • vite-plugin-viteconfig.test.ts: Substantial new test file with many focused test cases and content assertions. Verify selector robustness and content expectations align with actual documentation.
  • Test data consistency: Ensure newly added routes and page titles in a11y and docs-navigation tests correctly reflect the actual documentation structure.

Possibly related PRs

  • ArkEnv in vite.config.ts #380: Introduces the /docs/vite-plugin documentation pages and documentation switcher UI that these tests validate.
  • Accessibility tests #259: Previously modified a11y.test.ts to establish the accessibility test pattern being expanded here.
  • Set up Playwright #229: Established the Playwright testing infrastructure and patterns used across all test files in this PR.

Suggested labels

www, docs, `@arkenv/vite-plugin`

Poem

🐰 New routes are hopping through the test suite maze,
Vite-plugin docs get coverage in so many ways,
Switchers flip and tabs align with ARIA's grace,
Quality hops forward at a testing pace! 🧪✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: adding tests for Vite config in the www package, which is the core objective of the PR.
Linked Issues check ✅ Passed The PR successfully implements comprehensive tests for the Vite config section and its switcher as requested in #384, covering page load, content, and switcher functionality.
Out of Scope Changes check ✅ Passed All changes are directly related to adding Vite config tests as specified in #384; no unrelated modifications were introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 384-add-tests-for-vite-config-in-www

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 tests This issue or PR is about adding, removing or changing tests label Nov 20, 2025
- Updated tests in `docs-switcher.test.ts` to accommodate both tab and button switcher implementations, ensuring at least one is present.
- Improved visibility checks for switcher elements and their selected states, regardless of their role.
- Added keyboard navigation support for both tabs and buttons, enhancing accessibility.
- Verified ARIA attributes for switcher elements to ensure compliance with accessibility standards.

These changes improve the robustness of the tests and ensure a consistent user experience across different switcher implementations.
yamcodes and others added 2 commits November 21, 2025 18:37
- Added helper functions to streamline tab and button checks for the documentation switcher.
- Updated tests to ensure the switcher displays correctly on the docs root page and verifies the presence of both arkenv and vite-plugin options.
- Improved assertions for content visibility and accessibility, including checks for aria-selected attributes.
- Refined navigation tests to confirm correct content loading and switching between sections without console errors.
@yamcodes yamcodes marked this pull request as ready for review November 21, 2025 13:39
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 (2)
tooling/playwright-www/tests/docs-switcher.test.ts (2)

5-16: Use proper Playwright types instead of any.

The page parameter should be typed as Page from @playwright/test for better type safety and IDE support.

Apply this diff to improve the typing:

+import type { Page } from "@playwright/test";
+
 // Helper function to check if switcher exists and get tabs
-async function getSwitcherTabs(page: any) {
+async function getSwitcherTabs(page: Page) {
 	const tablist = page.locator('[role="tablist"]');
 	const tablistCount = await tablist.count();

19-28: Use proper Playwright types instead of any.

The tabs parameter should be typed as Locator from @playwright/test.

Apply this diff to improve the typing:

+import type { Locator } from "@playwright/test";
+
 // Helper function to find a tab by text
-async function findTabByText(tabs: any, tabCount: number, searchText: string) {
+async function findTabByText(tabs: Locator, tabCount: number, searchText: string) {
 	for (let i = 0; i < tabCount; i++) {
 		const tab = tabs.nth(i);
 		const text = await tab.textContent();
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f2b0d93 and 6ec2b8c.

📒 Files selected for processing (4)
  • tooling/playwright-www/tests/a11y.test.ts (1 hunks)
  • tooling/playwright-www/tests/docs-navigation.test.ts (3 hunks)
  • tooling/playwright-www/tests/docs-switcher.test.ts (1 hunks)
  • tooling/playwright-www/tests/vite-plugin-viteconfig.test.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-09T17:37:19.650Z
Learnt from: yamcodes
Repo: yamcodes/arkenv PR: 132
File: packages/arkenv/README.md:13-14
Timestamp: 2025-09-09T17:37:19.650Z
Learning: For yamcodes/arkenv project: Runtime support documentation should link to specific examples: Node.js (examples/basic), Bun (examples/with-bun), Vite (examples/with-vite-react-ts).

Applied to files:

  • tooling/playwright-www/tests/vite-plugin-viteconfig.test.ts
  • tooling/playwright-www/tests/a11y.test.ts
  • tooling/playwright-www/tests/docs-navigation.test.ts
🧬 Code graph analysis (3)
tooling/playwright-www/tests/vite-plugin-viteconfig.test.ts (2)
tooling/playwright-www/tests/utils/console-errors.ts (1)
  • assertNoConsoleErrors (62-110)
tooling/playwright-www/tests/examples.test.ts (1)
  • test (4-94)
tooling/playwright-www/tests/docs-navigation.test.ts (4)
tooling/playwright-www/tests/examples.test.ts (1)
  • test (4-94)
tooling/playwright-www/tests/integrations.test.ts (1)
  • test (4-166)
tooling/playwright-www/tests/quickstart.test.ts (3)
  • test (4-186)
  • page (18-34)
  • page (44-51)
tooling/playwright-www/tests/homepage.test.ts (1)
  • test (4-208)
tooling/playwright-www/tests/docs-switcher.test.ts (1)
tooling/playwright-www/tests/utils/console-errors.ts (1)
  • assertNoConsoleErrors (62-110)
⏰ 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 (e2e)
  • GitHub Check: test-e2e (a11y)
🔇 Additional comments (12)
tooling/playwright-www/tests/a11y.test.ts (1)

18-19: LGTM! Proper a11y coverage for new Vite plugin pages.

The addition of these routes extends accessibility testing to the new Vite plugin documentation pages, ensuring they meet the same a11y standards as existing docs pages.

tooling/playwright-www/tests/docs-navigation.test.ts (3)

58-74: LGTM! Consistent test coverage for vite-plugin pages.

The test follows the established pattern for other documentation sections (integrations, how-to), ensuring vite-plugin pages load correctly and have proper structure.


146-150: LGTM! Proper page title validation for vite-plugin docs.

The expected titles are clear and consistent with the naming convention used for other documentation pages.


201-202: LGTM! Console error checks extended to vite-plugin pages.

Ensures the new vite-plugin documentation pages don't introduce console errors, maintaining the same quality standards as existing docs.

tooling/playwright-www/tests/vite-plugin-viteconfig.test.ts (4)

5-11: LGTM! Solid foundational page load test.

Verifies the page loads and displays the correct heading, establishing a baseline for the other tests.


25-47: LGTM! Comprehensive code example validation.

Good use of .first() to handle syntax-highlighted code blocks that may have multiple matching elements. The test ensures all key import statements and code patterns are present.


79-97: LGTM! Thorough external link validation with defensive coding.

The conditional logic properly handles cases where the link might not be present, and the security attributes (target, rel) are correctly validated when the link exists.


99-112: LGTM! Flexible text matching for syntax-highlighted code.

Using flexible text selectors is appropriate here since code blocks with syntax highlighting can have complex DOM structures that make exact matching unreliable.

tooling/playwright-www/tests/docs-switcher.test.ts (4)

31-72: LGTM! Robust switcher detection with fallback logic.

The test handles multiple switcher implementations (tablist vs buttons/links) and includes fallback navigation to verify functionality when the switcher UI is not present. This defensive approach ensures the tests remain stable across UI changes.


138-169: LGTM! Proper validation of default section with accessibility checks.

The test verifies both the content display and ARIA attributes, ensuring the default arkenv section is properly selected and accessible.


300-313: LGTM! Defensive handling of conditionally visible content.

Good use of .toHaveCount(1) instead of visibility check at Line 312, accounting for elements that may be hidden on certain viewports (md:hidden class).


382-415: LGTM! Comprehensive keyboard navigation testing.

Excellent coverage of keyboard accessibility, testing focus management, arrow key navigation, and Enter key activation. This ensures the switcher is fully keyboard-accessible.

@yamcodes yamcodes merged commit 4e6dbe7 into main Nov 21, 2025
15 checks passed
@yamcodes yamcodes deleted the 384-add-tests-for-vite-config-in-www branch November 21, 2025 14:15
@coderabbitai coderabbitai bot mentioned this pull request Nov 24, 2025
@coderabbitai coderabbitai bot mentioned this pull request Jan 16, 2026
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add tests for Vite config in www

1 participant