-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for multiple mink sessions? #56
Comments
To be clear: PageObject\Factory methods (in my opinion) should allowed an optional parameter: Mink session or Mink session name, to create Page or Element with required session injected. It would be very useful, especially when you deal with more than one session during single Scenario - now, you can only create Page (or Element) only for default Mink session, what is not sufficient in some cases (what affected us). |
What's in your opinion the best way to solve this issue? My first thought is it's a bit awkward to provide a mink session when asking for a page. I'd really like to have a proper solution for this before we tag a stable release. |
I think, it seems awkward as long as you don't use multiple Mink sessions. Page (from definition in constructor) is coupled with Mink session, so we have to consider Page instance as representation of page in particular browser. For now, you're not able to create Page instance for two different sessions, what is huge limitation (you can't use Mink fully, you're limited to default session). After 2 months work with multiple sessions during Scenario, I learnt, is nothing bad with passing session (or session name) to create representation of your UI objects. (BTW: the cause we're discussing this issue now is we have very similar concept to your extension called UiElementMapper - it's so similar, we decided to replace it with yours, but we found this issue). The point is, if you want to use more than one Mink Session, you have to manage them on your own within Context (for instance: define your steps in way allowing you to choose required session). In this case you also must be able to create Page for every Session you deal with. For me, the reasonable solution is to pass session name as an argument into factory's methods (I don't consider this awkward). Still, is an optional argument, so it doesn't break any BC but removes mentioned limitation. See example implementation here: dbojdo/BehatPageObjectExtension@sensiolabs:master...master |
One more notice. Generally, handling many Sessions during one Scenario is quite tricky. MinkContext supports steps like "I am on Page", which always refers to Default Mink session. If you want to use many sessions, you have to fetch required Session from Mink and deal with it rather than use predefined Mink's steps. (If fact, is the same issue). According to this, the other considerable solution is changing default Mink session on runtime (for example within step) but I think it's much more awkward (and may cause potential problems) than passing session name into factory's methods. Just my thoughts. How do you think, multi sessions scenarios should be handled? |
@dbojdo In my point of view, You can use change default Mink session on runtime, but it must occur within the one step. - Administrator change permmissions for User
- User get email to his inbox
- Manager create a Task for John user:
| Task Name | Time tracking |
| Deadline | Today | @dbojdo what is your cases? |
I have come across this issue when using multiple sessions in mink. Instantiate() method is restricted by Factory interface and cannot pass session as parameter. It would be very useful to have such feature. Have you been thinking about such implementation?
The text was updated successfully, but these errors were encountered: