31

I'm current using Behat with Mink & Goutte Driver. When i'm trying to use it with my dev environment, via the app_dev.php file, which is a typical app_dev.php file from a Symfony2 Standard Edition, my tests are working just fine (Gists).

But, if I want to use a app_test file (which is the same as the app_dev file, except for the environment parameter set to "test" instead of "dev", and debug mode disabled), on the logout scenario, it seems that Goutte can't find the "user_signup" identifier, and in the "login" scenario, it does not find the "Root" text node. Indeed, when i'm using a print last response, it seems that the user is just not logged in : I still see the forms to log in an user...

When i'm on my dev environment (app_dev) or prod environment (app), everything seems to be working just fine though... Any idea ?

(If you think you need some other files, please tell me).

hakre
  • 178,314
  • 47
  • 389
  • 754
Talus
  • 754
  • 6
  • 18
  • Some fresh news : it seems that under the "test" environment, it is not a "PHPSESSID" cookie that contains the session id, like on prod & dev environements, but a "MOCKSESSID" cookie... Any ideas how to change the cookie name ? – Talus Oct 22 '12 at 15:12
  • Nevermind, i don't think this is linked to the session cookie name, as I can access my app_test in my browser, having this cookie and everything working just fine. The thing is, it seems that with that cookie and on Goutte, I have the message "Your session has expired or you have disabled your cookies", but i can see that Goutte do have cookies (the MOCKSESSID I was talking about earlier), so back to square one... – Talus Oct 22 '12 at 15:53
  • The name of the session id cookie mismatches. Check your configuration that that sessions id name matches again with your configuration. Otherwise the session is mocked per each request and you need to take care that the mocked session has the correct login status otherwise you will see the said error message. – hakre Oct 28 '12 at 14:32
  • The thing is, I'm testing directly with my browser (on `app_test.php`), and I do have the `MOCKSESSID` cookie. And everything works... But not when using Behat + Mink (+ Goutte). So, as I have this cookie with Mink (I checked with a `getCookieJar()`), meaning that the cookies are activated, it seems that the session is simply not set... – Talus Oct 31 '12 at 14:24

1 Answers1

1

By default, Mink uses session called "symfony2". That's why you get different results accessing from browser and using Behat. You can change that in your behat.yml file. Check this doc for more info: http://extensions.behat.org/symfony2/index.html#symfony2-mink-session

ualinker
  • 743
  • 4
  • 15
  • Then why is it different from the *prod* env, which is perfectly working with mink ?But heh, I'll try this as soon as i can, and I'll get back at you. – Talus Dec 13 '12 at 11:40