Skip to content

[Docs]: mention worker fixtures are rerun on worker restart when tests fail #31785

Closed

Description

Page(s)

Description

It may be obvious to others, but I didn't realise that worker fixtures can get run multiple times if tests fail. I didn't know that workers get restarted when a test fails. When I read about worker fixtures, I got the idea that these fixtures would only be run once and be shared among all tests. I didn't expect any change to this behaviour if a test would fail.

I ended up finding out about this through experimentation and looking closely at the before hooks in the playwright UI for traces that happened after a previously failed test.

I don't think I would have known about this from looking at the docs. I don't think the worker fixture page talks about this or hints at it. Just says the fixture is shared among all of the worker's tests. It's on the page about "Worker index and parallel index" that mentions workers can be restarted. From that maybe this fixture behaviour I experienced is implied, but even then I think it could be clarified.

I'd suggest adding to the worker fixture page that workers restart on failed tests and that can lead to fixtures being run additional times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions