Skip to content

DYN-10311 New tests for the DynamoHome repo#73

Merged
QilongTang merged 13 commits into
DynamoDS:masterfrom
danvelazco27:DYN-10311
Apr 27, 2026
Merged

DYN-10311 New tests for the DynamoHome repo#73
QilongTang merged 13 commits into
DynamoDS:masterfrom
danvelazco27:DYN-10311

Conversation

@danvelazco27
Copy link
Copy Markdown
Collaborator

@danvelazco27 danvelazco27 commented Mar 27, 2026

This PR integrates Claude Code into the DynamoHome development workflow and significantly expands test coverage across the codebase.

Claude Code configuration (.claude/)

  • 4 specialized agents — frontend-agent, testing-agent, build-agent, code-review-agent — each with a defined role, curated tool set, and project-specific rules baked in
  • 10 skills (slash commands) covering: feature-ui, end-to-end-testing, unit-testing, react, localization, code-review, build-tooling, bugfix, refactor, playwright-cli
  • 4 nested CLAUDE.md files — root (architecture, constraints, data flow), tests/, src/locales/, src/components/ — auto-loaded into every Claude session for persistent codebase context

Unit tests — full coverage added

Added 28 test files (235 tests) covering every component and module that previously had no unit tests:

  • Common/ — CardItem, Arrow, Tooltip, Portal, CustomIcons
  • Recent/ — PageRecent, GraphGridItem, GraphTable, all cell renderers
  • Samples/ — PageSamples, SamplesGrid, SamplesGridItem, CustomSampleFirstCellRenderer
  • Learning/ — PageLearning, Carousel, GuideGridItem, VideoCarouselItem, ModalItem
  • Sidebar/ — Sidebar, CustomDropDown
  • App-level — App, LayoutContainer, MainContent, SettingsContext, utility.ts, localization.ts

End-to-end tests — Playwright POM suite (23 tests)

Replaced the single smoke test with a structured suite split by feature area:

  • navigation.spec.ts, sidebar.spec.ts, recent.spec.ts, samples.spec.ts, learning.spec.ts
  • Page Object classes for all three pages and the sidebar component
  • data-testid attributes added to all interactive elements to support stable selectors

Supporting changes

  • playwright.config.js — added reuseExistingServer to avoid port conflicts during local development
  • README.md — updated install command (--legacy-peer-deps), added Claude Code usage section, updated e2e test structure
  • .gitignore — added .playwright-cli (local exploratory testing artifacts)
  • claude-integration.html — visual reference page summarizing the full Claude integration for team onboarding

danvelazco27 and others added 6 commits March 27, 2026 09:24
Files were committed before the folder was added to .gitignore.
`git rm --cached` unstages them; .gitignore prevents future tracking.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@danvelazco27 danvelazco27 marked this pull request as ready for review March 27, 2026 16:19
Comment thread .claude/skills/playwright-cli/references/video-recording.md Outdated
Comment thread claude-integration.html Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR integrates Claude Code project configuration and substantially expands automated testing (unit + Playwright e2e), adding stable data-testid hooks in UI components to support Page Object Model (POM) selectors.

