Skip to content

API accepts a JSON payload (Playwright)

### ✅ API accepts a JSON payload
- **Given** the client has the following JSON payload
**Payload**
```json
{
"email": "[email protected]",
"password": "secret",
"rememberMe": true
}
```
- **When** the client sends the request
- **Then** the response status should be 200
- **And** the response body should include "token"
import { test } from '@playwright/test';
import { story } from 'executable-stories-playwright';
test.describe('API', () => {
test('API accepts a JSON payload', async ({}, testInfo) => {
story.init(testInfo);
story.given('the client has the following JSON payload');
story.json({
label: 'Payload',
value: {
password: 'secret',
rememberMe: true,
},
});
story.when('the client sends the request');
story.then('the response status should be 200');
story.then('the response body should include "token"');
});
});