percy / percy-capybara

Visual testing for Capybara with Percy.
https://docs.percy.io/docs/capybara
MIT License
45 stars 23 forks source link

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

Closed Robdel12 closed 3 years ago

Robdel12 commented 3 years ago

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