Closed ScreamingDev closed 9 years ago
Hi @sourcerer-mike that's correct. BehatMage is not aware of your domain so any step specifically defined outside of Behat or BehatMage. So in your specific case you should write the step definition code in a way that is going to look similar to the following:
<?php
/**
* @Then /^I should see text "([^"]+)"$/
*/
function iShouldSeeText($text) {
assertNotNull($this->find('xpath', '//h1[contains(., "'.$text.'")]'), "Text '$text' was not found on the page");
}
Please let me know if that helps
Well it either should have some or should be compatible with others so that it can go hand in hand with a subcontext.
@sourcerer-mike I'm not sure I'm following. There are certain steps that obviously are present already, pretty much all those available in standard Behat. But anything that is out of the known domain it can't be present, for instance what if you say
I should see text "text value"
And someone else says
I should see "text value"
we can't clearly support both
That might be. So it's the other way: compatibility with other contexts. As I added Mink as subcontext behat argues about duplicates.
Try this:
$this->useContext('subcontext_alias', new MinkContext());
Well the reason is that BehatContext extends RawMinkContext so it already inherits all the steps and methods that mink provides. As I said I am a bit confused about what's the problem is, if it's the lack of built-in steps, which is something we are woking on, or something else.
The simple steps like "I should see" etc. do not work Running behat as described in the README.md it fails to do this:
In a dry-run it tells me to create the step: