Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Automatic screenshot is not taken in case of error in fixture #29325

Closed
vitalets opened this issue Feb 2, 2024 · 2 comments · Fixed by #29337
Closed

[Bug]: Automatic screenshot is not taken in case of error in fixture #29325

vitalets opened this issue Feb 2, 2024 · 2 comments · Fixed by #29337
Assignees
Labels

Comments

@vitalets
Copy link
Contributor

vitalets commented Feb 2, 2024

Version

1.41.2

Steps to reproduce

  1. clone my repo at https://github.com/vitalets/playwright-issues
  2. npm install
  3. npm run test
  4. 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:
image

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:
image

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
@Abhi19990628
Copy link

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

@pavelfeldman
Copy link
Member

It is a Playwright Test bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants