Skip to content

fix: update to new lvt testing API#6

Closed
adnaan wants to merge 1 commit intomainfrom
fix/lvt-testing-api
Closed

fix: update to new lvt testing API#6
adnaan wants to merge 1 commit intomainfrom
fix/lvt-testing-api

Conversation

@adnaan
Copy link
Copy Markdown
Contributor

@adnaan adnaan commented Nov 29, 2025

Summary

Update all examples to use the new lvt testing API:

  • StartDockerChrome now returns error instead of *exec.Cmd
  • StopDockerChrome now takes (t, debugPort) instead of (t, cmd, debugPort)

This aligns with the latest lvt/testing package changes and fixes the cross-repo test failures.

Files Changed

  • avatar-upload/avatar-upload_test.go
  • counter/counter_test.go
  • todos/todos_test.go

🤖 Generated with Claude Code

Update all examples to use the new lvt testing API:
- StartDockerChrome now returns error instead of *exec.Cmd
- StopDockerChrome now takes (t, debugPort) instead of (t, cmd, debugPort)

This aligns with the latest lvt/testing package changes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings November 29, 2025 23:20
Copy link
Copy Markdown

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 updates all example test files to use the new lvt testing API, which changes how Docker Chrome is started and stopped in E2E tests. The API now returns an error directly from StartDockerChrome instead of returning a command object, and StopDockerChrome no longer requires the command object as a parameter.

  • Updated API usage to handle error returns from StartDockerChrome
  • Modified cleanup calls to StopDockerChrome to use the new signature
  • Applied consistent error handling pattern across all affected test files

Reviewed changes

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

File Description
todos/todos_test.go Updated Chrome container lifecycle management to use new API with error handling
counter/counter_test.go Updated Chrome container lifecycle management to use new API with error handling
avatar-upload/avatar-upload_test.go Updated Chrome container lifecycle management to use new API with error handling

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

@adnaan
Copy link
Copy Markdown
Contributor Author

adnaan commented Nov 29, 2025

Closing - this fix is not needed as the examples repo CI needs to use the pinned lvt version. The cross-repo test in livetemplate is a separate issue.

@adnaan adnaan closed this Nov 29, 2025
adnaan added a commit that referenced this pull request Apr 12, 2026
Patterns app improvements after Session 1:

- Cross-handler SPA navigation: add dedicated E2E test suite
  (cross_handler_nav_test.go) covering index↔pattern nav, back/forward
  buttons, title updates, and WebSocket reconnection. Removed the
  lvt-nav:no-intercept workaround from index.tmpl/layout.tmpl since
  client v0.8.22 now handles cross-handler navigation correctly.

- File Upload (#6):
  - Button name="upload" routes to Upload() handler method
  - WithUpload("document", ...) for Tier 1 multipart uploads
  - Tier 2 ChunkSize=1024 so upload progress is visible for demo files
  - Flash messages via FlashTag for success/error
  - Tier 2 form renders in-progress uploads via {{range .lvt.Uploads}}
  - Form-lvt:preserve to prevent reset after submit
  - E2E tests: Submit_Without_File, Tier1_Upload_With_File, Form_Structure
  - attachFileViaDataTransfer test helper (Docker-Chrome compatible)

- Preserving Form Inputs (#7):
  - ctx.SetFlash("success", "Saved: "+Name) for visual feedback
  - WithUpload("attachment", ...) so multipart submissions are parsed
  - Use .lvt.ErrorTag helper instead of manual HasError/Error markup
  - New E2E tests: Submit_Shows_Flash, Form_Values_Preserved_After_Submit,
    Values_Survive_Rerender, Submit_With_File_Attached (regression for
    the fieldset-disabled FormData bug fixed in livetemplate/client#58)

- Bulk Update (#4):
  - Add success flash "Updated N user(s)" via FlashTag
  - Test verifies flash text via output[data-flash] selector

- Inline Validation (#3):
  - Use .lvt.AriaInvalid and .lvt.ErrorTag helpers instead of manual
    HasError/Error patterns

- LVT_LOCAL_CLIENT env var in main.go lets developers serve a local
  client build (useful during client development/testing).

All 9 E2E test functions pass against livetemplate/client v0.8.22 from
CDN (no local override required).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
adnaan added a commit that referenced this pull request Apr 12, 2026
* feat: add patterns example app — Session 1 (scaffold + forms #1-7)

Implements the patterns example app scaffold and all 7 Forms & Editing
patterns from the patterns proposal (#330). Each pattern is a focused,
isolated demo with its own handler, controller, template, and E2E tests.

Patterns implemented:
1. Click To Edit — toggle view/edit with conditional rendering
2. Edit Row — inline table row editing with data-key identity
3. Inline Validation — Change() with ValidateForm and error display
4. Bulk Update — batch checkbox operations
5. Reset User Input — auto-clear forms after submission
6. File Upload — Tier 1 multipart + Tier 2 chunked upload
7. Preserving File Inputs — lvt-form:preserve across re-renders

Also includes: shared layout template, categorized index page with all
31 patterns listed (7 implemented, 24 coming soon), and comprehensive
chromedp E2E tests with UI_Standards and Visual_Check subtests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: improve Click To Edit visual layout

Replace <dl> with a Pico-styled table for cleaner key-value display.
Add outline class to Edit button to avoid full-width block styling.
Update tests to match new HTML structure.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: add lvt-nav:no-intercept to cross-handler links

Each pattern is a separate LiveTemplate handler. SPA navigation between
handlers shows stale content from the previous handler. Adding
lvt-nav:no-intercept forces full page loads when navigating between
the index page and individual pattern pages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: patterns polish, cross-handler navigation tests, and bug fixes

Patterns app improvements after Session 1:

- Cross-handler SPA navigation: add dedicated E2E test suite
  (cross_handler_nav_test.go) covering index↔pattern nav, back/forward
  buttons, title updates, and WebSocket reconnection. Removed the
  lvt-nav:no-intercept workaround from index.tmpl/layout.tmpl since
  client v0.8.22 now handles cross-handler navigation correctly.

- File Upload (#6):
  - Button name="upload" routes to Upload() handler method
  - WithUpload("document", ...) for Tier 1 multipart uploads
  - Tier 2 ChunkSize=1024 so upload progress is visible for demo files
  - Flash messages via FlashTag for success/error
  - Tier 2 form renders in-progress uploads via {{range .lvt.Uploads}}
  - Form-lvt:preserve to prevent reset after submit
  - E2E tests: Submit_Without_File, Tier1_Upload_With_File, Form_Structure
  - attachFileViaDataTransfer test helper (Docker-Chrome compatible)

- Preserving Form Inputs (#7):
  - ctx.SetFlash("success", "Saved: "+Name) for visual feedback
  - WithUpload("attachment", ...) so multipart submissions are parsed
  - Use .lvt.ErrorTag helper instead of manual HasError/Error markup
  - New E2E tests: Submit_Shows_Flash, Form_Values_Preserved_After_Submit,
    Values_Survive_Rerender, Submit_With_File_Attached (regression for
    the fieldset-disabled FormData bug fixed in livetemplate/client#58)

- Bulk Update (#4):
  - Add success flash "Updated N user(s)" via FlashTag
  - Test verifies flash text via output[data-flash] selector

- Inline Validation (#3):
  - Use .lvt.AriaInvalid and .lvt.ErrorTag helpers instead of manual
    HasError/Error patterns

- LVT_LOCAL_CLIENT env var in main.go lets developers serve a local
  client build (useful during client development/testing).

All 9 E2E test functions pass against livetemplate/client v0.8.22 from
CDN (no local override required).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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