2013-09-03 2 views
2

가 나는 그것의 아주 이상한 행동을 관찰하고, YII 프레임 워크에 Behat 사용을 참조하지 않습니다 그러나 일부는 아닙니다. 나는 내가 생각하는 페이지에 있는지 확인하기 위해 뷰 파일에 일종의 마커를 추가하고 Behat에게 보았다. 는 "내가 볼해야한다"

그래서, 시나리오는 "출력은 다음 이상한 내가 (테스트 환경에서) 페이지로 이동하면, 내가 포함한 모든 문구를 볼 수 있다는 것입니다

Scenario: editing journal 
    # features\journal.feature:21 
Given the following journals are present: 
    # FeatureContext::theFollowingJournalsArePresent() 
    | name  | link    | description   | 
    | Murzilka | http://www.murz.com | advanced child journal | 
    | Nature | www nature com  | nice journal   | 
When I am on edit page for journal "Nature" 
    # FeatureContext::iAmOnEditPageForJournal() 
Then I should see "Update Nature" 
    # FeatureContext::assertPageContainsText() 
Then I should see "nice journal" 
    # FeatureContext::assertPageContainsText() 
Then I should see "1qazxsw2" 
    # FeatureContext::assertPageContainsText() 
Then I should see "2wsxcde3" 
    # FeatureContext::assertPageContainsText() 
Then I should see "www nature com" 
    # FeatureContext::assertPageContainsText() 
    The text "www nature com" was not found anywhere in the text of the current page. 

입니다

Scenario: editing journal 
    Given the following journals are present: 
     | name   | link      | description   | 
     | Murzilka  | http://www.murz.com  | advanced child journal| 
     | Nature  | www nature com   | nice journal   | 
    When I am on edit page for journal "Nature" 
    Then I should see "Update Nature" 
    Then I should see "nice journal" 
    Then I should see "1qazxsw2" <-- a marker 
    Then I should see "2wsxcde3" <-- a marker 
    Then I should see "www nature com" 

입니다 www 자연 com ".

+0

내 사이트가 인코딩 헤더를 반환하지 않아서이 문제가 발생했습니다. 그게 너의 문제가 될 수 있을까? –

+0

잘 모르겠습니다. 나는''을 가지고 있으며 사실 특별한 기호를 사용하지 않는다. – Andrew

답변

2

"Then I see should ..."단계가 입력 필드의 텍스트를 가리키는 경우 문제가 산발적으로 나타납니다. 나는이 목적을 위해 다음과 같이 사용하도록되어 미리 정의 된 단계

Then /^the "(?P<field>(?:[^"]|\\")*)" field should contain "(?P<value>(?:[^"]|\\")*)"$/ 
    - Checks, that form field with specified id|name|label|value has specified value. 
    # FeatureContext::assertFieldContains() 

이 있음을 발견했습니다

이 수정으로
Then the "journal[name]" field should contain "nice journal" 

는 Behat 모든 문구를 찾습니다.

+0

나를 위해 일했습니다! 문맥에'[name]'을 추가 하였습니까? 아니면 해당 버전의 behat에 필요했기 때문입니까? 나는 그것을 필요로하지 않았고, 단지 상황에 맞는 것이라면 다소 혼란 스러웠습니다. 이것을 답으로 표시 할 수 있습니까? –