forceedge01 / behat-fail-aid

Get more out of your test suite by getting it to work with you when tests fail. Works with Goutte and MinkExtension (Selenium2Driver)
MIT License
28 stars 6 forks source link

How to configure screenshots? #71

Closed ptmkenny closed 4 years ago

ptmkenny commented 4 years ago

What is the issue?

I'm having trouble configuring screenshots.

The readme on the project page documents the configuration like this:


#behat.yml
...
- FailAid\Extension:
    screenshot:
        directory: /temp/failures/behat/screenshots/
        mode: default
        autoClean: false
        size: 1444x1280
        hostDirectory: /tmp/$USER/failures/
        hostUrl: http://ci/failures/$BRANCH_NAME/$JOB_NUMBER/failures/

So, I copied this into my behat.yml, changing the directory to /app/web/files, which I know behat can write to because I have other code that writes to that directory.

Next, I put - FailAid\Extension: at the root indentation level (the same level as default:. This didn't work, and I got the following error:

You cannot define a sequence item when in a mapping at line 88 (near "- FailAid\Extension:").

Next, I tried removing the - and using FailAid\Extension: at the root indentation level (the same as default). I did not get an error, but the screenshots were still saved to /tmp, not /app/web/files.

Next, I tried adding the config info under default extensions like this:

default:
  extensions:
    FailAid\Extension:
      output:
        screenshot:
          directory: /app/web/files

This gave another error about expecting a boolean and getting an array.

So where do I need to put the screenshot configuration in behat.yml to get it picked up correctly?

forceedge01 commented 4 years ago

Thanks for reporting the issue @ptmkenny. The readme does seem to have an issue and I'll update it soon. What version of behat are you using?

To solve your immediate issue, there is a behat.yml file in the root directory of this project that has all options enabled and runs part of the tests. Screenshot path is also part of that configuration, can you try using that please? When you do, please make sure all indentation is consistent across the file. Let me know if that resolves the issue.

ptmkenny commented 4 years ago

@forceedge01 Thanks, the behat.yml was all I needed to get it working. I'm running Behat 3.6.

forceedge01 commented 4 years ago

Fix to readme has been pushed now. Thanks for reporting @ptmkenny. Closing issue.