Skip to content
Merged
Show file tree
Hide file tree
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
19 changes: 11 additions & 8 deletions test/e2e/specs/editor/blocks/navigation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1122,25 +1122,28 @@ test.describe( 'Navigation block', () => {
test.afterEach( async ( { admin, page, requestUtils } ) => {
await requestUtils.deleteAllPages();

// Restore plain permalinks
// TODO: Encapsulate permalink teardown in an admin.setPermalinks( '' ) style util
// Restore the "Day and name" permalink structure
// (/%year%/%monthnum%/%day%/%postname%/) that wp-env configures at
// install time. Restoring "Plain" instead would leave the shared
// site without pretty permalinks for every spec that runs after
// this one in the same shard (e.g. the preload specs assert
// /wp-json/-style request URLs).
// TODO: Encapsulate permalink teardown in an admin.setPermalinks() style util
// We need to run this in afterEach instead of afterAll since we don't have page context
// in afterAll
await admin.visitAdminPage( 'options-permalink.php' );

// Select Plain permalinks
await page.locator( '#permalink-input-plain' ).click();
// Select the Day and name permalink structure
await page.locator( '#permalink-input-day-name' ).click();

// Click Save Changes
await page.locator( '#submit' ).click();

// Wait for settings to be saved
await page.waitForSelector( '.notice-success' );

// Force re-discovery of REST API root URL after disabling pretty permalinks.
// When permalinks change from pretty to plain, the REST API URL changes
// from /wp-json/ back to /?rest_route=/. We need to refresh the cached URL
// to prevent 404 errors.
// Force re-discovery of the REST API root URL after changing the
// permalink structure, so the cached URL cannot go stale.
await requestUtils.setupRest();
} );

Expand Down
5 changes: 5 additions & 0 deletions test/e2e/specs/preload/site-editor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ test.describe( 'Preload', () => {
test.beforeAll( async ( { requestUtils } ) => {
await requestUtils.activateTheme( 'emptytheme' );
await requestUtils.resetPreferences();
// Posts left behind by earlier specs change the startup requests:
// with at least one post, emptytheme's index template query loop
// renders the Post Excerpt block, whose editor component fetches
// /wp/v2/types/post?context=edit.
await requestUtils.deleteAllPosts();
const pg = await requestUtils.createPage( {
content:
'<!-- wp:heading -->\n<h2 class="wp-block-heading">Hello</h2>\n<!-- /wp:heading -->',
Expand Down
Loading