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

🐛 Gather current_session from Capybara rather than importing the DSL module #168

Merged
merged 2 commits into from
Jun 9, 2021

Conversation

Robdel12
Copy link
Contributor

@Robdel12 Robdel12 commented Jun 9, 2021

What is this?

Issue: #167 Using matches on the page class causes a infinite loop. 😱

The way we're getting the current page is by importing the Capybara DSL into the Percy module. Then we apply the module back to the Capybara class. In the process, we're surly clobbering things.

Approach

We're only including the DSL module to gain access to the current page session. We can copy exactly how the DSL defines the page method: https://github.com/teamcapybara/capybara/blob/master/lib/capybara/dsl.rb#L45-L47 which will avoid clobbering classes, as we're doing now.

Question

  • current_page method name? #letsbikeshed There's currently no methods in capybara with that name, but it feels like it's prone to be broken in the future. Do we do something hyper specific with naming for Percy? (percy_page or something? Something that won't clobber future method names?)

@Robdel12 Robdel12 requested a review from wwilsman June 9, 2021 18:37
lib/percy/capybara.rb Outdated Show resolved Hide resolved
Rather than including the Capybara DSL into the module and then clobbering back
onto the Capybara class. This is _much_ much better.
@Robdel12 Robdel12 force-pushed the rd/better-page-session-gathering branch from efce1d0 to bc77a5e Compare June 9, 2021 18:50
@Robdel12 Robdel12 requested a review from wwilsman June 9, 2021 18:50
Copy link
Contributor

@wwilsman wwilsman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎮

@Robdel12 Robdel12 added the 🐛 bug Something isn't working label Jun 9, 2021
@Robdel12 Robdel12 merged commit 64bde12 into master Jun 9, 2021
@Robdel12 Robdel12 deleted the rd/better-page-session-gathering branch June 9, 2021 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants