Yii Framework Forum: Behat Problem - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Behat Problem Behat can not find some text when using "I should see ..." ste Rate Topic: -----

#1 User is offline   veontomo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 24
  • Joined: 19-October 12

Posted 03 September 2013 - 04:10 PM

Hi there,
once I managed to install and configure Behat/Mink and the corresponding Yii extension, and after short period of joy, I am in trouble with quite enexpected behaviour of Behat that I described at stackoverflow and which I describe here.

I have a scenario
Scenario: editing journal
    Given the following journals are present:
        | name          | link                      | description           |
        | Gazzetta      | http://www.gazzetta.com   | sport news            | 
        | Murzilka      | www.murz.com              | advanced child journal|
        Given I am on edit page for journal "Gazzetta"
        Then I should see "Update Gazzetta"
        And I should see "sport news"
        And I should see "http://www.gazzetta.com"


The output of behat is this one:
 Scenario: editing journal
       # features\journal.feature:35

    Given the following journals are present:
       # FeatureContext::theFollowingJournalsArePresent()
      | name     | link                    | description            |
      | Gazzetta | http://www.gazzetta.com | sport news             |
      | Murzilka | www.murz.com            | advanced child journal |
    Given I am on edit page for journal "Gazzetta"
       # FeatureContext::iAmOnEditPageForJournal()
    Then I should see "Update Gazzetta"
       # FeatureContext::assertPageContainsText()
    And I should see "sport news"
       # FeatureContext::assertPageContainsText()
    And I should see "http://www.gazzetta.com"
       # FeatureContext::assertPageContainsText()
      The text "http://www.gazzetta.com" was not found anywhere in the text of the current page.


The strange thing is that when I see the corresponding page in browser (I am quite sure that this is namely that page that is used when I run the tests) I see all the phrases: "Update Gazzetta", "sport news" and "http://www.gazzetta.com".

Do you have any idea what it might be?
The more one gets to know of Yii, the more one values Yii.
0

#2 User is offline   realtebo 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 535
  • Joined: 03-October 12
  • Location:Ferrara

Posted 10 September 2013 - 10:12 AM

have you resolved ?

If don't try using 'Then print last response' and check in the raw html output if the string is really here.
Il computer non ragiona, ma ha sempre ragione.
Ricordalo quando fai il debug
0

#3 User is offline   veontomo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 24
  • Joined: 19-October 12

Posted 25 September 2013 - 04:30 AM

View Postrealtebo, on 10 September 2013 - 10:12 AM, said:

have you resolved ?

If don't try using 'Then print last response' and check in the raw html output if the string is really here.

Thanks a lot for the suggestion, I've not knew this command before though I was looking for it. It's sort of analog of "Then show me the page" in Cucumber.

Concerning the problem I've found a way out by making use of the following predefined step:


Then the "field_id" field should contain "text"


It's not so concise but it works.
The more one gets to know of Yii, the more one values Yii.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users