Repository navigation
Conversation
A Capybara node holds the session, and through it the driver and the browser connection. Walking its instance variables to build a failure message can take minutes with CDP-based drivers, so nodes are rendered with Capybara's own #inspect.
|
Hey @coorasse , thanks for the PR. There are two parts of SuperDiff's output. The first is the inspection, which affects how the "expected ... to eq/match/whatever ..." output looks. It looks like you've got that covered here; reusing Capybara's own The other part, which doesn't seem to be covered by this PR yet, is the diff, which comes below the inspection. See this output screenshot. I'm not familiar with Capybara, so I can't weigh in with much technical detail about how it should look. But if you don't add an operation tree builder, SuperDiff will select the default operation tree builder, which inspects instance variables, which will presumably do the thing we're trying to avoid here = walk into the driver. |
|
Thank you Joe for the feedback! I hopefully applied the changes you requested. |
When a failing expectation involves a Capybara element (e.g.
expect(page.find("button")).to be_disabled), SuperDiff builds the failure message by walking the element's instance variables.An element holds the session, and through it the driver and the browser connection (pages, network traffic, sockets). With CDP-based drivers like Cuprite/Ferrum this takes minutes, so the spec looks like it's hanging.
This adds an inspection tree builder for
Capybara::Node::BaseandCapybara::Driver::Nodethat uses Capybara's own#inspect(e.g.#<Capybara::Node::Element tag="h1" path="/html/body/h1">), mirroring the existingActionDispatch::Requestbuilder. It's loaded bysuper_diff/rspecwhen Capybara is present, or explicitly viarequire "super_diff/capybara".Capybara is added to the Rails appraisals so the unit specs can run against a real rack_test session.