Skip to content

Conversation

@tomusdrw
Copy link
Contributor

No description provided.

@netlify
Copy link

netlify bot commented Dec 30, 2025

Deploy Preview for pvm-debugger ready!

Name Link
🔨 Latest commit 929e1e0
🔍 Latest deploy log https://app.netlify.com/projects/pvm-debugger/deploys/6954577c815528000844f7b8
😎 Deploy Preview https://deploy-preview-469--pvm-debugger.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 30, 2025

📝 Walkthrough

Walkthrough

The changes standardize test data attributes from test-id to data-testid across multiple components, update test selectors to use Playwright's getByTestId() method, enable the webServer configuration in Playwright, and replace fixed sleep statements with explicit waits in tests.

Changes

Cohort / File(s) Summary
Test Configuration
playwright.config.ts
Activates webServer block to run build and start Vite preview server on port 5173 before tests with 120-second timeout; conditionally reuses existing server based on CI environment.
Component Test Attributes
src/components/Instructions/InstructionItem.tsx,
src/components/MemoryPreview/MemoryInfinite.tsx,
src/components/Registers/index.tsx
Standardizes test data attributes from test-id or data-test-id to data-testid for Playwright test selectors; no structural or behavioral changes.
Test Selector & Wait Updates
tests/memory-range.spec.ts,
tests/run-program.spec.ts
Updates element selectors to use getByTestId() instead of attribute-based locators; replaces fixed sleep after "Run" with explicit wait for "HALT" status (15-second timeout) and adds 2-second initialization delay before interactions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning No pull request description was provided by the author, making it impossible to assess whether it relates to the changeset. Add a pull request description explaining the motivation and details of the changes, such as why test selectors needed updating and how the localhost setup improvements benefit the test suite.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 tests on localhost' is somewhat vague and generic, using the non-descriptive term 'fix' without specifying what aspect of tests is being fixed or why localhost is relevant. Consider a more specific title like 'Update test selectors and add explicit waits for localhost testing' or 'Replace test-id attributes with data-testid and improve test timing' to better convey the actual changes.
✨ Finishing touches
  • 📝 Generate docstrings

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

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 (1)
tests/memory-range.spec.ts (1)

9-10: Consider replacing fixed waits with explicit state checks.

While the 2-second waits work for localhost, explicit waits for observable program states (like checking for initialization status or first instruction visibility) would be more reliable and potentially faster, similar to the approach in tests/run-program.spec.ts (lines 15-17).

Example: Wait for observable state instead of fixed timeout
- // Wait for program to load and initialize
- await page.waitForTimeout(2000);
+ // Wait for program to initialize by checking for visible instructions
+ await expect(page.locator('a:has-text("STORE_U16")')).toBeVisible({ timeout: 5000 });

Alternatively, wait for a specific program status or memory initialization indicator if available.

Also applies to: 31-32, 51-52, 73-74

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4f55dff and 929e1e0.

📒 Files selected for processing (6)
  • playwright.config.ts
  • src/components/Instructions/InstructionItem.tsx
  • src/components/MemoryPreview/MemoryInfinite.tsx
  • src/components/Registers/index.tsx
  • tests/memory-range.spec.ts
  • tests/run-program.spec.ts
🧰 Additional context used
📓 Path-based instructions (5)
**/*.spec.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.spec.{ts,tsx}: Unit specs should use the *.spec.ts(x) suffix and stay beside their modules
Match test file names to the unit under test (e.g., store/pvmSlice.spec.ts)

Files:

  • tests/run-program.spec.ts
  • tests/memory-range.spec.ts
tests/**/*.spec.ts

📄 CodeRabbit inference engine (AGENTS.md)

tests/**/*.spec.ts: Playwright specs in tests/ should script critical journeys such as uploading WASM or stepping instructions
Reuse fixtures from tests/utils for deterministic Playwright inputs

Files:

  • tests/run-program.spec.ts
  • tests/memory-range.spec.ts
src/components/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

src/components/**/*.{ts,tsx}: Keep reusable UI components in src/components/
Write TypeScript-first functional components

Files:

  • src/components/Instructions/InstructionItem.tsx
  • src/components/MemoryPreview/MemoryInfinite.tsx
  • src/components/Registers/index.tsx
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.{ts,tsx}: Use two-space indentation in TypeScript files
Use descriptive filenames in kebab-case (e.g., memory-range-panel.tsx)
Validate external inputs with Zod when parsing user data

Files:

  • src/components/Instructions/InstructionItem.tsx
  • src/components/MemoryPreview/MemoryInfinite.tsx
  • src/components/Registers/index.tsx
