In Playwright, how to define globally functions to be automatically executed in testHooks?

26 views Asked by At

I am new to Playwright and I am struggling with hooks.

For my project, I need all tests and executions, to perform some actions on : beforeAll(), beforeEach(), afterEach() and afterAll() hooks.

Is there a way to define these actions in a fixture or config file (or something else)? The objective is to avoid calling the same functions in the same hooks for each .spec.ts file.

I tried to extend the 'test' object, use globalConfig and fixtures, but I never managed to make it work. and, globalConfig and teardown are not working because I need to access the 'test' object

0

There are 0 answers