> Full documentation index: [llms.txt](https://docs.qualitymax.io/llms.txt)

# Convert Playwright to k6

Playwright and k6 answer different questions: Playwright verifies browser behavior, while a standard k6 script drives HTTP traffic at load. QualityMax extracts Playwright request-context calls and `page.goto()` URLs into a k6 starting point; it does not make browser interactions equivalent to protocol-level load.

## Convert a Playwright API test

In **Performance**, choose **Convert to k6** and either select an existing Playwright automation script or paste JavaScript with **Playwright (JavaScript)** selected. Choose the target test type, convert, and review every note and unsupported feature before saving.

### Before: Playwright request test

```js
import { test, expect } from '@playwright/test';

test('lists products', async ({ request }) => {
  const response = await request.get('https://staging.example.com/api/products');
  expect(response.ok()).toBeTruthy();
});
```

### After: runnable k6 JavaScript

```js
import http from 'k6/http';
import { check, sleep } from 'k6';

export const options = {
  stages: [{ duration: '1m', target: 5 }],
  thresholds: {
    http_req_failed: ['rate<0.01'],
    http_req_duration: ['p(95)<500'],
  },
};

export default function () {
  const response = http.get('https://staging.example.com/api/products');
  check(response, { 'status is 200': (result) => result.status === 200 });
  sleep(1);
}
```

Run with `k6 run products-api.js` after approving the target and load.

## Keep both tests

Retain the Playwright test for DOM assertions, accessibility, browser state, downloads, visual behavior, and multi-page flows. In the k6 script, manually restore headers, authentication, request bodies, response correlation, and domain-specific checks. A converted `page.goto()` represents an HTTP request, not a rendered-browser performance measurement.

Read [performance testing](/performance/) for load safety and [execution](/execution/) for test-run evidence.
