Files
chrnx-dev-wp/tests/e2e/editorial-editor.spec.mjs
T
chrnxandClaude Opus 5 cb491adae6 test: cover the new content models and stop duplicate terms
Seeding guarded with term_exists(), which reads a cache that is not
always warm during activation and let a second activation insert
gaming-2, literature-2 and silicon-ranch-2. It asks the taxonomy
directly now, by slug and by name.

Fixtures gain projects and tracks, and the suites follow the assets to
their generated derivatives. Also widens the Site Editor poll, which
threw instead of retrying while the editor was still booting.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-13 19:42:07 -05:00

53 lines
2.4 KiB
JavaScript

import { expect, test } from '@playwright/test';
test( 'editorial and podcast controls initialize in the real post editor', async ( { page } ) => {
const openPanel = async ( name ) => {
const button = page.getByRole( 'button', { name, exact: true } );
if ( ( await button.getAttribute( 'aria-expanded' ) ) !== 'true' ) {
await button.click();
}
};
await page.goto( '/wp-login.php' );
await page.locator( '#user_login' ).fill( 'admin' );
await page.locator( '#user_pass' ).fill( 'password' );
await Promise.all( [
page.waitForURL( /\/wp-admin\// ),
page.getByRole( 'button', { name: /log in/i } ).click(),
] );
await page.goto( '/wp-admin/post-new.php' );
const welcomeDialog = page.getByRole( 'dialog', { name: 'Welcome to the editor' } );
if ( await welcomeDialog.isVisible() ) {
await welcomeDialog.getByRole( 'button', { name: 'Close' } ).click();
}
await expect( page.getByRole( 'heading', { name: 'Add Post', exact: true } ) ).toBeVisible();
const podcasts = page.getByRole( 'radio', { name: 'Podcasts', exact: true } );
const settings = page.getByRole( 'button', { name: /^settings$/i } ).last();
if ( ( await settings.getAttribute( 'aria-expanded' ) ) !== 'true' ) {
await settings.click();
}
await openPanel( 'Topic' );
await expect( podcasts ).toBeVisible();
await openPanel( 'Language' );
await expect( page.getByRole( 'radio', { name: 'English', exact: true } ) ).toBeVisible();
await openPanel( 'Show' );
await expect( page.getByRole( 'radio', { name: 'Silicon Ranch', exact: true } ) ).toBeVisible();
await podcasts.check();
await openPanel( 'Podcast episode' );
await expect( page.getByLabel( 'Episode number', { exact: true } ) ).toBeVisible();
await expect( page.getByLabel( 'Duration', { exact: true } ) ).toBeVisible();
await expect( page.getByLabel( 'Participants (one per line)', { exact: true } ) ).toBeVisible();
await expect( page.getByLabel( 'Canonical episode URL', { exact: true } ) ).toBeVisible();
// Switching topic swaps which per-topic panel is offered.
await openPanel( 'Topic' );
await page.getByRole( 'radio', { name: 'Projects', exact: true } ).check();
await expect( page.getByLabel( 'Episode number', { exact: true } ) ).toBeHidden();
await openPanel( 'Project' );
await expect( page.getByLabel( 'Show in Selected work', { exact: true } ) ).toBeVisible();
} );