is it possible to get test result in Playwright fixture? See the sample code below, how to access test result(passed/failed/skipped) after await use(todoPage);
in testFixture
? It would help me decide whether it need to do some afterEach job in the fixture.
Or shall I add a testFixture.afterEach()
in the myTest.spec.ts
? Is it a best practise?
const testFixture = base.extend<{ todoPage: TodoPage }>({
todoPage: async ({ page }, use) => {
const todoPage = new TodoPage(page);
await todoPage.goto();
await todoPage.addToDo( item1 );
await todoPage.addToDo( item2 );
await use(todoPage);
await todoPage.removeAll();
},
});
testFixture ( should add an item , async ({ todoPage }) => {
await todoPage.addToDo( my item );
// ...
});