Persist Session Accross Scenarios and Features in Behat

95 views
Skip to first unread message

Саша Стаменковић

unread,
Sep 18, 2012, 7:35:52 AM9/18/12
to be...@googlegroups.com
Hi.

I'm very new in Behat, and I have one probably simple problem which I cannot solve on my own, I searched the doc, googled, but I just can't find the answer.

Here is my setup https://gist.github.com/38c170ea30adca747581

So, I have 2 hosts, in order to login I need to click a login link on http://admin.loc which then redirects to http://acme.loc/ and that works perfect.

But the error I get is: " Form field with id|name|label|value "search" not found."

This happens because session created in login.feature is not active in search.feature and I get redirected back to login, instead to be able to use features as authenticated user.

How can I fix this? How can I persist session accross features?

Regards,
Saša Stamenković


Christophe COEVOET

unread,
Sep 18, 2012, 8:21:34 AM9/18/12
to be...@googlegroups.com
Scenario are isolated. If you want to be logged in the scenario, it needs to be part of the scenario.
-- 
Christophe | Stof

Саша Стаменковић

unread,
Sep 18, 2012, 8:23:37 AM9/18/12
to be...@googlegroups.com
Hm, It's a bit copy-paste, isn't it? Plus it will be slow as hell.

Is there any better solution?

Thanks for your fast response.
---
Regards,
Saša Stamenković

Konstantin Kudryashov

unread,
Sep 18, 2012, 8:37:35 AM9/18/12
to be...@googlegroups.com
Backgrounds, instep calls, OOP. You choose.

--
Konstantin Kudryashov
--- PHP developer, BDD evangelist, Scrum master

Саша Стаменковић

unread,
Sep 18, 2012, 9:14:57 AM9/18/12
to be...@googlegroups.com
Thanks Konstantin.

Backgrounds did the job. Is there any way to reuse them between .feature files?

Is there a doc for instep calls, I can't find them?

Thanks again.
---
Regards,
Saša Stamenković
Reply all
Reply to author
Forward
0 new messages