-
#58
2962b6e
Thanks @SebastianSedzik! - Add@retries
decoratorSet the maximum number of retry attempts given to failed
@tests
in the@suite
import { suite, test, retries } from "playwright-decorators"; @retries(3) // <-- Decorate suite with @retries() @suite() class MyTestSuite { @test() async test() { // <- This test may be retried up to 3 times if it fails // ... } }
-
#56
3a44870
Thanks @SebastianSedzik! - Add support for fixturesThis release introduce a new method
extend<T>(customFixture)
that allows to create decorators (afterAll
,afterEach
,test
,beforeAll
,beforeEach
) with access to custom fixtures.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 // ... } }
- #51
a83fc39
Thanks @SebastianSedzik! -@test
and@suite
decorators do no longer keep logic related tofail
,only
,skip
,slow
. Code was moved to dedicated decorators.
- #49
f76265e
Thanks @dependabot! - Bump development dependencies
- #44
e8997d2
Thanks @SebastianSedzik! - Redact error messages thrown by custom decorators:createSuiteDecorator
,createTestDecorator
,createSuiteAndTestDecorator
-
#40
a50e25b
Thanks @SebastianSedzik! - Add@debug
decoratorRuns a
@test
(s) or@suite
(s) in debug mode. Tests or suites without the@debug
decorator will not be excluded. Learn more about debug mode: https://playwright.dev/docs/debugimport { suite, test, debug, TestArgs } from "playwright-decorators"; // Debug selected test suite(s) @debug() // <-- Decorate suite with @debug() @suite() class DebugTestSuite {} // Or debug selected test(s) @suite() class TestSuite { @debug() // <-- Decorate test with @debug() @test() async test({ page }: TestArgs) { // ... } }
-
#42
a2e7892
Thanks @SebastianSedzik! - Add@preview
decoratorRuns a
@test
(s) or@suite
(s) in preview (headed browser) mode, simulating user interaction (slowing down each operation by 1000ms). Tests or suites without the@preview
decorator will not be excluded.import { suite, test, preview, TestArgs } from "playwright-decorators"; // Preview selected test suite(s) @preview() // <-- Decorate suite with @preview() @suite() class PreviewTestSuite {} // Or preview selected test(s) @suite() class TestSuite { @preview() // <-- Decorate test with @preview() @test() async test({ page }: TestArgs) { // ... } }
- #43
ccc39fc
Thanks @SebastianSedzik! - Restructure readme file
-
#38
dbea0b6
Thanks @SebastianSedzik! - Added support for creating custom test and suite decoratorimport { createSuiteAndTestDecorator } from "playwright-decorators"; import playwright from "@playwright/test"; const mySuiteAndTestDecorator = createSuiteAndTestDecorator( "mySuiteAndTestDecorator", ({ suite }) => { suite.initialized(() => { /** run custom code when suite is initialized **/ }); }, ({ test }) => { test.beforeTest(() => { /** run custom code before test execution **/ }); test.afterTest(() => { /** run custom code after test execution **/ }); playwright.beforeEach(() => { /** run custom code before each test execution **/ }); }, );
-
#38
dbea0b6
Thanks @SebastianSedzik! - ExportTestInfo
typeimport { suite, test, TestArgs, TestInfo } from "@playwright/test"; @suite() class TestSuite { @test() myTest({ page }: TestArgs, testInfo: TestInfo) { // ... } }
-
#35
8ba55c6
Thanks @SebastianSedzik! - Enhanced TypeScript support:- constrained the
@suite
decorator to class contexts only. - constrained the
@test
decorator to class method context only. Type check of test method arguments. - exported the
TestArgs
type to provide validity within test methods.
import { suite, test, TestArgs } from "playwright-decorators"; @suite() class ExampleSuite { @test() async exampleTest({ page }: TestArgs) { // <- TestArgs ensures correct types of arguments // ... } }
- constrained the
-
#29
7398cc2
Thanks @SebastianSedzik! - Fixes of@skip
and@annotate
decorators:- Pass
reason
from@skip
decorator to the reporter. - Added support for annotations on skipped tests.
- Pass
- 95c69a7: Use changeset to release process. Make test release
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
Generated by auto-changelog
.
- docs: add examples
#28
29 December 2023
4 August 2023
31 July 2023
- feat: throw errors when missing
@test
or@suite
decorators for given test or class#24
- chore: release v0.10.0
7f21318
26 July 2023
22 July 2023
22 July 2023
20 July 2023
20 July 2023
17 July 2023
16 July 2023
- feat: add
@only
decorator#16
- test: fix
@slow
tests6359e65
- chore: release v0.5.0
8d69e29
- docs: fix formatting
92b3e36
15 July 2023
15 July 2023
- chore: add keywords, license, fix peerDeps
#14
- feat(skip): add skip decorator
#13
- chore: release v0.3.0
545e2c2
13 July 2023
- feat: add
afterAll
,afterEach
,beforeAll
,beforeEach
decorators#12
- fix: use dynamic fixtures instead of hardcoded
#11
- chore: release v0.2.0
bff619f
12 July 2023
- fix: access to fixtures from @test method
#10
- chore: release v0.1.2
516c41f
- docs: add banner about early stage
8a72868
11 July 2023
- fix: fix
this
context in@test
method#9
- ci: add GH actions for building, linting and testing package before merge
#8
- chore: update changelog
4b0cabf
- chore: release v0.1.1
657f1c4
11 July 2023
- chore: add release process
#7
- add tests, refactors base decorators, update readme
#6
- refactor: refactor suite and test decorators
#5
- chore: release v0.1.0
2011458
- chore: fix release process command
18d274b
9 July 2023