@smoke
@api
@regression
@negative
Feature: API Testing with Playwright
Description: As a QA Engineer
I want to test REST API endpoints
So that I can validate backend functionality
File name: api.feature
Relative path: features/api.feature
Given
the API base URL is "https://jsonplaceholder.typicode.com"
00:00:00.001
When
I send a GET request to "/users"
00:00:00.141
Then
the response status code should be 200
00:00:00.001
And
the response should be a JSON array
00:00:00.001
And
the response array should have 10 items
00:00:00.000
Given
the API base URL is "https://jsonplaceholder.typicode.com"
00:00:00.001
When
I send a GET request to "/users/1"
00:00:00.027
Then
the response status code should be 200
00:00:00.000
And
the response should contain the following fields:
00:00:00.001
| field |
|---|
| id |
| name |
| username |
And
the response field "id" should be 1
00:00:00.000
And
the response field "name" should be "Leanne Graham"
00:00:00.000
Given
the API base URL is "https://jsonplaceholder.typicode.com"
00:00:00.001
When
I send a POST request to "/users" with body:
00:00:00.058
{
"name": "John Doe",
"username": "johndoe",
"email": "john.doe@example.com"
}
Then
the response status code should be 201
00:00:00.000
And
the response field "name" should be "John Doe"
00:00:00.000
And
the response field "username" should be "johndoe"
00:00:00.000
Given
the API base URL is "https://jsonplaceholder.typicode.com"
00:00:00.001
When
I send a PUT request to "/users/1" with body:
00:00:00.136
{
"id": 1,
"name": "Updated Name",
"username": "updateduser",
"email": "updated@example.com"
}
Then
the response status code should be 200
00:00:00.000
And
the response field "name" should be "Updated Name"
00:00:00.000
And
the response field "username" should be "updateduser"
00:00:00.000
Given
the API base URL is "https://jsonplaceholder.typicode.com"
00:00:00.000
When
I send a PATCH request to "/users/1" with body:
00:00:00.058
{
"email": "newemail@example.com"
}
Then
the response status code should be 200
00:00:00.000
And
the response field "email" should be "newemail@example.com"
00:00:00.000
Given
the API base URL is "https://jsonplaceholder.typicode.com"
00:00:00.000
When
I send a GET request to "/users/1/posts"
00:00:00.026
Then
the response status code should be 200
00:00:00.000
And
the response should be a JSON array
00:00:00.000
And
all items should have field "userId" with value 1
00:00:00.001
Given
the API base URL is "https://jsonplaceholder.typicode.com"
00:00:00.000
When
I send a GET request to "/users"
00:00:00.026
Then
the response status code should be 200
00:00:00.000
And
the response time should be less than 2000 milliseconds
00:00:00.000
Given
the API base URL is "https://jsonplaceholder.typicode.com"
00:00:00.000
When
I send a GET request to "/users/1"
00:00:00.026
Then
the response status code should be 200
00:00:00.000
And
the response header "content-type" should contain "application/json"
00:00:00.000
Given
the API base URL is "https://jsonplaceholder.typicode.com"
00:00:00.000
When
I send a GET request to "/users/1"
00:00:00.026
Then
the response status code should be 200
00:00:00.000
And
the response field "id" should be 1
00:00:00.000
Given
the API base URL is "https://jsonplaceholder.typicode.com"
00:00:00.000
When
I send a GET request to "/users/2"
00:00:00.028
Then
the response status code should be 200
00:00:00.000
And
the response field "id" should be 2
00:00:00.000
Given
the API base URL is "https://jsonplaceholder.typicode.com"
00:00:00.000
When
I send a GET request to "/users/3"
00:00:00.027
Then
the response status code should be 200
00:00:00.000
And
the response field "id" should be 3
00:00:00.000