Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e68d0d9

Browse files
committed
fix commercial playwright test
increase expected number of slots and specify inclusion of carrot slot, which is very often unfilled and will have display: none
1 parent bd62666 commit e68d0d9

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

dotcom-rendering/playwright/tests/commercial.e2e.spec.ts

+16-11
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,30 @@ import { loadPage } from '../lib/load-page';
44
import { expectToExist } from '../lib/locators';
55

66
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 }) => {
108
await loadPage({
119
page,
1210
path: `/Article/https://www.theguardian.com/environment/2020/oct/13/maverick-rewilders-endangered-species-extinction-conservation-uk-wildlife`,
1311
});
1412

1513
await cmpAcceptAll(page);
1614

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+
2026
// We are excluding survey slot as they can be switched off
2127
await expectToExist(
2228
page,
2329
'.js-ad-slot:not([data-name="survey"])',
24-
totalSlots,
30+
totalSlotsExpected,
2531
);
2632

2733
// Check all inline slots are present
@@ -31,9 +37,8 @@ test.describe('Commercial E2E tests', () => {
3137
}
3238

3339
// 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+
}
3843
});
3944
});

0 commit comments

Comments
 (0)