8000
Skip to content

Checkout verdict never renders: real Order Summary rows put the label in a text node #122

Description

@peteb4ker

Symptom

The #113 all-in-vs-market breakdown never mounts on the real checkout page.

Cause (from real checkout DOM, user-provided)

TCGplayer renders summary rows as label text node + value span inside one div:

<div>Item Total <span data-testid="packageItemTotal">$11.92</span></div>
<div> Shipping <span data-testid="packageShipping">FREE</span></div>

findOrderSummaryLabel requires an element whose own text is ONLY the label and contains no $. In the real shape, the only element containing the label also contains the value — so rows with dollar values are excluded by the $ rule, no Est. Tax label is ever found, the gate fails, and the block never renders. The fixture I authored used <span>Label</span><span>$X</span> pairs, which is why e2e passed.

Also from the real DOM: the label is "Item Total" (singular — regex already tolerates), and shipping can be the literal "FREE".

Fix

Row-shaped matching: accept elements whose normalized text STARTS with the label, is short (≤40 chars), and has ≤3 element children — then parse the amount from the row's own text ("FREE" → 0), falling back to the next sibling for flat label-only layouts. Scope the Items Total / Shipping lookups to the Est. Tax row's parent container so the left-column package box (which has its own "Item Total"/"Shipping FREE" rows) can't shadow the Order Summary values in multi-package carts.

Acceptance

  • Fixture rows converted to the real text-node shape; e2e fails pre-fix, passes post-fix.
  • "FREE" shipping and "Item Total" singular covered.
  • Both row shapes (text-node and label-element) handled.
  • User confirms the block renders on their real checkout.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    0