Skip to content

Releases: SebastianSedzik/playwright-decorators

[email protected]

31 Jan 20:21
7012e2a
Compare
Choose a tag to compare

Minor Changes

  • #58 2962b6e Thanks @SebastianSedzik! - Add @retries decorator

    Set 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
        // ...
      }
    }

[email protected]

24 Jan 19:22
22efa8d
Compare
Choose a tag to compare

Minor Changes

  • #56 3a44870 Thanks @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.

    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
            // ...
        }
    }

[email protected]

11 Jan 18:55
1de3d56
Compare
Choose a tag to compare

Patch Changes

  • #51 a83fc39 Thanks @SebastianSedzik! - @test and @suite decorators do no longer keep logic related to fail, only, skip, slow. Code was moved to dedicated decorators.

[email protected]

07 Jan 18:42
7d7e141
Compare
Choose a tag to compare

Patch Changes

[email protected]

05 Jan 14:33
811c987
Compare
Choose a tag to compare

Patch Changes

  • #44 e8997d2 Thanks @SebastianSedzik! - Redact error messages thrown by custom decorators: createSuiteDecorator, createTestDecorator, createSuiteAndTestDecorator

[email protected]

04 Jan 14:02
529059a
Compare
Choose a tag to compare

Minor Changes

  • #40 a50e25b Thanks @SebastianSedzik! - Add @debug decorator

    Runs 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/debug

    import { 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 decorator

    Runs 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) {
        // ...
      }
    }

Patch Changes

[email protected]

03 Jan 12:22
b170fdc
Compare
Choose a tag to compare

Minor Changes

  • #38 dbea0b6 Thanks @SebastianSedzik! - Added support for creating custom test and suite decorator

    import { 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 **/
        })
      }
    )

Patch Changes

  • #38 dbea0b6 Thanks @SebastianSedzik! - Export TestInfo type

    import { suite, test, TestArgs, TestInfo } from '@playwright/test'
    
    @suite()
    class TestSuite {
      @test()
      myTest({ page }: TestArgs, testInfo: TestInfo) {
        // ...
      }
    }

[email protected]

02 Jan 12:17
bd10be1
Compare
Choose a tag to compare

Minor Changes

  • #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
        // ...
      }
    }

Patch Changes

  • #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.

[email protected]

01 Jan 18:04
173256e
Compare
Choose a tag to compare

Patch Changes

  • 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.

0.11.1

  • docs: add examples #28

0.11.0

29 December 2023

  • feat: add support for custom decorators #27
  • chore: release v0.11.0 dbc769b

0.10.1

4 August 2023

  • docs: remove unstable API warning from docs #25
  • chore: release v0.10.1 32dc5da

0.10.0

31 July 2023

  • feat: throw errors when missing @test or @suite decorators for given test or class #24
  • chore: release v0.10.0 7f21318

0.9.0

26 July 2023

  • feat: add @annotation decorator #23
  • chore: release v0.9.0 44918a3

0.8.1

22 July 2023

  • docs: add npm package version and test status badges to readme #22
  • chore: release v0.8.1 5d15406

0.8.0

22 July 2023

  • feat: add @fixme decorator #21
  • chore: release v0.8.0 28aa5d0

0.7.1

20 July 2023

  • chore: dependency update #20
  • chore: release v0.7.1 be51ffb

0.7.0

20 July 2023

  • chore: fix release process #19
  • feat: add @fail decorator #18
  • chore: release v0.7.0 0e48603

0.6.0

17 July 2023

  • feat: add @tag decorator #17
  • chore: release v0.6.0 f7bbe46

0.5.0

16 July 2023

  • feat: add @only decorator #16
  • test: fix @slow tests 6359e65
  • chore: release v0.5.0 8d69e29
  • docs: fix formatting 92b3e36

0.4.0

15 July 2023

  • feat: add @slow decorator #15
  • chore: release v0.4.0 f7de0c4

0.3.0

15 July 2023

  • chore: add keywords, license, fix peerDeps #14
  • feat(skip): add skip decorator #13
  • chore: release v0.3.0 545e2c2

0.2.0

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

0.1.2

12 July 2023

  • fix: access to fixtures from @test method #10
  • chore: release v0.1.2 516c41f
  • docs: add banner about early stage 8a72868

0.1.1

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

0.1.0

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

0.0.1

9 July 2023

  • ci: automate release #4
  • feat: add suite & test decorators #3
  • ci: automate release #2
  • chore: use linter & prettier #1
  • chore: initialize repo 6ec32a4
  • docs: initialize repo 6899678

Release 0.11.1

31 Dec 17:34
Compare
Choose a tag to compare