Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## [Unreleased](https://github.com/rubycdp/ferrum/compare/v0.18...main) ##
## [Unreleased](https://github.com/rubycdp/cuprite/compare/v0.18...main) ##

### Added

Expand All @@ -8,6 +8,7 @@
- `Driver#reset!` kept the page it had cached when the browser failed to reset, so every later example raised
`Session with given id not found` or `Browser is dead or given window is closed` instead of starting on a fresh
page [#274], [rubycdp/ferrum#641]
- `Node#visible?` reported an open popover or modal dialog as hidden when an ancestor had `opacity: 0` [#328]

### Removed

Expand Down
2 changes: 1 addition & 1 deletion lib/capybara/cuprite/javascripts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class Cuprite {
// an ancestor's opacity no longer applies to it once shown.
if (ancestorOpacityApplies) {
try {
if (node.matches(":modal") || node.matches(":popover-open")) {
if (node.matches(":modal, :popover-open")) {
ancestorOpacityApplies = false;
}
} catch (e) {}
Expand Down
10 changes: 10 additions & 0 deletions spec/features/session_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,16 @@
expect(popover.visible?).to be true
end

it "considers a child of a shown popover to be visible past opacity: 0" do
button = @session.find(:css, "#button_in_popover", visible: false)
expect(button.visible?).to be false

@session.execute_script("document.getElementById('popover_in_transparent').showPopover()")

expect(button.visible?).to be true
button.click
end

it "considers a shown modal dialog to be visible past opacity: 0" do
dialog = @session.find(:css, "#dialog_in_transparent", visible: false)
expect(dialog.visible?).to be false
Expand Down
5 changes: 4 additions & 1 deletion spec/support/views/visible.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
<span style="visibility: hidden">Hidden</span>
</div>
<section style="opacity: 0.0">
<div popover id="popover_in_transparent">Popover In Transparent</div>
<div popover id="popover_in_transparent">
Popover In Transparent
<button id="button_in_popover">Popover Item</button>
</div>
<dialog id="dialog_in_transparent">Dialog In Transparent</dialog>
</section>
<section style="display: none">
Expand Down
Loading