Playwright

Send a POST and assert creation

Medium70 pts
  • HTTP POST
  • Resource Creation
  • Status 201
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-post-and-assert-creation

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

Objective

Send an HTTP POST request to create a new user record and assert the HTTP 201 Created status and returned identifier.

Your Task

  1. 1Send an HTTP POST request to '/users' with user details including name, email, and role.
  2. 2Assert that the response status code is 201 Created.
  3. 3Parse the JSON response body.
  4. 4Assert that the response contains the created user ID.

Validation Checks

  • Sends POST to /users with JSON data
  • Status is 201
  • Response includes created user ID
  • 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