Skip to content

Commit

Permalink
chore: new release candidate (#57)
Browse files Browse the repository at this point in the history
* chore: new release

* docs: fix contributor name in generated changelog

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Sebastian Sędzik <[email protected]>
  • Loading branch information
3 people committed Jan 24, 2024
1 parent 3a44870 commit 22efa8d
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 54 deletions.
53 changes: 0 additions & 53 deletions .changeset/slimy-spiders-cover.md

This file was deleted.

54 changes: 54 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,59 @@
### Changelog

## 0.15.0

### Minor Changes

- [#56](https://github.com/SebastianSedzik/playwright-decorators/pull/56) [`3a44870`](https://github.com/SebastianSedzik/playwright-decorators/commit/3a44870c0ef5f420744d944549fb0491cb1cb199) Thanks [@SebastianSedzik](https://github.com/SebastianSedzik)! - Add support for fixtures

This release introduce a new method `extend<T>(customFixture)` that allows to create decorators (`afterAll`, `afterEach`, `test`, `beforeAll`, `beforeEach`) with access to custom fixtures.

```ts
import { test as base } from 'playwright';
import { suite, test, extend } from 'playwright-decorators';

// #1 Create fixture type
type UserFixture = {

firstName: string;
lastName: string;
}
}

// #2 Create user fixture
const withUser = base.extend<UserFixture>({
({}, use) => {
await use({
firstName: 'John',
lastName: 'Doe'
})
}
})

// #3 Generate afterAll, afterEach, test, beforeAll, beforeEach decorators with access to the user fixture
const {
afterAll,
afterEach,
test,
beforeAll,
beforeEach,
} = extend<UserFixture>(withUser);

// #4 Use decorators
@suite()
class MyTestSuite {
@beforeAll()
async beforeAll({ user }: TestArgs<UserFixture>) { // have access to user fixture
// ...
}

@test()
async test({ user }: TestArgs<UserFixture>) { // have access to user fixture
// ...
}
}
```

## 0.14.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "playwright-decorators",
"version": "0.14.3",
"version": "0.15.0",
"description": "Decorators for writing Playwright based tests.",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down

0 comments on commit 22efa8d

Please sign in to comment.