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
14 changes: 8 additions & 6 deletions test/e2e/specs/editor/various/post-editor-template-mode.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,14 @@ class PostEditorTemplateMode {
)
).toBeVisible();

// Wait for the editor to be loaded and ready before making changes.
// Without this, the editor will move focus to body while still typing.
// And the save states will not be counted as dirty.
// There is likely a bug in the code, waiting for the snackbar above should be enough.
// eslint-disable-next-line playwright/no-networkidle
await this.page.waitForLoadState( 'networkidle' );
// Wait for the editor to be fully loaded and ready before making changes.
// Without this, the editor may move focus to body while still typing,
// and save states will not be counted as dirty.
await this.page.waitForFunction(
() =>
window.wp?.data?.select( 'core/block-editor' )?.getBlocks()
?.length > 0
);
}

async saveTemplateWithoutPublishing() {
Expand Down
13 changes: 5 additions & 8 deletions test/e2e/specs/site-editor/site-editor-url-navigation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,11 @@ test.describe( 'Site editor url navigation', () => {
await admin.visitSiteEditor();
await page.click( 'role=button[name="Templates"]' );
await page.click( 'role=button[name="Add Template"i]' );
// Wait for network idle to avoid flaky tests.
// eslint-disable-next-line playwright/no-networkidle
await page.waitForLoadState( 'networkidle' );
await page
.getByRole( 'button', {
name: 'Single item: Post',
} )
.click();
const singleItemPost = page.getByRole( 'button', {
name: 'Single item: Post',
} );
await expect( singleItemPost ).toBeEnabled();
await singleItemPost.click();
await page
.getByRole( 'button', { name: 'For a specific item' } )
.click();
Expand Down
Loading