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

Skip to content

Fix Commercial Playwright test #13911

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions dotcom-rendering/playwright/tests/commercial.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,30 @@ import { loadPage } from '../lib/load-page';
import { expectToExist } from '../lib/locators';

test.describe('Commercial E2E tests', () => {
test.skip(`It should load the expected number of ad slots`, async ({
page,
}) => {
test(`It should load the expected number of ad slots`, async ({ page }) => {
await loadPage({
page,
path: `/Article/https://www.theguardian.com/environment/2020/oct/13/maverick-rewilders-endangered-species-extinction-conservation-uk-wildlife`,
});

await cmpAcceptAll(page);

const totalSlots = 15;
const fixedSlots = 4;
const inlineSlots = totalSlots - fixedSlots;
const fixedSlots = [
'carrot', // Not used often, likely to be unfilled
'right',
'merchandising-high',
'mostpop',
'merchandising',
];

const totalSlotsExpected = 16; // All slots, even if unfilled ie. `display: none`
const inlineSlots = totalSlotsExpected - fixedSlots.length;

// We are excluding survey slot as they can be switched off
await expectToExist(
page,
'.js-ad-slot:not([data-name="survey"])',
totalSlots,
totalSlotsExpected,
);

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

// Check all other fixed slots
await expectToExist(page, '[data-name="right"]');
await expectToExist(page, '[data-name="merchandising-high"]');
await expectToExist(page, '[data-name="mostpop"]');
await expectToExist(page, '[data-name="merchandising"]');
for (const slotName of fixedSlots) {
await expectToExist(page, `[data-name="${slotName}"]`);
}
});
});
Loading