fix: use JS .click() for delete flow E2E tests#33
Merged
Conversation
chromedp.Click doesn't reliably trigger event delegation handlers in headless Chrome. Replace with chromedp.Evaluate + JS .click() and use e2etest.WaitFor for reliable DOM change detection. Closes #24 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Updates the todos-components E2E delete-flow tests to more reliably trigger LiveTemplate’s lvt-click delegated handlers in headless Chrome by using DOM-level JS clicks and condition-based waits.
Changes:
- Replaced
chromedp.Clickwithchromedp.Evaluate(... .click())for delete-flowlvt-clickinteractions. - Replaced fixed
chromedp.Sleepwaits withe2etest.WaitForconditions for modal/todo-count changes. - Tightened assertions for modal visibility, modal positioning, and successful deletion (todo count decreases + deleted todo absent).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+306
to
309
| chromedp.Run(modalCtx, | ||
| chromedp.Evaluate(`document.querySelector('button[lvt-click="confirm_delete"]').click()`, nil), | ||
| e2etest.WaitFor(`document.querySelector('[data-modal="delete_confirm"]') !== null`, 5*time.Second), | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
chromedp.Clickwithchromedp.Evaluate+ JS.click()for alllvt-clickbutton interactions in delete flow E2E testse2etest.WaitForfor reliable DOM change detection instead ofchromedp.Sleept.Errorf/t.Error) for todo count decrease and deletion verificationRoot Cause
chromedp.Clicksends CDP input events that don't reliably trigger event delegation handlers in headless Chrome. LiveTemplate useslvt-clickattribute-based event delegation, which requires actual DOM click events (not CDP-level input simulation).Tests affected
TestTodosComponentsE2E/Delete_Confirmation_Modal_AppearsTestTodosComponentsE2E/Cancel_Delete_ModalTestTodosComponentsE2E/Confirm_Delete_Modal_Deletes_TodoTestBrowserDeleteFlowCloses #24
🤖 Generated with Claude Code