@@ -125,19 +125,21 @@ describe('@wdio/visual-service mobile web', () => {
125125 }
126126} )
127127
128+ /******************************************************************************************
129+ * SKIP RULES
130+ * These are most likely TODO's that we have to fix but are not a blocker for the release.
131+ * The reason is added to help us remember why we skipped the test.
132+ ******************************************************************************************/
133+
128134interface SkipRule {
129- titleIncludes : string
135+ titleIncludes : string | string [ ]
130136 deviceName : string
131137 platformName : 'Android' | 'iOS'
132138 platformVersions : string [ ]
133139 orientations : ( 'landscape' | 'portrait' ) [ ]
134140 reason : string
135141}
136142
137- /**
138- * Rules for skipping tests,
139- * these are most likely TODO's that we have to fix but are not a blocker for the release
140- */
141143const skipRules : SkipRule [ ] = [
142144 {
143145 // @TODO : remove when fixed
@@ -168,13 +170,22 @@ const skipRules: SkipRule[] = [
168170 } ,
169171 {
170172 // @TODO : remove when fixed
171- titleIncludes : 'ignore elements' ,
173+ titleIncludes : [ 'ignore elements' , 'screen successful' ] ,
172174 deviceName : 'Galaxy Tab S8' ,
173175 platformName : 'Android' ,
174176 platformVersions : [ '14' ] ,
175- orientations : [ 'landscape' ] ,
177+ orientations : [ 'landscape' , 'portrait' ] ,
176178 reason : 'Fully ignored in the screenshot so it will never find a difference' ,
177179 } ,
180+ {
181+ // @TODO : remove when fixed
182+ titleIncludes : 'full page screenshot' ,
183+ deviceName : 'Galaxy Tab S8' ,
184+ platformName : 'Android' ,
185+ platformVersions : [ '13' , '14' ] ,
186+ orientations : [ 'landscape' , 'portrait' ] ,
187+ reason : 'There are difference in the full page screenshot that might be related to things introduced in PR #1126' ,
188+ } ,
178189 {
179190 // @TODO : remove when fixed
180191 titleIncludes : 'ignore elements' ,
@@ -201,10 +212,6 @@ const skipRules: SkipRule[] = [
201212 reason : 'Elements not visible in the screenshot, no value in testing' ,
202213 } ,
203214]
204-
205- /**
206- * Skips a test if it matches any of the skip rules
207- */
208215function skipTest ( { test, deviceName, platformName, platformVersion, orientation } : {
209216 test : Mocha . Context
210217 deviceName : string
@@ -214,13 +221,15 @@ function skipTest({ test, deviceName, platformName, platformVersion, orientation
214221} ) {
215222 const { title } = test . test !
216223
217- const matchedRule = skipRules . find ( rule =>
218- title . includes ( rule . titleIncludes )
219- && rule . deviceName === deviceName
220- && rule . platformName === platformName
221- && rule . platformVersions . includes ( platformVersion )
222- && rule . orientations . includes ( orientation as 'landscape' | 'portrait' )
223- )
224+ const matchedRule = skipRules . find ( rule => {
225+ const patterns = Array . isArray ( rule . titleIncludes ) ? rule . titleIncludes : [ rule . titleIncludes ]
226+
227+ return patterns . some ( p => title . includes ( p ) )
228+ && rule . deviceName === deviceName
229+ && rule . platformName === platformName
230+ && rule . platformVersions . includes ( platformVersion )
231+ && rule . orientations . includes ( orientation as 'landscape' | 'portrait' )
232+ } )
224233
225234 if ( matchedRule ) {
226235 test . skip ( )
0 commit comments