1

I am using Cucumber integration with Playwright (e.g. https://github.com/e2e-boilerplate/playwright-commonjs-cucumber-expect/blob/master/features/support/steps.js). Because of this I don't have a playwright config file and I launch the browser manually

e.g.

    const browser = await playwright.chromium.launch({ headless: true, u });
    const context = await browser.newContext();
    const page = await sharedContext.newPage();

However, I would like to configure Playwright to take a screenshot if a test fails (as described here: https://playwright.dev/docs/test-configuration#automatic-screenshots).

Is this possible, or does use of Cucumber to run the tests mean this functionality becomes unavailable?

goofballLogic
  • 37,883
  • 8
  • 44
  • 62
  • Did you try setting the flag `screenshot: 'only-on-failure',` in your `playwright.config.ts`? – Alapan Das Sep 02 '22 at 13:52
  • Try using test.use, and set screenshot config. This is local per test configuration. Maybe you could combine it with fixtures for better coverage https://playwright.dev/docs/test-configuration#local-configuration – senaid Sep 02 '22 at 15:12

0 Answers0