Closed michael-yelnikov closed 8 months ago
By the way, “goto” is not displayed also
They are all available under the Before Hooks.
Here is how fixtures work:
allureFixture: async ({}, use) => {
// this code runs before test for setup
await use(); // <-- test runs inside this call
// this code runs after test for tear down
}
and the report looks like this:
You'll see two entries for the allureFixture
, one is before the test and another is after.
When you wrap use() with a step:
allureFixture: [
async ({}, use) => {
await test.step("Allure fixture description", async () => {
await use();
});
},
You give reporter an impossible task to show before and after separately, but at the same time to show them under the same step. Playwright falls back to attributing the entire step to where it was called and places it in its entirety to under before hooks.
You probably don't need the step as fixtures get automatic steps generated already as seen on the screenshot. But if you want a synthetic entry you can always do something like this:
async ({}, use) => {
expect(true, 'Setting up allure').toBeTruthy();
await use();
expect(true, 'Tearing down allure').toBeTruthy();
},
Closing as per above
System info
Source code
test.ts:
Steps to Reproduce:
Expected Result: The custom message inside the test should be displayed in the report as an individual step.
Actual Result: The custom message is not displayed in the report.
It was happened after: https://github.com/microsoft/playwright/issues/28528
Why need to use asynchronous code in a fixture is a rhetorical question 😄