https://github.com/qavajs/playwright-runner-adapter
Adapter to launch qavajs project with playwright runner
https://github.com/qavajs/playwright-runner-adapter
qa test-automation testing
Last synced: 5 months ago
JSON representation
Adapter to launch qavajs project with playwright runner
- Host: GitHub
- URL: https://github.com/qavajs/playwright-runner-adapter
- Owner: qavajs
- License: mit
- Created: 2024-03-29T20:14:31.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2026-02-06T21:30:09.000Z (5 months ago)
- Last Synced: 2026-02-07T00:46:50.340Z (5 months ago)
- Topics: qa, test-automation, testing
- Language: TypeScript
- Homepage: https://qavajs.github.io
- Size: 267 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://badge.fury.io/js/@qavajs%2Fplaywright-runner-adapter)
# @qavajs/playwright-runner-adapter
Adapter to run cucumber tests via playwright test runner
## Installation
```
npm install @qavajs/playwright-runner-adapter
```
## Basic Configuration
### Create cucumber config file
Set `paths` and `require` properties
```typescript
// cucumber.config.ts
import { defineConfig } from '@qavajs/playwright-runner-adapter';
export default defineConfig({
paths: ['test/features/*.feature'],
require: ['test/step_definitions/*.ts']
})
```
### Set testMatch property
Set `testMatch` to adapter
```typescript
import { defineConfig } from '@playwright/test';
export default defineConfig({
testMatch: 'cucumber.config.ts'
});
```
## Advanced Configuration
### Customizing test instance
Custom test instance can be passed to world constructor as `test` property.
And then fixtures can be connected with world instance via `init` function-property.
```typescript
import { test as base, expect as baseExpect } from '@playwright/test';
import { SettingsPage } from './settings-page';
import { setWorldConstructor, PlaywrightWorld } from '@qavajs/playwright-runner-adapter';
type MyFixtures = {
settingsPage: SettingsPage;
};
const customTest = base.extend({
settingsPage: async ({ page }, use) => {
await use(new SettingsPage(page));
},
});
const customExpect = baseExpect.extend({
async customMatcher() {
// implementation
}
});
class ExtendedPlaywrightWorld extends PlaywrightWorld {
settingsPage: SettingsPage;
constructor(options: any) {
super(options);
}
// set test property with extened one
test = customTest;
expect = customExpect;
// init arrow function connects fixtures with Cucumber world instance
init = ({ settingsPage }) => {
this.settingsPage = settingsPage;
}
}
```
### Tag expression and filter
It is possible to use regular tag expressions via `tags` util function
```typescript
import { tags } from '@qavajs/playwright-runner-adapter';
export default defineConfig({
grep: tags('@oneTag and @anotherTag')
});
```
or filter tests by predicate
```typescript
import { filter } from '@qavajs/playwright-runner-adapter';
export default defineConfig({
grep: filter(name => name.includes('login test'))
});
```
## Limitation
- ES modules are not supported (at least for node <= 22, where experimental ESM require is introduced)
- `setParallelCanAssign` is not supported (use playwright projects and `fullyParallel` property)
- `CUCUMBER_PARALLEL`, `CUCUMBER_TOTAL_WORKERS` and `CUCUMBER_WORKER_ID` env vars are not supported. Use built-in `info()` method of world property `test`