@@ -104,6 +104,34 @@ describe('@wdio/visual-service mobile web', () => {
104104 )
105105 ) . toEqual ( 0 )
106106 } )
107+
108+ it ( `should compare an element with ignore elements successful for '${ deviceName } ' with ${ platformName } :${ platformVersion } in ${ orientation } -mode` , async function ( ) {
109+ skipTest ( { test : this , deviceName, platformName, platformVersion, orientation } )
110+
111+ await $ ( '.features_vqN4' ) . scrollIntoView ( )
112+
113+ // When running a new set of images then first comment out block 1 and 2. Then run the test.
114+ // Then uncomment block 1, check if they fail with `--store-diffs` as an extra argument.
115+ // If so, then uncomment block 2 and check if pass with the same arguments.
116+ // Block 1
117+ await browser . execute ( ( ) => {
118+ document . querySelectorAll ( '.feature_G9wp h3' ) . forEach ( heading => {
119+ ( heading as HTMLElement ) . style . backgroundColor = 'var(--ifm-color-primary)'
120+ } )
121+ } )
122+
123+ await expect ( $ ( '.features_vqN4' ) ) . toMatchElementSnapshot (
124+ 'ignoredElementsElementScreenshot' ,
125+ {
126+ // Block 2
127+ ignore : [
128+ await $$ ( '.feature_G9wp h3' ) ,
129+ ] ,
130+ // Don't comment this out, it's needed to hide the navbar
131+ hideElements : [ await $ ( 'nav.navbar' ) ]
132+ }
133+ )
134+ } )
107135 }
108136
109137 if (
@@ -146,9 +174,10 @@ interface SkipRule {
146174}
147175
148176const skipRules : SkipRule [ ] = [
177+ // Android devices
149178 {
150179 // @TODO : remove when fixed
151- titleIncludes : 'ignore elements' ,
180+ titleIncludes : 'screen with ignore elements' ,
152181 deviceName : 'Pixel 9 Pro' ,
153182 platformName : 'Android' ,
154183 platformVersions : [ '15' ] ,
@@ -157,7 +186,7 @@ const skipRules: SkipRule[] = [
157186 } ,
158187 {
159188 // @TODO : remove when fixed
160- titleIncludes : 'ignore elements' ,
189+ titleIncludes : 'screen with ignore elements' ,
161190 deviceName : 'Galaxy Tab S8' ,
162191 platformName : 'Android' ,
163192 platformVersions : [ '13' ] ,
@@ -166,7 +195,7 @@ const skipRules: SkipRule[] = [
166195 } ,
167196 {
168197 // @TODO : remove when fixed
169- titleIncludes : 'ignore elements' ,
198+ titleIncludes : 'screen with ignore elements' ,
170199 deviceName : 'Galaxy Tab S8' ,
171200 platformName : 'Android' ,
172201 platformVersions : [ '14' ] ,
@@ -175,7 +204,7 @@ const skipRules: SkipRule[] = [
175204 } ,
176205 {
177206 // @TODO : remove when fixed
178- titleIncludes : [ 'ignore elements' , 'screen successful' ] ,
207+ titleIncludes : [ 'screen with ignore elements' , 'screen successful' ] ,
179208 deviceName : 'Galaxy Tab S8' ,
180209 platformName : 'Android' ,
181210 platformVersions : [ '14' ] ,
@@ -193,7 +222,7 @@ const skipRules: SkipRule[] = [
193222 } ,
194223 {
195224 // @TODO : remove when fixed
196- titleIncludes : 'ignore elements' ,
225+ titleIncludes : 'screen with ignore elements' ,
197226 deviceName : 'Pixel 4' ,
198227 platformName : 'Android' ,
199228 platformVersions : [ '13' ] ,
@@ -209,47 +238,48 @@ const skipRules: SkipRule[] = [
209238 reason : 'Elements not visible in the screenshot, no value in testing' ,
210239 } ,
211240 {
212- titleIncludes : 'ignore elements' ,
241+ titleIncludes : 'screen with ignore elements' ,
213242 deviceName : 'Pixel 9 Pro' ,
214243 platformName : 'Android' ,
215244 platformVersions : [ '14' , '15' ] ,
216245 orientations : [ 'landscape' ] ,
217246 reason : 'Elements not visible in the screenshot, no value in testing' ,
218247 } ,
219248 {
220- titleIncludes : 'ignore elements' ,
249+ titleIncludes : 'screen with ignore elements' ,
221250 deviceName : 'Pixel 4' ,
222251 platformName : 'Android' ,
223252 platformVersions : [ '11' , '12' ] ,
224253 orientations : [ 'landscape' , 'portrait' ] ,
225254 reason : 'Elements not visible in the screenshot, no value in testing' ,
226255 } ,
256+ // iOS devices
227257 {
228- titleIncludes : 'ignore elements' ,
258+ titleIncludes : 'screen with ignore elements' ,
229259 deviceName : 'iPhone 13 mini' ,
230260 platformName : 'iOS' ,
231261 platformVersions : [ '17.5' ] ,
232262 orientations : [ 'landscape' ] ,
233263 reason : 'Elements not visible in the screenshot, no value in testing' ,
234264 } ,
235265 {
236- titleIncludes : 'ignore elements' ,
266+ titleIncludes : 'screen with ignore elements' ,
237267 deviceName : 'iPhone 13 Pro' ,
238268 platformName : 'iOS' ,
239269 platformVersions : [ '16.0' ] ,
240270 orientations : [ 'landscape' ] ,
241271 reason : 'Elements not visible in the screenshot, no value in testing' ,
242272 } ,
243273 {
244- titleIncludes : 'ignore elements' ,
274+ titleIncludes : 'screen with ignore elements' ,
245275 deviceName : 'iPhone 14 Pro' ,
246276 platformName : 'iOS' ,
247277 platformVersions : [ '17.5' ] ,
248278 orientations : [ 'landscape' ] ,
249279 reason : 'Elements not visible in the screenshot, no value in testing' ,
250280 } ,
251281 {
252- titleIncludes : 'ignore elements' ,
282+ titleIncludes : 'screen with ignore elements' ,
253283 deviceName : 'iPhone 15 Pro Max' ,
254284 platformName : 'iOS' ,
255285 platformVersions : [ '18.0' ] ,
0 commit comments