Take screenshots and insert them in the json file#12
Take screenshots and insert them in the json file#12marcelovani wants to merge 12 commits intocawolf:masterfrom
Conversation
…sh to json report.
…sted was triggered and screenshots saved.
|
New approach, description updated |
cawolf
left a comment
There was a problem hiding this comment.
Thank you for this PR! I left some small notes for you to review.
README.md
Outdated
| - `fileName` _(optional)_: Filename of generated report - current feature name will be used by default. | ||
| Only applicable when `resultFilePerSuite` is not enabled. | ||
| - `resultFilePerSuite` _(optional)_: The default behaviour is to generate a single report named `all.json`. | ||
| - `screenshotExtension` _(optional)_: The name of the extension to be used to take screenshots. |
There was a problem hiding this comment.
This line should be a line lower. The next line ("If this option is set to true..." belongs to the resultFilePerSuite option, not to the screenshotExtension.
| // Integration with other Behat extensions that provide screenshot services. | ||
| $imageUploaderService = null; | ||
| if (!empty($config['screenshotExtension'])) { | ||
| $tags = $container->findTaggedServiceIds('screenshot.service'); |
There was a problem hiding this comment.
I did not check the referenced package too deeply, but I imagine that this service tag is introduced by the other package?
There was a problem hiding this comment.
Yes, I tried to come up with a generic solution
For reference https://github.com/elvetemedve/behat-screenshot/pull/62/files#diff-367a0438232ae30182922c4e9618bd66be531f661c4e57d09b710749010b7fb9R23
| $service = $container->get($id); | ||
| // Check if the configuration for the screenshot extension matches the namespace of the service. | ||
| if (strpos(get_class($service), $config['screenshotExtension']) !== false) { | ||
| $imageUploaderService = $service; |
There was a problem hiding this comment.
This code leads to the last of all matching services being selected as imageUploaderService, not the first. I assume this is intended behaviour?
If so, a short comment would be nice.
There was a problem hiding this comment.
That was not intentional. I added a break.
If you think we should change this behaviour, please let me know.
1ee56dd to
6a20e6c
Compare
Issue #10
What it does
screenshot.serviceand compare the class vs configurationTesting
Add these entries on
composer.jsonthen
Screenshot
