Skip to content
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

Step to switch Capybara sessions #66

Closed
matzke opened this issue Oct 4, 2016 · 4 comments
Closed

Step to switch Capybara sessions #66

matzke opened this issue Oct 4, 2016 · 4 comments

Comments

@matzke
Copy link

matzke commented Oct 4, 2016

http://collectiveidea.com/blog/archives/2011/08/04/simultaneous-capybara-sessions-in-cucumber/

@triskweline triskweline changed the title steps for session handling Step to switch Capybara sessions Oct 10, 2016
@foobear
Copy link
Member

foobear commented Aug 31, 2018

If a project wants to switch between multiple Capybara sessions, we recommend you add steps for that in the project. However, a single Capybara session is enough for almost all projects.

We won't be implementing this feature ourselves. Is this something you use regularly?

@matzke
Copy link
Author

matzke commented Sep 2, 2018

I use this regularly in projects with shared data access for testing optimistic locking (https://api.rubyonrails.org/classes/ActiveRecord/Locking/Optimistic.html) on data objects ...

  • user A logs in and starts editing a shared database entry/object
  • user B logs in and edits and saves the same object before A is ready
  • user A saves his object and gets an "sorry data is already updated, please review"

... or else data would be overwritten.

However I understand, that different projects do not work on shared data or do not test it, because of time/money/etc.

@triskweline
Copy link
Member

We have two projects where we also needed to test content locking. We solved that with custom steps that open new tabs via JavaScript. If we want to support this, I think the proposed step (When I am in the other user's browser) would make for a prettier Cucumber story than opening a new tab and hoping the test reader understands that this other tab represents the other user.

Another use case that I had once was realtime updates from another user (implemented with ActionCable, PubNubSub, Pusher or similar).

@foobear
Copy link
Member

foobear commented Sep 6, 2018

Using separate sessions for testing locking is a good use case, and saner than using a separate tab or window.

So let's add a step for that to Spreewald. Suggestions welcome. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants