Closed omarlopesino closed 2 years ago
I am testing whether these changes work correctly in a specific project. As soon as it works it will be merged into the master branch.
We may use this issue as an opportunity to avoid code duplication: the gatherContexts method is the same on the three modified Contexts. Could be a Trait? An intermediary Class between the Contexts and RawMinkContext? A patch to MinkAwareContext?
It is possible to work on it the next time we have the same problem, or even open an issue for it.
Problem
In the cases that it is needed to extend MinkContext (s.e.: trying to wrap a specific MinkContext step), there is an error saying that
Drupal\DrupalExtension\Context\MinkContext
does not exist. It happens because the specific Drupal extension's MinkContext class is required in some contexts:But looking deeply in the code, the context doesn't need to be an instance of
Drupal\DrupalExtension\Context\MinkContext
, just an instance of\Behat\MinkExtension\Context\MinkContext
.Steps to reproduce
Change the behat.yml class of 'Drupal\DrupalExtension\Context\MinkContext' by a class that extends
Drupal\DrupalExtension\Context\MinkContext
. The error will appear just before beginning the first scenarioSolution
In the affected contexts, look for a context that is or extends
\Behat\MinkExtension\Context\MinkContext
. It will be safe enough knowing that there must only exist one instance of this class, as steps can't be duplicated among different contexts.