Changes:

  • Added extensive Jest + React Testing Library unit tests across components/modules.
  • Replaced the old single Playwright smoke test with a POM-based tests/e2e/*.spec.ts suite.
  • Added data-testid attributes to key UI elements and updated Playwright/Jest setup and npm scripts accordingly.

Reviewed changes

Copilot reviewed 79 out of 82 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
types/index.d.ts Adds jest-dom types reference
tests/jest.setup.ts Loads @testing-library/jest-dom
tests/unit/testUtils.tsx Shared render helpers (Intl/Settings)
tests/unit/utility.test.ts Unit tests for host-bridge utilities
tests/unit/localization.test.ts Locale mapping tests
tests/unit/SettingsContext.test.tsx Settings context tests
tests/unit/App.test.tsx App-level unit tests
tests/unit/LayoutContainer.test.tsx LayoutContainer unit tests
tests/unit/MainContent.test.tsx MainContent unit tests
tests/unit/Common/Arrow.test.tsx Arrow component tests
tests/unit/Common/CardItem.test.tsx CardItem component tests
tests/unit/Common/Tooltip.test.tsx Tooltip behavior tests
tests/unit/Common/Portal.test.tsx Portal behavior tests
tests/unit/Common/CustomIcons.test.tsx SVG icon rendering tests
tests/unit/Sidebar/Sidebar.test.tsx Sidebar rendering/click tests
tests/unit/Sidebar/CustomDropDown.test.tsx CustomDropdown interaction tests
tests/unit/Recent/PageRecent.test.tsx Recent page tests (mocked children)
tests/unit/Recent/GraphTable.test.tsx GraphTable tests
tests/unit/Recent/GraphGridItem.test.tsx GraphGridItem tests
tests/unit/Recent/CustomNameCellRenderer.test.tsx Name cell renderer tests
tests/unit/Recent/CustomLocationCellRenderer.test.tsx Location cell renderer tests
tests/unit/Recent/CustomAuthorCellRenderer.test.tsx Author cell renderer tests
tests/unit/Samples/PageSamples.test.tsx Samples page tests (mocked children)
tests/unit/Samples/SamplesGrid.test.tsx SamplesGrid rendering tests
tests/unit/Samples/SamplesGridItem.test.tsx SamplesGridItem tests
tests/unit/Samples/CustomSampleFirstCellRenderer.test.tsx Samples first-cell renderer tests
tests/unit/Learning/PageLearning.test.tsx Learning page tests (mocked children)
tests/unit/Learning/Carousel.test.tsx Carousel navigation tests
tests/unit/Learning/GuideGridItem.test.tsx GuideGridItem tests
tests/unit/Learning/VideoCarouselItem.test.tsx Video carousel item tests
tests/unit/Learning/ModalItem.test.tsx ModalItem portal tests
tests/e2e/navigation.spec.ts E2E navigation coverage
tests/e2e/sidebar.spec.ts E2E sidebar dropdown coverage
tests/e2e/recent.spec.ts E2E Recent page coverage
tests/e2e/samples.spec.ts E2E Samples page coverage
tests/e2e/learning.spec.ts E2E Learning page + carousel coverage
tests/e2e/pages/RecentPage.ts Recent page object
tests/e2e/pages/SamplesPage.ts Samples page object
tests/e2e/pages/LearningPage.ts Learning page object
tests/e2e/components/Sidebar.ts Sidebar component object
tests/e2e.test.ts Removes old smoke e2e test
tests/App.test.tsx Removes old unit test location
tests/CLAUDE.md Adds test-suite conventions doc
src/components/Sidebar/Sidebar.tsx Adds test ids for navigation
src/components/Sidebar/CustomDropDown.tsx Adds test ids for dropdown/toggle
src/components/Samples/SamplesGrid.tsx Adds test id for grid root
src/components/Samples/PageSamples.tsx Adds test ids for page/toggles
src/components/Recent/PageRecent.tsx Adds test ids for page/toggles/grid
src/components/Learning/PageLearning.tsx Adds test ids for page/sections
src/components/Learning/Carousel.tsx Adds test ids for nav buttons
src/components/Common/CardItem.tsx Adds test id for card root
playwright.config.js Scopes e2e dir + reuse server
package.json Updates test scripts + adds jest-dom
package-lock.json Locks jest-dom dependency updates
README.md Updates install + Claude + testing docs
.gitignore Ignores .playwright-cli artifacts
CLAUDE.md Adds repo architecture/workflow context
src/locales/CLAUDE.md Adds locale sync rules
src/components/CLAUDE.md Adds component placement rules
claude-integration.html Adds Claude onboarding reference page
.claude/settings.local.json Adds local Claude tool permissions
.claude/agents/frontend-agent.md Adds agent definition
.claude/agents/testing-agent.md Adds agent definition
.claude/agents/build-agent.md Adds agent definition
.claude/agents/code-review-agent.md Adds agent definition
.claude/skills/feature-ui/SKILL.md Adds skill workflow doc
.claude/skills/unit-testing/SKILL.md Adds unit testing skill doc
.claude/skills/end-to-end-testing/SKILL.md Adds e2e testing skill doc
.claude/skills/react/SKILL.md Adds React conventions doc
.claude/skills/localization/SKILL.md Adds localization workflow doc
.claude/skills/code-review/SKILL.md Adds code review workflow doc
.claude/skills/build-tooling/SKILL.md Adds build/tooling workflow doc
.claude/skills/bugfix/SKILL.md Adds bugfix workflow doc
.claude/skills/refactor/SKILL.md Adds refactor workflow doc
.claude/skills/playwright-cli/SKILL.md Adds Playwright CLI skill doc
.claude/skills/playwright-cli/references/* Adds Playwright CLI references

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread package.json Outdated
Comment thread .claude/skills/unit-testing/SKILL.md Outdated
Comment thread .claude/skills/end-to-end-testing/SKILL.md
Comment thread tests/CLAUDE.md
Comment thread tests/unit/Sidebar/CustomDropDown.test.tsx Outdated
Comment thread tests/unit/Sidebar/CustomDropDown.test.tsx
Comment thread tests/unit/Learning/PageLearning.test.tsx Outdated
Comment thread .claude/agents/testing-agent.md
Comment thread tests/unit/Recent/CustomAuthorCellRenderer.test.tsx Outdated
@zeusongit zeusongit requested a review from a team March 27, 2026 17:43
@jasonstratton
Copy link
Copy Markdown

@danvelazco27 Doing a review now, but just curious whether you have addressed Ashish's and Copilot's comments already? The conversations are not marked resolved. So I just don't want to comment/approve on work in progress. Thanks

Comment thread package-lock.json Outdated
@danvelazco27
Copy link
Copy Markdown
Collaborator Author

@danvelazco27 Doing a review now, but just curious whether you have addressed Ashish's and Copilot's comments already? The conversations are not marked resolved. So I just don't want to comment/approve on work in progress. Thanks

@jasonstratton I'm retaking this work (vacation time), I already addressed all comments; please make your review. I'll be checking your feedback. Thanks :)

Comment thread .claude/settings.json Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 72 out of 75 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (3)

tests/unit/utility.test.ts:1

  • The mocked host method name ShowTempalte appears to be a typo (likely ShowTemplate). If the real scriptObject API/mock uses the correct spelling, this test will fail or (worse) will encode the wrong contract. Align the expectation with the actual WebView host method name used by sideBarCommand.
    tests/unit/Sidebar/Sidebar.test.tsx:1
  • Brand capitalization: 'GitHub' is the correct spelling. Update the expected text (and the underlying localized string if needed) to 'GitHub Repository' to avoid baking the typo into tests.
    tests/unit/Sidebar/CustomDropDown.test.tsx:1
  • This assertion is brittle because it depends on incidental DOM structure (total <span> counts) and also acknowledges CSS-module class matching won’t work reliably in tests. Since the component now exposes stable data-testids for the dropdown root/toggle, consider adding a dedicated identifier for the divider element (e.g., data-testid or role=\"separator\") and assert presence/absence directly rather than counting spans.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/Learning/Carousel.tsx Outdated
Comment thread src/components/Learning/Carousel.tsx Outdated
Comment thread .npmrc Outdated
@avidit
Copy link
Copy Markdown
Contributor

avidit commented Apr 23, 2026

@danvelazco27 I would make the lint update a separate PR

@danvelazco27
Copy link
Copy Markdown
Collaborator Author

@danvelazco27 I would make the lint update a separate PR

@avidit done

@QilongTang
Copy link
Copy Markdown
Collaborator

QilongTang commented Apr 24, 2026

hmm somehow the build is failing? Copilot is not available to help fix it with a fork

@danvelazco27
Copy link
Copy Markdown
Collaborator Author

hmm somehow the build is failing? Copilot is not available to help fix it with a fork

Reverting some changes by Aabi's suggestion, I broke the test scripts. I already fixed them.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 73 out of 76 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (3)

src/components/Learning/Carousel.tsx:17

  • maxIndex becomes negative when totalItems < itemsPerPage, which can drive currentIndex negative (e.g., clicking Prev at index 0 sets index to a negative maxIndex), producing invalid transforms and wrap behavior. Clamp maxIndex to a minimum of 0 (and optionally disable nav buttons when totalItems <= itemsPerPage) so navigation cannot move outside the valid range.
export const Carousel = ({ children }: {children: ReactNode}) => {
    const [currentIndex, setCurrentIndex] = useState(0);
    const itemsPerPage = 4;
    const totalItems = React.Children.count(children);
    const maxIndex = totalItems - itemsPerPage

    const goLeft = () => {
        setCurrentIndex(currentIndex === 0 ? maxIndex : currentIndex - 1);
    };

    const goRight = () => {
        setCurrentIndex(currentIndex === maxIndex ? 0 : currentIndex + 1);
    }

tests/e2e/navigation.spec.ts:1

  • This repo’s documented e2e rule says *.spec.ts should avoid direct page actions, but these specs call page.goto(...) directly. To align with the stated POM convention, consider introducing an App/Home page object with a goto() method (and reuse it across specs) so navigation becomes part of the POM layer.
    tests/unit/Sidebar/Sidebar.test.tsx:1
  • Use the correct capitalization for the brand name: change 'Github' to 'GitHub' (both the test description and the expected text, if the UI is intended to display the brand correctly).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +6 to 7
<div className={styles['graph-container']} data-testid="card-item">
<a className={styles['graph-link']} onClick={onClick}>
Copy link

Copilot AI Apr 26, 2026

Choose a reason for hiding this comment

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

Using an <a> without an href as an interactive control is not keyboard-accessible by default and can confuse assistive tech semantics. Prefer a <button type=\"button\"> for click actions, or add proper link semantics (href) plus keyboard handlers/ARIA if it truly represents navigation.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@avidit avidit left a comment

Choose a reason for hiding this comment

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

LGTM

@QilongTang QilongTang merged commit aecc5e8 into DynamoDS:master Apr 27, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants