You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Which is the expected DetachedShadowRootError, so I just added a test on the shadowroot expect to validate the implementation and we should remove the rb label from #13580
Motivation and Context
Tests such as this are important to validate we throw the expected error, when as in this case the shadow root gets detached from the element
Types of changes
Bug fix (non-breaking change which fixes an issue)
New feature (non-breaking change which adds functionality)
Breaking change (fix or feature that would cause existing functionality to change)
Test Coverage Ensure that the new test case 'raises error if the shadow root is detached' covers all necessary scenarios and edge cases for the DetachedShadowRootError. Consider adding assertions for the error message content to ensure it matches expected output.
Why: Adding an assertion to verify the shadow root detachment ensures the test's accuracy and reliability, making it a valuable improvement.
9
Possible bug
Add a nil check for the div element after it is found to ensure it exists
It's recommended to add a check to ensure that div is not nil after finding the element. This will prevent potential errors if the element is not found on the page.
div = driver.find_element(css: 'div')
+raise 'Div element not found' if div.nil?
Apply this suggestion
Suggestion importance[1-10]: 8
Why: Adding a nil check for the div element is a good practice to prevent potential runtime errors if the element is not found, enhancing the robustness of the test.
8
Enhancement
Use a before block for common setup steps to enhance test efficiency
Consider using before block to navigate to the page and set up the shadow root once for tests that require similar setup, improving test efficiency and reducing redundancy.
Why: Using a before block for common setup steps can improve test efficiency and reduce redundancy, although it might not be necessary if the setup is unique to this test.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
Description
While investigating #13580, I noticed that the shadow root implementation done here:
d44b41b
Returns the following error:
Which is the expected DetachedShadowRootError, so I just added a test on the shadowroot expect to validate the implementation and we should remove the rb label from #13580
Motivation and Context
Tests such as this are important to validate we throw the expected error, when as in this case the shadow root gets detached from the element
Types of changes
Checklist
PR Type
Tests
Description
DetachedShadowRootError
is raised when a shadow root is detached.NoMethodError
.Changes walkthrough 📝
shadow_root_spec.rb
Add test case for detached shadow root error
rb/spec/integration/selenium/webdriver/shadow_root_spec.rb
DetachedShadowRootError
.div
, removes thediv
, and expects an error when accessing the shadowroot.