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

Configured output options to determine what code runs #50

Open forceedge01 opened 4 years ago

forceedge01 commented 4 years ago

Even though at this point we can control what to output as part of the failure summary, the code is executed regardless. In situations such as testing the API, a screenshot doesn't serve much of a purpose. While there are ways to not show the screenshot even if the output is not controllable individually by the context file (controlled by the extension definition), the code executed produces a 500 error because the configuration elements are different.

For example when testing an API, there is no page to visit - this logic should run only if a screenshot is asked for.

forceedge01 commented 4 years ago

Move logic into files that can check the output options. Don't run logic that isn't asked for. The options should be overridable by the context themselves.

forceedge01 commented 4 years ago

At present, the ->getPage() call throws an exception when working with requests on API.

forceedge01 commented 4 years ago

Partially implemented for screenshot and debug bar selectors.

forceedge01 commented 4 years ago

To make this safe, surround getUrl and getStatusCode calls as well with getOption call. add debugBarSelectors to output controlled options as well.

output: screenshot: false url: false status: false debugBarSelectors: false

forceedge01 commented 4 years ago

add trackJs to the list.

forceedge01 commented 4 years ago

Replace feature output with scenario output? Does rerun output help?