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

Add Capybara.touched_session_names method to retrieve used session names #2784

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alpaca-tc
Copy link

This method returns the names of all currently active sessions that have been used with using_session. Its primary purpose is to call save_screenshot for multiple sessions when a test fails.

Previously, it was difficult to retrieve session names during tests. With this addition, developers can now easily obtain all session names and save screenshots for each active session, enhancing debugging capabilities in multi-session test scenarios.

Additional Information

For example, in Rails, the take_failed_screenshot method captures a screenshot when a test fails. https://github.com/rails/rails/blob/e6429269fd5a8a7d728557f4e7d7f82c0ad1478c/actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb#L53-L58

Currently, this method only captures screenshots from the default session. However, when using multiple sessions with using_session, I would like to save screenshots for each active session. In Capybara’s current implementation, tracking the session names created with using_session is difficult, and the only workaround has been to override the method to achieve this functionality.

This method returns the names of all currently active sessions that have been used with `using_session`.
Its primary purpose is to call `save_screenshot` for multiple sessions when a test fails.

Previously, it was difficult to retrieve session names during tests. With this addition, developers
can now easily obtain all session names and save screenshots for each active session, enhancing
debugging capabilities in multi-session test scenarios.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant