[5.0] Allow saving screenshots in a subdirectory #662
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have opened a similar PR in the php-webdriver repo, but since that is taking a long time to get merged I've decided to PR it straight into Dusk.
This PR adds the ability to save screenshots in subdirectories. Currently, the directory you give to the
$browser->screenshot()
method has to exist, else it will throw an exception. With this PR you can save the screenshot to a directory that does not exist, the directory will be created automatically.I take screenshots of many pages and flows within my application. Without saving screenshots in subdirectories, I get a long list of screenshots with long names:
user-activation-single-company-step-1.png
user-activation-single-company-step-2.png
user-activation-multiple-companies-step-1.png
user-activation-multiple-companies-step-2.png
With this PR you can I can create a structure like this, which is easier to navigate:
user-activation/single-company/step-1.png
user-activation/single-company/step-2.png
user-activation/multiple-companies/step-1.png
user-activation/multiple-companies/step-2.png