Playwright

Send a GET and assert the body

Medium70 pts
  • request fixture
  • APIRequestContext
  • HTTP GET
Practice app · Acme REST API

A live REST + GraphQL API with auth, validation, pagination, rate limiting and an interactive request console.

Test URL
/lab/playwright-send-a-get-and-assert-the-body

Your starter code already declares TEST_URL — never hardcode a host.

Objective

Send an HTTP GET request to retrieve a user resource and assert the response status and JSON body properties.

Your Task

  1. 1Send an HTTP GET request to the user endpoint '/users/1'.
  2. 2Assert that the HTTP response status code is 200.
  3. 3Parse the JSON response body.
  4. 4Assert that the user name property is present in the response.

Validation Checks

  • Sends GET request to /users/1
  • Status is 200
  • Asserts user.name property
  • At least 2 assertions pass

Fixtures

apiKey
tqa_live_key_123
basicUser
admin
basicPassword
secret
username
qa@target.dev
password
Test@123

Playwright · Playwright Practice Track · API testing with Playwright