src/**/*.{css,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Favor Tailwind utilities from globals.css before adding new CSS files

Files:

  • src/components/Instructions/InstructionItem.tsx
  • src/components/MemoryPreview/MemoryInfinite.tsx
  • src/components/Registers/index.tsx
🧠 Learnings (8)
📓 Common learnings
Learnt from: CR
Repo: FluffyLabs/pvm-debugger PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T22:06:57.521Z
Learning: UI tweaks should update the affected Playwright expectations
Learnt from: CR
Repo: FluffyLabs/pvm-debugger PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T22:06:57.521Z
Learning: Applies to tests/**/*.spec.ts : Reuse fixtures from `tests/utils` for deterministic Playwright inputs
Learnt from: CR
Repo: FluffyLabs/pvm-debugger PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T22:06:57.521Z
Learning: Applies to tests/**/*.spec.ts : Playwright specs in `tests/` should script critical journeys such as uploading WASM or stepping instructions
Learnt from: CR
Repo: FluffyLabs/pvm-debugger PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T22:06:57.521Z
Learning: Applies to src/**/*.spec.{ts,tsx} : Vitest with Testing Library is configured through `src/test-setup.ts`; assert observable behavior
📚 Learning: 2025-11-24T22:06:57.521Z
Learnt from: CR
Repo: FluffyLabs/pvm-debugger PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T22:06:57.521Z
Learning: Applies to tests/**/*.spec.ts : Playwright specs in `tests/` should script critical journeys such as uploading WASM or stepping instructions

Applied to files:

  • tests/run-program.spec.ts
  • playwright.config.ts
  • tests/memory-range.spec.ts
📚 Learning: 2025-11-24T22:06:57.521Z
Learnt from: CR
Repo: FluffyLabs/pvm-debugger PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T22:06:57.521Z
Learning: UI tweaks should update the affected Playwright expectations

Applied to files:

  • tests/run-program.spec.ts
  • src/components/Instructions/InstructionItem.tsx
  • src/components/MemoryPreview/MemoryInfinite.tsx
  • src/components/Registers/index.tsx
  • tests/memory-range.spec.ts
📚 Learning: 2025-11-24T22:06:57.521Z
Learnt from: CR
Repo: FluffyLabs/pvm-debugger PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T22:06:57.521Z
Learning: Applies to src/**/*.spec.{ts,tsx} : Vitest with Testing Library is configured through `src/test-setup.ts`; assert observable behavior

Applied to files:

  • tests/run-program.spec.ts
  • playwright.config.ts
  • tests/memory-range.spec.ts
📚 Learning: 2025-11-24T22:06:57.521Z
Learnt from: CR
Repo: FluffyLabs/pvm-debugger PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T22:06:57.521Z
Learning: Applies to tests/**/*.spec.ts : Reuse fixtures from `tests/utils` for deterministic Playwright inputs

Applied to files:

  • tests/run-program.spec.ts
  • playwright.config.ts
  • tests/memory-range.spec.ts
📚 Learning: 2025-11-24T22:06:57.521Z
Learnt from: CR
Repo: FluffyLabs/pvm-debugger PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T22:06:57.521Z
Learning: Applies to src/**/*.spec.{ts,tsx} : Cover success and failure paths for reducers, hooks, and components that manage debugger state

Applied to files:

  • tests/run-program.spec.ts
  • src/components/Registers/index.tsx
  • tests/memory-range.spec.ts
📚 Learning: 2025-11-24T22:06:57.521Z
Learnt from: CR
Repo: FluffyLabs/pvm-debugger PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T22:06:57.521Z
Learning: Use `npm run dev` to start Vite with hot reload across workers

Applied to files:

  • playwright.config.ts
📚 Learning: 2025-11-24T22:06:57.521Z
Learnt from: CR
Repo: FluffyLabs/pvm-debugger PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T22:06:57.521Z
Learning: Applies to **/*.spec.{ts,tsx} : Unit specs should use the `*.spec.ts(x)` suffix and stay beside their modules

Applied to files:

  • tests/memory-range.spec.ts
🧬 Code graph analysis (1)
src/components/MemoryPreview/MemoryInfinite.tsx (1)
src/components/ui/tooltip.tsx (1)
  • TooltipTrigger (30-30)
⏰ 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). (1)
  • GitHub Check: test
🔇 Additional comments (6)
playwright.config.ts (1)

74-79: LGTM! webServer configuration enables automated localhost testing.

The configuration correctly builds the app and starts a preview server before tests. The 120-second timeout and conditional server reuse logic are appropriate for CI and local development.

src/components/Registers/index.tsx (1)

188-188: LGTM! Standardized test attribute.

The change from test-id to data-testid aligns with standard testing conventions and matches the selector updates in tests/run-program.spec.ts.

src/components/Instructions/InstructionItem.tsx (1)

131-131: LGTM! Standardized test attribute.

Consistent with the test attribute standardization across other components in this PR.

src/components/MemoryPreview/MemoryInfinite.tsx (1)

76-76: LGTM! Standardized test attributes on memory cells.

Both changes align with the test selector updates in tests/memory-range.spec.ts that now use getByTestId("memory-cell").

Also applies to: 92-92

tests/run-program.spec.ts (1)

15-17: LGTM! Excellent improvement to test reliability.

Replacing the fixed sleep with an explicit wait for the "HALT" status makes the test more reliable and faster. The 15-second timeout provides sufficient time for program execution while failing fast if something goes wrong.

tests/memory-range.spec.ts (1)

17-18: LGTM! Standardized test selectors.

The change to getByTestId("memory-cell") correctly aligns with the component updates in src/components/MemoryPreview/MemoryInfinite.tsx.

Also applies to: 22-23

@tomusdrw tomusdrw enabled auto-merge (squash) December 30, 2025 22:55
@tomusdrw tomusdrw merged commit 9875d2f into main Dec 30, 2025
7 checks passed
@tomusdrw tomusdrw deleted the td-fix-tests branch December 30, 2025 22:56
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.

2 participants