Skip to content

Conversation

tkattkat
Copy link
Collaborator

1. frame-get-location-and-click.spec.ts (1 test)

  • Coordinate-based clicking using CDP DOM queries
    • Tests Frame.getLocationForSelector() to get element bounding box
    • Tests Page.click() coordinate-based clicking via CDP Input events
    • Verifies element state changes after CDP-driven clicks

2. locator-input-methods.spec.ts (7 tests)

  • Locator.fill() - Direct DOM value setting on inputs
  • Locator.type() - Character-by-character text input via keyboard events
  • Locator.hover() - Mouse movement to element center
  • Locator.isVisible() - Visibility detection (5 edge cases: display:none, visibility:hidden, opacity:0, zero-size, connected nodes)
  • Locator.isChecked() - Checkbox and radio button state detection
  • fill() on textarea - Multi-line text input
  • fill() replacement - Clearing and replacing existing values

3. locator-content-methods.spec.ts (10 tests)

  • Locator.textContent() - Raw text extraction (includes hidden content)
  • Locator.innerText() - Layout-aware visible text extraction
  • Locator.innerHtml() - HTML markup extraction with attributes
  • Locator.inputValue() - Value extraction from inputs, textareas, contenteditable
  • Edge cases covered: Empty elements, nested formatting, script/style tags, contenteditable, non-input elements

4. locator-select-option.spec.ts (10 tests)

  • Single & multiple option selection - By value and label
  • Option deselection - Auto-deselection on single select
  • Change event firing - Properly triggered on selection
  • Optgroup structure - Grouped options support
  • Edge cases: Empty values, numeric strings, disabled options, multi-select arrays

Copy link

changeset-bot bot commented Oct 16, 2025

⚠️ No Changeset found

Latest commit: c73fe81

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

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Overview

Summary

Adds 28 comprehensive test cases for v3 CDP-based methods across 4 test files covering coordinate-based clicks, locator interactions, content extraction, and form control methods.

Key additions:

  • frame-get-location-and-click.spec.ts: Tests CDP DOM geometry queries and coordinate-based clicking
  • locator-input-methods.spec.ts: 7 tests covering fill, type, hover, visibility detection, and checkbox state
  • locator-content-methods.spec.ts: 10 tests for textContent, innerText, innerHTML, and inputValue with edge cases for hidden content, empty elements, and script/style tags
  • locator-select-option.spec.ts: 10 tests for single/multiple selection, optgroups, change events, and edge cases

All tests use data URIs for self-contained HTML fixtures and properly verify CDP protocol interactions. The tests directly validate the v3 implementation against expected behavior.

Confidence Score: 5/5

  • This PR is safe to merge with no concerns - adds only test files with no production code changes
  • All changes are isolated to test files that validate existing v3 CDP implementations. Tests are well-structured with proper setup/teardown, use self-contained data URI fixtures, and comprehensively cover edge cases. No production code is modified.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
packages/core/lib/v3/tests/frame-get-location-and-click.spec.ts 5/5 Tests coordinate-based clicking via CDP, covering Frame.getLocationForSelector and Page.click with proper state verification.
packages/core/lib/v3/tests/locator-input-methods.spec.ts 5/5 Comprehensive tests for Locator input methods (fill, type, hover, isVisible, isChecked) with proper edge case coverage.
packages/core/lib/v3/tests/locator-content-methods.spec.ts 5/5 Well-structured tests for content extraction methods (textContent, innerText, innerHTML, inputValue) with comprehensive edge cases.
packages/core/lib/v3/tests/locator-select-option.spec.ts 5/5 Thorough tests for selectOption covering single/multiple selection, labels vs values, optgroups, and edge cases like empty values and disabled options.

Sequence Diagram

sequenceDiagram
    participant Test as Test Suite
    participant V3 as V3 Instance
    participant Page as CDP Page
    participant Frame as CDP Frame
    participant Locator as CDP Locator
    participant Browser as Chrome/CDP

    Test->>V3: new V3(config)
    Test->>V3: init()
    V3->>Page: create page
    
    Note over Test,Browser: Coordinate-based Click Test
    Test->>Page: goto(data:text/html,...)
    Test->>Page: mainFrame()
    Page->>Frame: getLocationForSelector("#btn")
    Frame->>Browser: DOM.querySelector
    Frame->>Browser: DOM.getBoxModel
    Browser-->>Frame: {x, y, width, height}
    Frame-->>Test: element bounds
    Test->>Page: click(cx, cy)
    Page->>Browser: Input.dispatchMouseEvent
    
    Note over Test,Browser: Locator Input Tests
    Test->>Frame: locator("#input")
    Frame-->>Test: Locator instance
    Test->>Locator: fill("text")
    Locator->>Browser: Runtime.callFunctionOn
    Browser-->>Locator: value set
    Test->>Locator: inputValue()
    Locator->>Browser: Runtime.callFunctionOn
    Browser-->>Test: "text"
    
    Note over Test,Browser: Content Extraction Tests
    Test->>Locator: textContent()
    Locator->>Browser: Runtime.callFunctionOn
    Browser-->>Test: raw text
    Test->>Locator: innerText()
    Locator->>Browser: Runtime.callFunctionOn
    Browser-->>Test: visible text
    
    Note over Test,Browser: Select Option Tests
    Test->>Locator: selectOption(["val1", "val2"])
    Locator->>Browser: Runtime.callFunctionOn
    Browser-->>Locator: selected values
    Locator->>Browser: dispatchEvent("change")
    
    Test->>V3: close()
Loading

4 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@tkattkat tkattkat changed the title test: add comprehensive CDP method tests for v3 module test: add CDP method tests Oct 16, 2025
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