Playwright

Validate a response schema

Hard120 pts
  • Schema Validation
  • JSON Schema
  • Contract Testing
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-validate-a-response-schema

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

Objective

Validate the schema and data types of an API response JSON payload.

Your Task

  1. 1Send an HTTP GET request to '/users/1' using the API request context.
  2. 2Assert that the response status code is 200 OK.
  3. 3Parse the JSON response body.
  4. 4Assert that the response contains expected properties (such as 'id' and 'name') with their proper data types.

Validation Checks

  • Validates property types of API response
  • Status is 200
  • 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