This guide is now available under this URL:
http://docs.behat.org/cookbook/bdd_in_symfony2_with_behat_mink_and_zombiejs.html
This guide is now available under this URL:
http://docs.behat.org/cookbook/bdd_in_symfony2_with_behat_mink_and_zombiejs.html
What about moving it into https://github.com/Behat/Behat-docs/tree/master/en/cookbook? I want this on docs.behat.org.
+1 @everzet
@everzet I tried the syntax highlighting, but didn't get it running, what did I miss? https://gist.github.com/1206414/54a7dd83709efe41c2b4a791534c327ba16fe835
@b00gizm Done.
+1 on the cookbook, will fork and rewrite into rst by tuesday.
@everzet Will do so!
Awesome :-)
when inserting @mink:zombie on the bdd experiment I get errors:
text\FeatureContext::assertElementContainsText()
And I should not see "Calvin Klein Black, 5" # Acme\DemoBundle\Features\Context\FeatureContext::assertPageNotContainsText()
The text "Calvin Klein Black, 5" appears in the text of this page, but it should not.
5 scenarios (4 passed, 1 failed)
48 steps (47 passed, 1 failed)
0m4.584s
I ran your bdd experiment from the guide in hopes to find a solution to my problem because i was getting
I resolved all things but this one when running zombie:
Could not load resource for URL 'http://h.local/app_test.php/pickup'
any hints please
appreciate it man @havvg
I will take a look into this, unfortunately I only ran the listings in zombie so far (just to try).
I tried the feature and get the same error. So it's not your side! Let me check that in details!
Thanks for pointing this out, @cordoval!
I added a print of the response.
Scenario: The categories link to their products list
Given I am on "/categories"
And I have a product "Calvin Klein Black, 5"
And I add product "Calvin Klein Black, 5" to category "Underwear"
And I have a product "Converse All Star, 8"
And I add product "Converse All Star, 8" to category "Shoes"
When I follow "Underwear"
Then I should see "Calvin Klein Black, 5" in the "#product-list li" element
And I should not see "Converse All Star, 8"
When I move backward one page
And I follow "Shoes"
And print last response
Then I should see "Converse All Star, 8" in the "#product-list li" element
And I should not see "Calvin Klein Black, 5"
| http://bdd.havvgbook/app_test.php/catagories/Shoes
|
| <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
| <link rel="stylesheet" href="/bundles/acmedemo/css/demo.css" type="text/css" media="all">
| <title>Catalog - Product List</title>
| <link rel="shortcut icon" href="/favicon.ico">
| </head>
| <body> <div id="symfony-wrapper"> <div id="symfony-header"> <a href="/app_test.php/"> <img src="/bundles/acmedemo/images/logo.gif" alt="Symfony">
| </a>
| <form id="symfony-search" method="GET" action="http://symfony.com/search"> <label for="symfony-search-field">
| <span>Search on Symfony Website</span>
| </label>
| <input name="q" id="symfony-search-field" type="search" placeholder="Search on Symfony website" class="medium_txt">
| <input type="submit" class="symfony-button-grey" value="OK">
| </form>
| </div>
| <div class="symfony-content"> <h1>Product List</h1>
| <ul id="product-list"> <li>Converse All Star, 8</li>
| </ul>
| </div>
| </div>
| </body>
| </html>
The response looks fine, seems the assertion is done on the wrong string.
I didn't find the cause by now.
In Behat\Mink\Behat\Context\BaseMinkContext::assertPageNotContainsText()
the $actual
variable contains the text from the previous response, not that of the current.
By adding the "I reload the page" step, it works with Zombie. My guess so far, the ZombieDriver or Zombie.js itself has an issue with the "move back" + "follow" steps.
@mink:zombie
Scenario: The categories link to their products list
Given I am on "/categories"
And I have a product "Calvin Klein Black, 5"
And I add product "Calvin Klein Black, 5" to category "Underwear"
And I have a product "Converse All Star, 8"
And I add product "Converse All Star, 8" to category "Shoes"
When I follow "Underwear"
Then I should see "Calvin Klein Black, 5" in the "#product-list li" element
And I should not see "Converse All Star, 8"
When I move backward one page
And I follow "Shoes"
And I reload the page
Then I should see "Converse All Star, 8" in the "#product-list li" element
And I should not see "Calvin Klein Black, 5"
just for the sake of others that may run into this situation some more on Zombie pitfalls you may encounter http://www.craftitonline.com/2011/09/zombie-pitfalls-part-ii/
update: work around does not work for all cases, I continue to see errors ahead of the run
Hi guys.
Im having the same Cordoval issue for the zombie driver:
text\FeatureContext::assertElementContainsText()
And I should not see "Calvin Klein Black, 5" # Acme\DemoBundle\Features\Context\FeatureContext::assertPageNotContainsText()
The text "Calvin Klein Black, 5" appears in the text of this page, but it should not.
5 scenarios (4 passed, 1 failed)
I'm using symfony2 beta3 with this config for composer:
"behat/behat": "2.4.*@stable",
"behat/mink": "1.4.*@stable",
"behat/symfony2-extension": "*",
"behat/mink-extension": "*",
"behat/mink-browserkit-driver": "*",
"behat/mink-selenium2-driver": "*",
"behat/mink-zombie-driver": "*"
I've tried to use default_session:symfony2, and use the @mink:zombie annotation, also just leaving the default_session:zombie.
Any advice? Thanks.
Did you try the reload step?
I'm not exactly sure, but I believe the issue is somewhere within Zombie.js.
There are even more issues with Zombie.js. That's why we switched to Sahi. It's not as fast, but by our experience with both variants way more reliable
@cordoval is a like minded individual
Hi again.
As @havvg suggested, putting a "And I reload the page" seems to work, the odd thing is that this needs to be put after each "When I move backward one page".
Seems a bug to me. Should I rely on this trick or should I move to another driver? Saphi?
Many thanks.
That's why we switched to Sahi.
Oh. Thanks. I was writing at the same time as you guys, now I notice your comments.
Thanks. I think I will make the switch to Sahi; I think it is not safe to rely a serious project with this kind of bug + workarounds :D
Many thanks.
The problem is that the development of Zombie.js went very fast in the last few month with a lot of refactoring and new internal libraries. It's pretty hard to keep up with all the compatibility issues, especially when you can only spent a pretty small amount on your time on your open source projects :-/
In my experience, everything below v0.13.0 works pretty well with the current version of the ZombieDriver.
@havvg
Great detailled tutorial. That'll help a lot of Symfony2 newsbies to get started.
But I think it's worth noticing that the ZombieDriver is best when it comes to Javascript / interaction testing. For "normal" HTML, it's fine to rely on Mink's Goutte driver :)