panther icon indicating copy to clipboard operation
panther copied to clipboard

Suggestion: Rename PANTHER_ERROR_SCREENSHOT_DIR to PANTHER_SCREENSHOT_DIR ...

Open ThomasLandauer opened this issue 4 years ago • 1 comments

... and use it for "normal" screenshots too.

When taking a screenshot with $client->takeScreenshot('screenshot.png'); the file is always created in public, right? So I'm suggesting to make this configurable, and (re)use the PANTHER_ERROR_SCREENSHOT_DIR environment variable for it.

ThomasLandauer avatar Apr 15 '21 19:04 ThomasLandauer

Here I am unable to get PANTHER_ERROR_SCREENSHOT_DIR to work at all. The 1.0.0 release notes state "Automatically take a screenshot when a test fail and if the PANTHER_ERROR_SCREENSHOT_DIR environment variable is set"

My phpunit.xml contains:

  <!-- ###+ symfony/panther ### -->
  <extensions>
    <extension class="Symfony\Component\Panther\ServerExtension" />
  </extensions>
  <!-- ###- symfony/panther ### -->

  <listeners>
    <listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
  </listeners>

  <php>
    ...
    
    <!-- ###+ symfony/panther ### -->
    <env name="PANTHER_ERROR_SCREENSHOT_DIR" value="/home/USER/Downloads"/>
    <!-- ###- symfony/panther ### -->
    
    ...
  </php>

And yet, on failed tests, no screenshot images are written anywhere, as far as I can tell. I've even tried adding $this->takeScreenshotIfTestFailed(); to setUp() on my base class. No effect.

arderyp avatar Apr 07 '22 00:04 arderyp