|
| 1 | +--- |
| 2 | +id: smartui-handle-dynamic-data |
| 3 | +title: Handle Dynamic Data |
| 4 | +sidebar_label: Dynamic Data |
| 5 | +description: SmartUI can now phandle dynamic data |
| 6 | +keywords: |
| 7 | + - lambdatest |
| 8 | + - smart ui |
| 9 | + - videos |
| 10 | + - storybook |
| 11 | +url: https://www.lambdatest.com/support/docs/smartui-handle-videos/ |
| 12 | +site_name: LambdaTest |
| 13 | +slug: smartui-handle-dynamic-data/ |
| 14 | +--- |
| 15 | + |
| 16 | +import Tabs from '@theme/Tabs'; |
| 17 | +import TabItem from '@theme/TabItem'; |
| 18 | + |
| 19 | +<script type="application/ld+json" |
| 20 | + dangerouslySetInnerHTML={{ __html: JSON.stringify({ |
| 21 | + "@context": "https://schema.org", |
| 22 | + "@type": "BreadcrumbList", |
| 23 | + "itemListElement": [{ |
| 24 | + "@type": "ListItem", |
| 25 | + "position": 1, |
| 26 | + "name": "LambdaTest", |
| 27 | + "item": "https://www.lambdatest.com" |
| 28 | + },{ |
| 29 | + "@type": "ListItem", |
| 30 | + "position": 2, |
| 31 | + "name": "Support", |
| 32 | + "item": "https://www.lambdatest.com/support/docs/" |
| 33 | + },{ |
| 34 | + "@type": "ListItem", |
| 35 | + "position": 3, |
| 36 | + "name": "Handle Videos", |
| 37 | + "item": "https://www.lambdatest.com/support/docs/smartui-handle-dynamic-data/" |
| 38 | + }] |
| 39 | + }) |
| 40 | + }} |
| 41 | +></script> |
| 42 | + |
| 43 | +When conducting visual tests, you may encounter scenarios where certain elements within your application change between test runs. These changes might introduce inconsistencies in your test results.You can ignore / select specific element(s) to be removed from the comparison by parsing the options in the `smartuiSnapshot` function in the following way |
| 44 | + |
| 45 | + |
| 46 | +<Tabs className="docs__val" groupId="framework"> |
| 47 | +<TabItem value="IgnoreID" label="Ignore ID" default> |
| 48 | + |
| 49 | +```js title="This is a sample for your configuration for Javascript to ignore by ID" |
| 50 | +let options = { |
| 51 | + ignoreDOM: { |
| 52 | + id: ["ID-1", "ID-2"], |
| 53 | + } |
| 54 | + } |
| 55 | + await driver.get('Required URL'); |
| 56 | + await smartuiSnapshot(driver, 'Screenshot Name', options); |
| 57 | +``` |
| 58 | + |
| 59 | +</TabItem> |
| 60 | +<TabItem value="IgoreClass" label="Ignore Class"> |
| 61 | + |
| 62 | +```js title="This is a sample for your configuration for Javascript to ignore by Class" |
| 63 | +let options = { |
| 64 | + ignoreDOM: { |
| 65 | + class: ["Class-1", "Class-2"], |
| 66 | + } |
| 67 | + } |
| 68 | + await driver.get('Required URL'); |
| 69 | + await smartuiSnapshot(driver, 'Screenshot Name', options); |
| 70 | +``` |
| 71 | + |
| 72 | +</TabItem> |
| 73 | +<TabItem value="IgnoreXPath" label="Ignore XPath"> |
| 74 | + |
| 75 | +```js title="This is a sample for your configuration for Javascript to ignore by XPath" |
| 76 | +let options = { |
| 77 | + ignoreDOM: { |
| 78 | + xpath: ["Xpath-1", "Xpath-2"], |
| 79 | + } |
| 80 | + } |
| 81 | + await driver.get('Required URL'); |
| 82 | + await smartuiSnapshot(driver, 'Screenshot Name', options); |
| 83 | +``` |
| 84 | + |
| 85 | +</TabItem> |
| 86 | + |
| 87 | +<TabItem value="IgnoreSelector" label="Ignore CSS Selector"> |
| 88 | + |
| 89 | +```js title="This is a sample for your configuration for Javascript to ignore by CSS Selector" |
| 90 | +let options = { |
| 91 | + ignoreDOM: { |
| 92 | + cssSelector: ["CSS-Selector-1", "CSS-Selector-2"], |
| 93 | + } |
| 94 | + } |
| 95 | + await driver.get('Required URL'); |
| 96 | + await smartuiSnapshot(driver, 'Screenshot Name', options); |
| 97 | +``` |
| 98 | +</TabItem> |
| 99 | + |
| 100 | +</Tabs> |
| 101 | + |
| 102 | +<Tabs className="docs__val" groupId="framework"> |
| 103 | +<TabItem value="SelectID" label="Select ID" default> |
| 104 | + |
| 105 | +```js title="This is a sample for your configuration for Javascript to select by ID" |
| 106 | +let options = { |
| 107 | + selectDOM: { |
| 108 | + id: ["ID-1", "ID-2"], |
| 109 | + } |
| 110 | + } |
| 111 | + await driver.get('Required URL'); |
| 112 | + await smartuiSnapshot(driver, 'Screenshot Name', options); |
| 113 | +``` |
| 114 | + |
| 115 | +</TabItem> |
| 116 | +<TabItem value="SelectClass" label="Select Class"> |
| 117 | + |
| 118 | +```js title="This is a sample for your configuration for Javascript to select by Class" |
| 119 | +let options = { |
| 120 | + selectDOM: { |
| 121 | + class: ["Class-1", "Class-2"], |
| 122 | + } |
| 123 | + } |
| 124 | + await driver.get('Required URL'); |
| 125 | + await smartuiSnapshot(driver, 'Screenshot Name', options); |
| 126 | +``` |
| 127 | + |
| 128 | +</TabItem> |
| 129 | +<TabItem value="SelectXPath" label="Select XPath"> |
| 130 | + |
| 131 | +```js title="This is a sample for your configuration for Javascript to select by XPath" |
| 132 | +let options = { |
| 133 | + selectDOM: { |
| 134 | + xpath: ["Xpath-1", "Xpath-2"], |
| 135 | + } |
| 136 | + } |
| 137 | + await driver.get('Required URL'); |
| 138 | + await smartuiSnapshot(driver, 'Screenshot Name', options); |
| 139 | +``` |
| 140 | + |
| 141 | +</TabItem> |
| 142 | + |
| 143 | +<TabItem value="SelectSelector" label="Select CSS Selector"> |
| 144 | + |
| 145 | +```js title="This is a sample for your webhook configuration for Javascript to select by CSS Selector" |
| 146 | +let options = { |
| 147 | + selectDOM: { |
| 148 | + cssSelector: ["CSS-Selector-1", "CSS-Selector-2"], |
| 149 | + } |
| 150 | + } |
| 151 | + await driver.get('Required URL'); |
| 152 | + await smartuiSnapshot(driver, 'Screenshot Name', options); |
| 153 | +``` |
| 154 | +</TabItem> |
| 155 | +</Tabs> |
0 commit comments