GraphQL API testing framework using Playwright and TypeScript against the SpaceX public GraphQL API.
GraphQL is a query language for APIs that allows clients to request exactly the data they need. Unlike REST APIs with multiple endpoints, GraphQL uses a single endpoint with flexible queries. Used by Facebook, GitHub, Twitter, and Shopify.
- Playwright APIRequestContext
- TypeScript
- GraphQL
- SpaceX Public GraphQL API
- GitHub Actions CI
graphql-api-testing/ ├── tests/ │ ├── launches.spec.ts # Launch query tests │ ├── rockets.spec.ts # Rocket query tests │ └── company.spec.ts # Company info tests ├── utils/ │ └── graphql.ts # GraphQL query helper ├── playwright.config.ts └── .github/workflows/ └── graphql-tests.yml
- Returns list of all launches
- Each launch has required fields
- Query with pagination limit
- Upcoming launches returns array
- Latest launch has required fields
- Returns list of all rockets
- Each rocket has required schema fields
- Query rockets with pagination
- Fetch single rocket by ID
- Returns company info with required fields
- Company name is SpaceX
- Company founded year is 2002
`graphql
query { launches(limit: 5) { id mission_name launch_success } }
`
�ash npm install npx playwright install chromium npm test # Run all tests npm run test:launches # Launches only npm run test:rockets # Rockets only npm run test:company # Company only
Darrius Jones - github.com/Djones-qa