@playwright-mocks/core
v2.2.18
Published
The playwright-mocks core package
Maintainers
Readme
@playwright-mocks/core
Core package for Playwright mocks management and test automation.
Installation
npm install @playwright-mocks/coreUsage
Basic Types
import { Mock, SearchRequest, SearchResponse } from '@playwright-mocks/core';
// Create a mock
const mock: Mock = {
id: 'unique-id',
url: '/api/users',
method: 'GET',
request: {
queryParams: { page: '1' }
},
response: {
status: 200,
body: { users: [] }
}
};
// Search with filters
const searchRequest: SearchRequest<Mock> = {
filters: {
methods: ['GET'],
statusCodes: [200]
},
pagination: {
page: 1,
perPage: 10
},
sort: {
field: 'id',
order: 'ASC'
}
};Filter Types
The package provides specific filter types for different entities:
MockFilters- for filtering mocksSpecFileFilters- for filtering spec filesTestFilters- for filtering testsTestDescribeFilters- for filtering test describes
TypeScript Support
This package includes full TypeScript support with declaration files. All types are exported from the main entry point.
Development
npm run core:build # Build the package
npm run core:test # Run tests
npm run core:test:watch # Run tests in watch modeLicense
ISC
