Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: new release candidate #57

Merged
merged 2 commits into from
Jan 24, 2024
Merged

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Jan 24, 2024

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to master, this PR will be updated.

Releases

playwright-decorators@0.15.0

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

@SebastianSedzik SebastianSedzik merged commit 22efa8d into master Jan 24, 2024
4 checks passed
@SebastianSedzik SebastianSedzik deleted the changeset-release/master branch January 24, 2024 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant