I've updated login form in Oro application so that now behat tests cannot login to application using 'Given I login as AmandaRCole@example.org buyer'.
The problem is that in this Feature Context (\Oro\Bundle\ApplicationBundle\Tests\Behat\Context\CommerceMainContext) it searches for 'Email Address' and 'Password' form inputs, however these form inputs now have another names. How can I override this context for our needs, or how can I change approach to make tests green?
Login step implemented in OroMainContext
It's implicitly or explicitly (e.g. OroUserBundle suite) by behat.yml
configuration injected in each test suite.
Selectors _username
, _password
and _submit
are hardcoded in the loginAsUserWithPassword
method.
You can either replace OroMainContext with your inheritor in all behat suites by BehatExtension, see Behat\Testwork\ServiceContainer\Extension
, or you can rewrite Oro\Bundle\FormBundle\Tests\Behat\Element\OroForm
and do your dirty hack there, because this class will fill the form. Don't forget to rewrite the class for OroForm
element in your behat.yml
The right way, I guess, will be to create a Login from, extended from OroForm
that should be used in OroMainContext
. This form will have method fill
that accept two arguments login
and password
. In this case, you will have rewrite only this tiny element to change the flow. But, I also guess, it's a long way to do so.