Skip to content

← All questions

Chaining a created id into a UI assertion: JSON path $.id is undefined in the last response

Example threads. These questions and answers were written by the SDODS team to document real problems and how to fix them. The people named are illustrative, not real users. Questions asked on this site are marked new.

Trying to seed through the API and assert in the browser, which is the whole reason we picked this thing.

gherkin
@hybrid @regression
Scenario: A seeded order appears in the list
  When I seed via POST "/orders" with body:
    """json
    { "sku": "SD-1", "qty": 2 }
    """
  And I save the response JSON path "id" as "orderId"
  And I navigate to the "orders" page
  Then order "{{orderId}}" should show status "Pending"
text
JSON path $.id is undefined in the last response; cannot save as {{orderId}}.

The endpoint definitely returns an id, I checked with curl.

3 answers

Know the answer?

Wrap commands and output in triple backticks and they will render as a code block.

Checking whether you’re signed in…

Have a different question? Ask it.

Related