Skip to content

Commit

Permalink
[rb] Add test for detached shadow root error type (#14267)
Browse files Browse the repository at this point in the history
Co-authored-by: aguspe <agustin.pe94@gmail.com>
  • Loading branch information
aguspe and aguspe authored Jul 19, 2024
1 parent 2de94e3 commit 5761c71
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions rb/spec/integration/selenium/webdriver/shadow_root_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ module WebDriver
expect { div.shadow_root }.to raise_error(Error::NoSuchShadowRootError)
end

it 'raises error if the shadow root is detached', exclude: {browser: :safari, reason: 'NoMethodError'} do
driver.navigate.to url_for('simpleTest.html')
div = driver.find_element(css: 'div')
driver.execute_script('arguments[0].attachShadow({ mode: "open" });', div)
root = div.shadow_root
driver.execute_script('arguments[0].remove();', div)
expect { root.find_element(css: '#x') }.to raise_error(Error::DetachedShadowRootError)
end

it 'gets shadow root from script',
exclude: {browser: :safari, reason: 'returns correct node, but references shadow root as a element'} do
shadow_root = custom_element.shadow_root
Expand Down

0 comments on commit 5761c71

Please sign in to comment.