Behat/Mink 找不到 "Then" 语句的默认步骤

Behat/Mink not finding a default step for a "Then" statement

我无法Mink/Behat找到短语的默认步骤

Then I should see "some text" in the element "element"

这是我的 thepage.feature 文件:

Feature: Page Works
  In order to use the page
  As a visitor
  I need to be able to load it and see content

Scenario: Navigating to the page
  Given I am on "mypage.php"
  #Then I should see "some text"
  #Then the "body" element should contain "sometext"
  #Then I should see "sometext" in the "body" element

我的 FeatureContext 扩展了 MinkContext 所以我不明白为什么下面的两个 Then 语句未定义,但上面的语句有效。

  Scenario: Navigating to the page        # features\wikipedia.feature:6
    Given I am on "thepage.php"           # FeatureContext::visit()
    Then I should see "sometext" in the element "body"

1 scenario (1 undefined)
2 steps (1 undefined)

由于 Given 语句有效,我不明白哪里出了问题!肯定不能是yml文件或者composer.json?

composer.json:

{
    "require": {
        "behat/behat": "2.4.*@stable",
        "behat/mink": "1.4.*@stable",
        "behat/mink-extension": "*",
        "behat/mink-goutte-driver": "*",
        "behat/mink-selenium2-driver": "*"
    },
    "minimum-stability": "dev",
    "config": {
        "bin-dir": "bin/"
    }
}

behat.yml:

default:
  extensions:
    Behat\MinkExtension\Extension:
      base_url: http://localhost
      goutte: ~
      selenium2: ~

问题还可能出在哪里?谢谢

尝试使用

Then I should see "sometext" in the "body" element

而不是

Then I should see "sometext" in the element "body"

这里是MinkContext method description

试试这些(从 here 得到的):

composer.json

"require-dev": {
    "behat/behat": "2.5.5",
    "behat/mink-extension": "1.3.3",
    "behat/mink": "1.5.0",
    "behat/symfony2-extension": "1.1.2",
    "behat/mink-selenium2-driver": "1.1.1",
    "behat/mink-browserkit-driver": "1.1.0",
    "behat/mink-goutte-driver": "1.0.9"
}

behat.yml

default:
    formatter:
        name: pretty
        parameters:
            output_styles:
                comment: [ magenta ]
    context:
        class: Application\BackendBundle\Features\Context\FeatureContext
    extensions:
        Behat\Symfony2Extension\Extension:
            mink_driver: true
            kernel:
                env: test
                debug: true
        Behat\MinkExtension\Extension:
            base_url: 'http://football.local/app_test.php/'
            javascript_session: selenium2
            browser_name: firefox
            goutte: ~
            selenium2: ~
    paths:
        features: %behat.paths.base%/src
        bootstrap: %behat.paths.features%/Context

更多示例,look here