Open vitalets opened 1 week ago
This is working as expected from our side. We run worker fixture setup as part of a test for convenience reasons and don't do that for worker fixture teardown - hence the error happens. Do you mind elaborating about your use-case? I recommend to not use test.step in worker fixture teardown for now.
From the user's side the behavior is a bit inconsistent. I can wrap into steps some parts of fixture setup, but can't wrap into steps the fixture teardown. The use-case is trivial - imagine populating a database in a worker fixture:
myWorkerFixture: [async ({}, use) => {
await test.step('populate database records', () => { ... }); // <- this is allowed
await use();
await test.step('cleanup database records', () => { ... }); // <- this is NOT allowed
}, { scope: 'worker' }],
Version
1.49
Steps to reproduce
If
test.step()
is called in worker fixture setup - everything works fine. Iftest.step()
is called in worker fixture teardown - there is an errortest.step() can only be called from a test
.To reproduce: Please follow instructions in README: https://github.com/vitalets/playwright-issues/tree/test-step-worker-teardown
Expected behavior
Calling
test.step()
is either allowed in any phase of worker fixture OR is not allowed in worker fixtures.Actual behavior
Calling
test.step()
is allowed in setup phase of worker fixture, but fails in teardown phase of worker fixture.Additional context
No response
Environment