Library integrating GraphQL testing with Playwright and TypeScript. Version 2.2.1 provides auto-generated, type-safe GraphQL API clients with autocomplete, schema/operation generation, and optional coverage reporting. Key differentiators: built-in CLI for codegen, fixtures for Playwright test context, raw response access, negative testing support, and GraphQL coverage reports. Alternatives like Apollo Client or graphql-request lack Playwright-specific integration and testing utilities.
npm install playwright-graphqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to set up a GraphQL client fixture in Playwright test and use generated query/mutation operations.
Change import from `import getClient from ...` to `import { getClient } from ...`Use `getClient(apiContext, { raw: true })` but expect future API adjustments.Run `playwright-graphql --schema schema.gql` before trying to import generated types.
Provide only one source. Use --schema for local file, --url for remote endpoint.
Update @playwright/test to version 1.44 or higher.
Run the CLI command first: npx playwright-graphql --schema schema.gql
Change to: import { getClient } from 'playwright-graphql'Install: npm install -D @playwright/test@^1.44