You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a step definition that depends on the @email tag being present and I tried retrieving this using the ScenarioTagTrait. It appears this trait will only retrieve the tags for both the scenario and the feature inside a @beforeStep hook, it won't work in any other hooks or step definitions. ::getCurrentScenarioTags() expects a StepScope to be passed, this is only available in @beforeStep hooks. It looks this is the case because this has been written specifically for MinkContext::beforeJavascriptStep(). It seems it should be possible to make this more universally usable by making a few modifications.
It would be handy to always return the tags for the scenarios as well as the features. To make it clear this works not only for scenario tags I would rename this from ScenarioTagTrait to just TagTrait.
In addition to ::registerScenario() we can implement a ::registerFeature() method that keeps track of the current feature, and a ::getFeature() method to return it.
::getCurrentScenarioTags() could be renamed to ::getTags() and doesn't need a StepScope passed into it any more. It can instead call ::getFeature().
Since most of the time the developer would be interested whether a particular tag is present, it would be a nice addition to add a ::hasTag(string $tag): bool method.
The text was updated successfully, but these errors were encountered:
I have a step definition that depends on the
@email
tag being present and I tried retrieving this using theScenarioTagTrait
. It appears this trait will only retrieve the tags for both the scenario and the feature inside a@beforeStep
hook, it won't work in any other hooks or step definitions.::getCurrentScenarioTags()
expects aStepScope
to be passed, this is only available in@beforeStep
hooks. It looks this is the case because this has been written specifically forMinkContext::beforeJavascriptStep()
. It seems it should be possible to make this more universally usable by making a few modifications.ScenarioTagTrait
to justTagTrait
.::registerScenario()
we can implement a::registerFeature()
method that keeps track of the current feature, and a::getFeature()
method to return it.::getCurrentScenarioTags()
could be renamed to::getTags()
and doesn't need aStepScope
passed into it any more. It can instead call::getFeature()
.::hasTag(string $tag): bool
method.The text was updated successfully, but these errors were encountered: