|
| 1 | +--- |
| 2 | +id: smartui-shadow-dom |
| 3 | +title: Shadow DOM |
| 4 | +sidebar_label: Shadow DOM |
| 5 | +description: In this documentation, learn about about the shadow dom feature of smartui |
| 6 | +keywords: |
| 7 | + - Visual Regression |
| 8 | + - Visual Regression Testing Guide |
| 9 | + - Visual Regression Test Automation |
| 10 | + - Visual Regression Automation Testing |
| 11 | + - Running Visual Regression Tests |
| 12 | + - Visual Regression Testing Online |
| 13 | + - Run Visual Regression |
| 14 | + - Visual Regression Run Specific Test |
| 15 | + - Visual Regression Testing Environment |
| 16 | + - How to Run Visual Regression Tests |
| 17 | +url: https://www.lambdatest.com/support/docs/smartui-shadow-dom/ |
| 18 | +slug: smartui-shadow-dom/ |
| 19 | +--- |
| 20 | + |
| 21 | +import Tabs from '@theme/Tabs'; |
| 22 | +import TabItem from '@theme/TabItem'; |
| 23 | +import NewTag from '../src/component/newTag'; |
| 24 | + |
| 25 | +<script type="application/ld+json" |
| 26 | + dangerouslySetInnerHTML={{ __html: JSON.stringify({ |
| 27 | + "@context": "https://schema.org", |
| 28 | + "@type": "BreadcrumbList", |
| 29 | + "itemListElement": [{ |
| 30 | + "@type": "ListItem", |
| 31 | + "position": 1, |
| 32 | + "name": "LambdaTest", |
| 33 | + "item": "https://www.lambdatest.com" |
| 34 | + },{ |
| 35 | + "@type": "ListItem", |
| 36 | + "position": 2, |
| 37 | + "name": "Support", |
| 38 | + "item": "https://www.lambdatest.com/support/docs/" |
| 39 | + },{ |
| 40 | + "@type": "ListItem", |
| 41 | + "position": 3, |
| 42 | + "name": "Smart Multiple Assets", |
| 43 | + "item": "https://www.lambdatest.com/support/docs/smartui-shadow-dom/" |
| 44 | + }] |
| 45 | + }) |
| 46 | + }} |
| 47 | +></script> |
| 48 | +The Shadow DOM feature in SmartUI allows for testing and capturing assets from content encapsulated within web components. Web components often use Shadow DOM to encapsulate their internal structure and styling, isolating it from the main document. As a result, traditional DOM queries and asset capturing methods might not access or interact with content inside the shadow tree. |
| 49 | + |
| 50 | +SmartUI's Shadow DOM support ensures that assets and UI components rendered within shadow roots are correctly captured and tested, making it easier to handle and test web applications built using web components that leverage the Shadow DOM. |
| 51 | + |
| 52 | +## Purpose of the Shadow DOM Feature |
| 53 | +In typical UI tests, SmartUI captures assets and evaluates elements directly from the DOM of the page under test. However, when content is encapsulated inside a Shadow DOM (within a web component), it becomes isolated, and the test framework might not be able to access or interact with it. |
| 54 | + |
| 55 | +SmartUI's Shadow DOM feature addresses this limitation by: |
| 56 | + |
| 57 | +- Enabling SmartUI to traverse and interact with shadow trees. |
| 58 | +- Allowing tests to capture assets from the shadow DOM. |
| 59 | +- Ensuring that resources (e.g., styles, images, scripts) inside shadow roots are included in the testing process. |
| 60 | + |
| 61 | +This feature is critical for comprehensive testing of modern web applications that make use of custom elements and web components, which are often built with Shadow DOM for encapsulation. |
0 commit comments