playwright
playwright copied to clipboard
[Bug]: Automatic screenshot is not taken in case of error in fixture
Version
1.41.2
Steps to reproduce
- clone my repo at https://github.com/vitalets/playwright-issues
-
npm install
-
npm run test
- you should see html report opened
Expected behavior
As test failed, I expect automatic screenshot to appear in the report.
Actual behavior
There is no screenshot in the report:
Additional context
If error is thrown before call of use()
, screenshot correctly appears in the report:
import { test as base } from '@playwright/test';
const test = base.extend<{myFixture: void}>({
myFixture: async ({}, use) => {
throw new Error('foo'); // <- throw error in fixture, before use()
await use();
}
});
test('my test', async ({ page, myFixture }) => {
await page.goto('https://playwright.dev');
});
Report:
Environment
System:
OS: macOS 13.4.1
CPU: (8) arm64 Apple M1
Memory: 997.16 MB / 16.00 GB
Binaries:
Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
Yarn: 1.22.21 - ~/.nvm/versions/node/v18.16.0/bin/yarn
npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm
pnpm: 7.27.1 - ~/Library/pnpm/pnpm
IDEs:
VSCode: 1.85.2 - /usr/local/bin/code
Languages:
Bash: 3.2.57 - /bin/bash
npmPackages:
@playwright/test: 1.41.2 => 1.41.2
Error Handling in Fixtures... Check if there is proper error handling within your fixture code. If an exception occurs within a fixture, it might prevent subsequent code, including screenshot from being executed. Ensure that exceptions are caught, logged, or handled appropriately.
Screenshot Triggering Mechanism... Verify the logic that triggers automatic screenshot capture. Ensure that it is appropriately placed and invoked in case of errors within fixtures. It could be part of a global error-handling mechanism or specific to fixture failures
It is a Playwright Test bug.