@blocken-jordy/test-library
v0.0.1
Published
Shared Playwright E2E testing library.
Readme
@wisemen/test-library
Shared Playwright E2E testing library.
Installation
pnpm add -D @wisemen/test-libraryUsage
Configuration
Create playwright.config.ts in your project root:
import { createConfig } from '@wisemen/test-library'
export default createConfig({
port: 4000,
envFile: '.env.test',
webServerCommand: 'pnpm dev --port 4000',
// Add other options or override projects
})Fixtures
Create tests/fixture/base.fixture.ts (or similar):
import { createTest } from '@wisemen/test-library'
import { authHandlers } from '@/mocks/handlers/auth.mock'
// Import other handlers
// Define your permission type if needed, or use string
type PermissionType = string
export const test = createTest<PermissionType>([
...authHandlers,
// ... other handlers
])Utilities
import { setupWebSocketMock, runAccessibilityCheck } from '@wisemen/test-library'Requirements
Projects using this library must provide:
- MSW Handlers: You must pass your MSW handlers to
createTest. - Permissions: If using
userPermissionsfixture, ensure your app readswindow.__TEST_PERMISSIONS__or similar if you want to mock permissions client-side, and the library handles setting them for MSW. - Environment Variables: Ensure
.env.test(or specified env file) exists.
