@@ -4,24 +4,30 @@ import { loadPage } from '../lib/load-page';
4
4
import { expectToExist } from '../lib/locators' ;
5
5
6
6
test . describe ( 'Commercial E2E tests' , ( ) => {
7
- test . skip ( `It should load the expected number of ad slots` , async ( {
8
- page,
9
- } ) => {
7
+ test ( `It should load the expected number of ad slots` , async ( { page } ) => {
10
8
await loadPage ( {
11
9
page,
12
10
path : `/Article/https://www.theguardian.com/environment/2020/oct/13/maverick-rewilders-endangered-species-extinction-conservation-uk-wildlife` ,
13
11
} ) ;
14
12
15
13
await cmpAcceptAll ( page ) ;
16
14
17
- const totalSlots = 15 ;
18
- const fixedSlots = 4 ;
19
- const inlineSlots = totalSlots - fixedSlots ;
15
+ const fixedSlots = [
16
+ 'carrot' , // Not used often, likely to be unfilled
17
+ 'right' ,
18
+ 'merchandising-high' ,
19
+ 'mostpop' ,
20
+ 'merchandising' ,
21
+ ] ;
22
+
23
+ const totalSlotsExpected = 16 ; // All slots, even if unfilled ie. `display: none`
24
+ const inlineSlots = totalSlotsExpected - fixedSlots . length ;
25
+
20
26
// We are excluding survey slot as they can be switched off
21
27
await expectToExist (
22
28
page ,
23
29
'.js-ad-slot:not([data-name="survey"])' ,
24
- totalSlots ,
30
+ totalSlotsExpected ,
25
31
) ;
26
32
27
33
// Check all inline slots are present
@@ -31,9 +37,8 @@ test.describe('Commercial E2E tests', () => {
31
37
}
32
38
33
39
// Check all other fixed slots
34
- await expectToExist ( page , '[data-name="right"]' ) ;
35
- await expectToExist ( page , '[data-name="merchandising-high"]' ) ;
36
- await expectToExist ( page , '[data-name="mostpop"]' ) ;
37
- await expectToExist ( page , '[data-name="merchandising"]' ) ;
40
+ for ( const slotName of fixedSlots ) {
41
+ await expectToExist ( page , `[data-name="${ slotName } "]` ) ;
42
+ }
38
43
} ) ;
39
44
} ) ;
0 commit comments