-
Notifications
You must be signed in to change notification settings - Fork 9
Take screenshots and insert them in the json file #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
6bf5ffb
70cb8e4
0619938
643cb6c
8e09af2
b32670f
e0e4d43
e0e04bc
f3d0419
6a20e6c
61605c3
ce27505
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,7 @@ public function configure(ArrayNodeDefinition $builder): void | |
| $builder->children()->scalarNode('fileNamePrefix')->defaultValue(''); | ||
| $builder->children()->scalarNode('outputDir')->defaultValue('build/tests'); | ||
| $builder->children()->scalarNode('fileName'); | ||
| $builder->children()->scalarNode('screenshotExtension'); | ||
| $builder->children()->booleanNode('resultFilePerSuite')->defaultFalse(); | ||
| } | ||
|
|
||
|
|
@@ -41,6 +42,24 @@ public function load(ContainerBuilder $container, array $config): void | |
| $definition->addArgument($config['fileNamePrefix']); | ||
| $definition->addArgument($config['outputDir']); | ||
|
|
||
| // Integration with other Behat extensions that provide screenshot services. | ||
| $imageUploaderService = null; | ||
| if (!empty($config['screenshotExtension'])) { | ||
| $tags = $container->findTaggedServiceIds('screenshot.service'); | ||
| foreach (array_keys($tags) as $id) { | ||
| // Check if the container has the definitions for the service. | ||
| if ($container->hasDefinition($id)) { | ||
| $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; | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code leads to the last of all matching services being selected as
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That was not intentional. I added a break. |
||
| break; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| $definition->addArgument($imageUploaderService); | ||
|
|
||
| if (!empty($config['fileName'])) { | ||
| $definition->addMethodCall('setFileName', [$config['fileName']]); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I tried to come up with a generic solution
For reference https://github.com/elvetemedve/behat-screenshot/pull/62/files#diff-367a0438232ae30182922c4e9618bd66be531f661c4e57d09b710749010b7fb9R23