I have a large problem with acceptance testing Laravel 4.0 using Codeception.
There are many problems with sessions, such as tests involving flashes not going through and logged in user treated as not logged in.
If I do {{ var_dump(Session::all()) }}
in view, which I'm testing (login page), then it goes through, but that's not true when I try to test login persistence (on index page that user gets redirected to after login).
It seems that flashes come through when I do it, but not Cartalyst Sentry sessions. Can you help me with that?
My test case:
<?php
$I = new WebGuy($scenario);
$I->wantToTest('login page');
$I->amOnPage('/panel/login');
$I->expectTo('see title of form');
$I->see('Logowanie');
$I->expectTo('see form fields');
$I->seeElement('input[type=text]');
$I->seeElement('input[type=password]');
$I->amGoingTo('log in without credentials');
$I->click('Zaloguj');
$I->expectTo('see errors');
$I->seeInCurrentUrl('/panel/login');
$I->see('Pole "Login" jest wymagane.'); // this and bottom one are flashes that don't go through if I don't include that weird snippet
$I->see('Pole "Hasło" jest wymagane.');
$I->amGoingTo('log in with wrong credentials');
$I->fillField('Login', 'bla');
$I->fillField('Hasło', 'blabla');
$I->click('Zaloguj');
$I->expectTo('see error');
$I->seeInCurrentUrl('/panel/login');
$I->see('Login lub hasło nieprawidłowe.');
$I->amGoingTo('log in with correct credentials');
$I->fillField('Login', 'admin');
$I->fillField('Hasło', 'admin');
$I->click('Zaloguj');
$I->expectTo('get redirected to homepage');
$I->canSeeCurrentUrlEquals('/');
$I->expectTo('be logged in');
$I->see('Witaj, Administrator');
$I->see('Wyloguj'); // this button is visible when user is logged in
Please help me, I was troubleshooting it for 3 days straight, and I'm fed up with this.
If you need any other info, just tell me, I will provide. This is a strange issue, so I don't really know, what to provide.