From 59720fe6b5072c37063c43887339ecd2653ca003 Mon Sep 17 00:00:00 2001 From: Bart Kalisz Date: Tue, 17 Oct 2023 14:48:20 +0200 Subject: [PATCH] Merge createNewPost into visitPostEditor Combine the two utils leaving only the latter. Update tests accordingly. --- .../src/admin/create-new-post.ts | 42 ----------------- .../src/admin/index.ts | 3 -- .../src/admin/visit-post-editor.ts | 45 ++++++++++++------- test/e2e/specs/editor/blocks/avatar.spec.js | 2 +- test/e2e/specs/editor/blocks/buttons.spec.js | 2 +- test/e2e/specs/editor/blocks/classic.spec.js | 2 +- test/e2e/specs/editor/blocks/code.spec.js | 2 +- test/e2e/specs/editor/blocks/columns.spec.js | 2 +- test/e2e/specs/editor/blocks/comments.spec.js | 12 ++--- test/e2e/specs/editor/blocks/cover.spec.js | 2 +- test/e2e/specs/editor/blocks/gallery.spec.js | 10 ++--- test/e2e/specs/editor/blocks/group.spec.js | 2 +- test/e2e/specs/editor/blocks/heading.spec.js | 2 +- test/e2e/specs/editor/blocks/html.spec.js | 2 +- test/e2e/specs/editor/blocks/image.spec.js | 4 +- test/e2e/specs/editor/blocks/links.spec.js | 6 +-- test/e2e/specs/editor/blocks/list.spec.js | 2 +- test/e2e/specs/editor/blocks/missing.spec.js | 2 +- .../editor/blocks/navigation-colors.spec.js | 2 +- .../blocks/navigation-list-view.spec.js | 2 +- .../specs/editor/blocks/navigation.spec.js | 16 +++---- .../e2e/specs/editor/blocks/paragraph.spec.js | 2 +- .../specs/editor/blocks/post-title.spec.js | 2 +- .../specs/editor/blocks/preformatted.spec.js | 2 +- .../e2e/specs/editor/blocks/pullquote.spec.js | 2 +- test/e2e/specs/editor/blocks/query.spec.js | 5 ++- test/e2e/specs/editor/blocks/quote.spec.js | 2 +- test/e2e/specs/editor/blocks/search.spec.js | 2 +- .../e2e/specs/editor/blocks/separator.spec.js | 2 +- test/e2e/specs/editor/blocks/spacer.spec.js | 2 +- test/e2e/specs/editor/blocks/table.spec.js | 2 +- .../blocks/verse-code-preformatted.spec.js | 2 +- .../editor/plugins/allowed-blocks.spec.js | 2 +- .../specs/editor/plugins/block-api.spec.js | 2 +- .../editor/plugins/block-variations.spec.js | 2 +- .../editor/plugins/custom-post-types.spec.js | 6 +-- .../plugins/deprecated-node-matcher.spec.js | 2 +- .../specs/editor/plugins/format-api.spec.js | 2 +- .../specs/editor/plugins/hooks-api.spec.js | 2 +- .../editor/plugins/iframed-block.spec.js | 2 +- ...amed-enqueue-block-editor-settings.spec.js | 2 +- .../iframed-equeue-block-assets.spec.js | 2 +- .../plugins/iframed-inline-styles.spec.js | 2 +- .../plugins/iframed-masonry-block.spec.js | 2 +- ...iframed-multiple-block-stylesheets.spec.js | 2 +- .../specs/editor/plugins/image-size.spec.js | 2 +- .../inner-blocks-allowed-blocks.spec.js | 2 +- test/e2e/specs/editor/plugins/nonce.spec.js | 2 +- .../plugins/post-type-templates.spec.js | 8 ++-- .../plugins/register-block-type-hooks.spec.js | 2 +- .../editor/plugins/wp-editor-meta-box.spec.js | 2 +- .../various/a11y-region-navigation.spec.js | 2 +- test/e2e/specs/editor/various/a11y.spec.js | 2 +- .../various/adding-inline-tokens.spec.js | 2 +- .../editor/various/adding-patterns.spec.js | 2 +- .../various/autocomplete-and-mentions.spec.js | 2 +- .../editor/various/block-deletion.spec.js | 2 +- .../block-hierarchy-navigation.spec.js | 2 +- .../editor/various/block-locking.spec.js | 2 +- .../specs/editor/various/block-mover.spec.js | 2 +- .../editor/various/block-moving-mode.spec.js | 2 +- .../editor/various/block-renaming.spec.js | 2 +- .../various/block-switcher-test.spec.js | 2 +- .../compatibility-classic-editor.spec.js | 2 +- .../editor/various/content-only-lock.spec.js | 2 +- .../editor/various/convert-block-type.spec.js | 2 +- .../editor/various/copy-cut-paste.spec.js | 2 +- .../editor/various/draggable-blocks.spec.js | 2 +- .../editor/various/duplicating-blocks.spec.js | 2 +- .../editor/various/font-size-picker.spec.js | 2 +- .../specs/editor/various/footnotes.spec.js | 2 +- .../various/format-library/text-color.spec.js | 2 +- .../editor/various/fullscreen-mode.spec.js | 2 +- .../various/inner-blocks-templates.spec.js | 2 +- .../editor/various/inserting-blocks.spec.js | 12 ++--- .../keep-styles-on-block-transforms.spec.js | 2 +- .../various/keyboard-navigable-blocks.spec.js | 2 +- .../specs/editor/various/list-view.spec.js | 2 +- .../e2e/specs/editor/various/mentions.spec.js | 2 +- .../various/multi-block-selection.spec.js | 2 +- .../editor/various/navigable-toolbar.spec.js | 2 +- .../various/new-post-default-content.spec.js | 2 +- .../e2e/specs/editor/various/new-post.spec.js | 10 ++--- .../e2e/specs/editor/various/patterns.spec.js | 2 +- .../e2e/specs/editor/various/popovers.spec.js | 2 +- .../various/post-editor-template-mode.spec.js | 2 +- .../editor/various/post-visibility.spec.js | 6 +-- test/e2e/specs/editor/various/preview.spec.js | 9 ++-- .../editor/various/publish-panel.spec.js | 2 +- .../rich-text-deprecated-multiline.spec.js | 2 +- .../specs/editor/various/rich-text.spec.js | 2 +- test/e2e/specs/editor/various/rtl.spec.js | 2 +- .../various/shortcut-focus-toolbar.spec.js | 2 +- .../editor/various/shortcut-help.spec.js | 2 +- .../editor/various/splitting-merging.spec.js | 2 +- .../editor/various/style-variation.spec.js | 2 +- .../various/toolbar-roving-tabindex.spec.js | 2 +- test/e2e/specs/editor/various/undo.spec.js | 2 +- .../specs/editor/various/writing-flow.spec.js | 2 +- test/performance/specs/post-editor.spec.js | 16 +++---- test/performance/specs/site-editor.spec.js | 4 +- 101 files changed, 177 insertions(+), 205 deletions(-) delete mode 100644 packages/e2e-test-utils-playwright/src/admin/create-new-post.ts diff --git a/packages/e2e-test-utils-playwright/src/admin/create-new-post.ts b/packages/e2e-test-utils-playwright/src/admin/create-new-post.ts deleted file mode 100644 index 76b9e47a4779d8..00000000000000 --- a/packages/e2e-test-utils-playwright/src/admin/create-new-post.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * WordPress dependencies - */ -import { addQueryArgs } from '@wordpress/url'; - -/** - * Internal dependencies - */ -import type { Admin } from './'; - -interface NewPostOptions { - postType?: string; - title?: string; - content?: string; - excerpt?: string; - showWelcomeGuide?: boolean; -} - -/** - * Creates new post. - * - * @param this - * @param options Options to create new post. - */ -export async function createNewPost( - this: Admin, - options: NewPostOptions = {} -) { - const query = addQueryArgs( '', { - post_type: options.postType, - post_title: options.title, - content: options.content, - excerpt: options.excerpt, - } ).slice( 1 ); - - await this.visitAdminPage( 'post-new.php', query ); - - await this.editor.setPreferences( 'core/edit-post', { - welcomeGuide: options.showWelcomeGuide ?? false, - fullscreenMode: false, - } ); -} diff --git a/packages/e2e-test-utils-playwright/src/admin/index.ts b/packages/e2e-test-utils-playwright/src/admin/index.ts index 06934bdd150f39..e2d9c7697f2a24 100644 --- a/packages/e2e-test-utils-playwright/src/admin/index.ts +++ b/packages/e2e-test-utils-playwright/src/admin/index.ts @@ -6,7 +6,6 @@ import type { Browser, Page, BrowserContext } from '@playwright/test'; /** * Internal dependencies */ -import { createNewPost } from './create-new-post'; import { getPageError } from './get-page-error'; import { visitAdminPage } from './visit-admin-page'; import { visitPostEditor } from './visit-post-editor'; @@ -35,8 +34,6 @@ export class Admin { this.editor = editor; } - /** @borrows createNewPost as this.createNewPost */ - createNewPost: typeof createNewPost = createNewPost.bind( this ); /** @borrows getPageError as this.getPageError */ getPageError: typeof getPageError = getPageError.bind( this ); /** @borrows visitAdminPage as this.visitAdminPage */ diff --git a/packages/e2e-test-utils-playwright/src/admin/visit-post-editor.ts b/packages/e2e-test-utils-playwright/src/admin/visit-post-editor.ts index 0730509628c6a9..a0b0662e52e4b8 100644 --- a/packages/e2e-test-utils-playwright/src/admin/visit-post-editor.ts +++ b/packages/e2e-test-utils-playwright/src/admin/visit-post-editor.ts @@ -1,38 +1,49 @@ -/** - * WordPress dependencies - */ -import { addQueryArgs } from '@wordpress/url'; - /** * Internal dependencies */ import type { Admin } from './'; -interface PostOptions { +interface PostEditorOptions { postId?: string | number; + postType?: string; + title?: string; + content?: string; + excerpt?: string; showWelcomeGuide?: boolean; } /** - * Creates new post. + * Creates new post or visits existing post if postId is provided. * * @param this - * @param options Options to create new post. + * @param options Options to create or visit post. */ export async function visitPostEditor( this: Admin, - options: PostOptions = {} + options: PostEditorOptions = {} ) { - if ( typeof options.postId === 'undefined' ) { - throw new Error( 'postId is required.' ); - } + const query = new URLSearchParams(); + let adminPage: string; + + if ( options.postId ) { + const { postId } = options; - const query = addQueryArgs( '', { - post: options.postId, - action: 'edit', - } ).slice( 1 ); + adminPage = 'post.php'; + + query.set( 'post', String( postId ) ); + query.set( 'action', 'edit' ); + } else { + const { postType, title, content, excerpt } = options; + + adminPage = 'post-new.php'; + + if ( postType ) query.set( 'post_type', postType ); + if ( title ) query.set( 'post_title', title ); + if ( content ) query.set( 'content', content ); + if ( excerpt ) query.set( 'excerpt', excerpt ); + } - await this.visitAdminPage( 'post.php', query ); + await this.visitAdminPage( adminPage, query.toString() ); await this.editor.setPreferences( 'core/edit-post', { welcomeGuide: options.showWelcomeGuide ?? false, diff --git a/test/e2e/specs/editor/blocks/avatar.spec.js b/test/e2e/specs/editor/blocks/avatar.spec.js index 8bf39a7a60dbac..b02120f6e46c68 100644 --- a/test/e2e/specs/editor/blocks/avatar.spec.js +++ b/test/e2e/specs/editor/blocks/avatar.spec.js @@ -19,7 +19,7 @@ test.describe( 'Avatar', () => { password: 'gravatargravatar123magic', } ); - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.afterEach( async ( { requestUtils } ) => { diff --git a/test/e2e/specs/editor/blocks/buttons.spec.js b/test/e2e/specs/editor/blocks/buttons.spec.js index dcddfca2b5b284..d986b2a1060905 100644 --- a/test/e2e/specs/editor/blocks/buttons.spec.js +++ b/test/e2e/specs/editor/blocks/buttons.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Buttons', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'has focus on button content', async ( { editor, page } ) => { diff --git a/test/e2e/specs/editor/blocks/classic.spec.js b/test/e2e/specs/editor/blocks/classic.spec.js index 95d39906b0d8bb..5ed43f2097ade0 100644 --- a/test/e2e/specs/editor/blocks/classic.spec.js +++ b/test/e2e/specs/editor/blocks/classic.spec.js @@ -19,7 +19,7 @@ test.use( { test.describe( 'Classic', () => { test.beforeEach( async ( { admin, editor } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); // To do: run with iframe. await editor.switchToLegacyCanvas(); } ); diff --git a/test/e2e/specs/editor/blocks/code.spec.js b/test/e2e/specs/editor/blocks/code.spec.js index 6abfb15d10b83b..6fdcb6dc9a5e5a 100644 --- a/test/e2e/specs/editor/blocks/code.spec.js +++ b/test/e2e/specs/editor/blocks/code.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Code', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'can be created by three backticks and enter', async ( { diff --git a/test/e2e/specs/editor/blocks/columns.spec.js b/test/e2e/specs/editor/blocks/columns.spec.js index bcb23c9a240991..78c80439314fa9 100644 --- a/test/e2e/specs/editor/blocks/columns.spec.js +++ b/test/e2e/specs/editor/blocks/columns.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Columns', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.afterEach( async ( { requestUtils } ) => { diff --git a/test/e2e/specs/editor/blocks/comments.spec.js b/test/e2e/specs/editor/blocks/comments.spec.js index 7fddb22f6a763b..8bd7b59631ce48 100644 --- a/test/e2e/specs/editor/blocks/comments.spec.js +++ b/test/e2e/specs/editor/blocks/comments.spec.js @@ -48,7 +48,7 @@ test.describe( 'Comments', () => { requestUtils, } ) => { await requestUtils.deleteAllComments(); - await admin.createNewPost(); + await admin.visitPostEditor(); await editor.insertBlock( { name: 'core/comments' } ); await expect( editor.canvas.locator( @@ -63,7 +63,7 @@ test.describe( 'Comments', () => { page, requestUtils, } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await editor.insertBlock( { name: 'core/comments' } ); const postId = await editor.publishPost(); @@ -117,7 +117,7 @@ test.describe( 'Comments', () => { commentsBlockUtils, } ) => { await commentsBlockUtils.setOption( 'page_comments', '0' ); - await admin.createNewPost(); + await admin.visitPostEditor(); await editor.insertBlock( { name: 'core/comments' } ); const postId = await editor.publishPost(); @@ -147,7 +147,7 @@ test.describe( 'Comments', () => { admin, editor, } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await editor.insertBlock( { name: 'core/comments', attributes: { legacy: true, textColor: 'vivid-purple' }, @@ -184,7 +184,7 @@ test.describe( 'Comments', () => { editor, requestUtils, } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await editor.insertBlock( { name: 'core/comments' } ); const postId = await editor.publishPost(); @@ -212,7 +212,7 @@ test.describe( 'Comments', () => { editor, requestUtils, } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await editor.insertBlock( { name: 'core/comments', attributes: { legacy: true }, diff --git a/test/e2e/specs/editor/blocks/cover.spec.js b/test/e2e/specs/editor/blocks/cover.spec.js index fa5103ebaa4eeb..0a11de3b4abde9 100644 --- a/test/e2e/specs/editor/blocks/cover.spec.js +++ b/test/e2e/specs/editor/blocks/cover.spec.js @@ -21,7 +21,7 @@ test.use( { test.describe( 'Cover', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'can set overlay color using color picker on block placeholder', async ( { diff --git a/test/e2e/specs/editor/blocks/gallery.spec.js b/test/e2e/specs/editor/blocks/gallery.spec.js index ef693cb8b5bb9e..d2b7f0462404fb 100644 --- a/test/e2e/specs/editor/blocks/gallery.spec.js +++ b/test/e2e/specs/editor/blocks/gallery.spec.js @@ -45,7 +45,7 @@ test.describe( 'Gallery', () => { page, pageUtils, } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); pageUtils.setClipboardData( { plainText: `[gallery ids="${ uploadedMedia.id }"]`, @@ -91,7 +91,7 @@ test.describe( 'Gallery', () => { editor, galleryBlockUtils, } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await editor.insertBlock( { name: 'core/gallery' } ); const galleryBlock = editor.canvas.locator( 'role=document[name="Block: Gallery"i]' @@ -119,7 +119,7 @@ test.describe( 'Gallery', () => { } ) => { const galleryCaption = 'Tested gallery caption'; - await admin.createNewPost(); + await admin.visitPostEditor(); await editor.insertBlock( { name: 'core/gallery', innerBlocks: [ @@ -162,7 +162,7 @@ test.describe( 'Gallery', () => { } ) => { const caption = 'Tested caption'; - await admin.createNewPost(); + await admin.visitPostEditor(); await editor.insertBlock( { name: 'core/gallery', innerBlocks: [ @@ -204,7 +204,7 @@ test.describe( 'Gallery', () => { editor, page, } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await editor.insertBlock( { name: 'core/gallery' } ); await editor.canvas .locator( 'role=button[name="Media Library"i]' ) diff --git a/test/e2e/specs/editor/blocks/group.spec.js b/test/e2e/specs/editor/blocks/group.spec.js index ccf522d8c4d533..cf493cd694b9ed 100644 --- a/test/e2e/specs/editor/blocks/group.spec.js +++ b/test/e2e/specs/editor/blocks/group.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Group', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'can be created using the block inserter', async ( { diff --git a/test/e2e/specs/editor/blocks/heading.spec.js b/test/e2e/specs/editor/blocks/heading.spec.js index 705bce2c3f2c9a..f9ed8dec4e9f34 100644 --- a/test/e2e/specs/editor/blocks/heading.spec.js +++ b/test/e2e/specs/editor/blocks/heading.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Heading', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'can be created by prefixing number sign and a space', async ( { diff --git a/test/e2e/specs/editor/blocks/html.spec.js b/test/e2e/specs/editor/blocks/html.spec.js index f034da6efe6173..6f981fdc5e6167 100644 --- a/test/e2e/specs/editor/blocks/html.spec.js +++ b/test/e2e/specs/editor/blocks/html.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'HTML block', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'can be created by typing "/html"', async ( { editor, page } ) => { diff --git a/test/e2e/specs/editor/blocks/image.spec.js b/test/e2e/specs/editor/blocks/image.spec.js index db3ff72e3ab6eb..0caa22839236f0 100644 --- a/test/e2e/specs/editor/blocks/image.spec.js +++ b/test/e2e/specs/editor/blocks/image.spec.js @@ -25,7 +25,7 @@ test.describe( 'Image', () => { } ); test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.afterEach( async ( { requestUtils } ) => { @@ -738,7 +738,7 @@ test.describe.skip( 'Image - interactivity', () => { } ); test.beforeEach( async ( { admin, editor } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await editor.insertBlock( { name: 'core/image' } ); } ); diff --git a/test/e2e/specs/editor/blocks/links.spec.js b/test/e2e/specs/editor/blocks/links.spec.js index 7e654ca12790f7..039cd73dd07950 100644 --- a/test/e2e/specs/editor/blocks/links.spec.js +++ b/test/e2e/specs/editor/blocks/links.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Links', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.afterEach( async ( { requestUtils } ) => { @@ -30,7 +30,7 @@ test.describe( 'Links', () => { status: 'publish', } ); - await admin.createNewPost(); + await admin.visitPostEditor(); // Now in a new post and try to create a link from an autocomplete suggestion using the keyboard. await editor.insertBlock( { @@ -373,7 +373,7 @@ test.describe( 'Links', () => { status: 'publish', } ); - await admin.createNewPost(); + await admin.visitPostEditor(); // Now in a new post and try to create a link from an autocomplete suggestion using the keyboard. await editor.insertBlock( { diff --git a/test/e2e/specs/editor/blocks/list.spec.js b/test/e2e/specs/editor/blocks/list.spec.js index f10a266a41e659..f1bc47c6886bdc 100644 --- a/test/e2e/specs/editor/blocks/list.spec.js +++ b/test/e2e/specs/editor/blocks/list.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'List (@firefox)', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'can be created by using an asterisk at the start of a paragraph block', async ( { diff --git a/test/e2e/specs/editor/blocks/missing.spec.js b/test/e2e/specs/editor/blocks/missing.spec.js index 69c26c3f858762..91fcd741ea711f 100644 --- a/test/e2e/specs/editor/blocks/missing.spec.js +++ b/test/e2e/specs/editor/blocks/missing.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'missing block', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'should strip potentially malicious on* attributes', async ( { diff --git a/test/e2e/specs/editor/blocks/navigation-colors.spec.js b/test/e2e/specs/editor/blocks/navigation-colors.spec.js index 1ddd4af8ab2e13..3c3c8581731dda 100644 --- a/test/e2e/specs/editor/blocks/navigation-colors.spec.js +++ b/test/e2e/specs/editor/blocks/navigation-colors.spec.js @@ -25,7 +25,7 @@ test.describe( 'Navigation colors', () => { attributes: { openSubmenusOnClick: true }, } ); - await admin.createNewPost(); + await admin.visitPostEditor(); await editor.insertBlock( { name: 'core/navigation', diff --git a/test/e2e/specs/editor/blocks/navigation-list-view.spec.js b/test/e2e/specs/editor/blocks/navigation-list-view.spec.js index fd7113fe170959..d4249e193db531 100644 --- a/test/e2e/specs/editor/blocks/navigation-list-view.spec.js +++ b/test/e2e/specs/editor/blocks/navigation-list-view.spec.js @@ -29,7 +29,7 @@ test.describe( 'Navigation block - List view editing', () => { } ); test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.afterAll( async ( { requestUtils } ) => { diff --git a/test/e2e/specs/editor/blocks/navigation.spec.js b/test/e2e/specs/editor/blocks/navigation.spec.js index 4757ccbb4a00f5..ccb7b7a402dbcd 100644 --- a/test/e2e/specs/editor/blocks/navigation.spec.js +++ b/test/e2e/specs/editor/blocks/navigation.spec.js @@ -24,7 +24,7 @@ test.describe( 'Navigation block', () => { admin, editor, } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await editor.insertBlock( { name: 'core/navigation' } ); const pageListBlock = editor.canvas.getByRole( 'document', { @@ -52,7 +52,7 @@ test.describe( 'Navigation block', () => { page, requestUtils, } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); const createdMenu = await requestUtils.createNavigationMenu( { title: 'Test Menu 1', content: @@ -96,7 +96,7 @@ test.describe( 'Navigation block', () => { } ) => { // Create a classic menu. await requestUtils.createClassicMenu( 'Test Classic 1' ); - await admin.createNewPost(); + await admin.visitPostEditor(); await editor.insertBlock( { name: 'core/navigation' } ); // We need to check the canvas after inserting the navigation block to be able to target the block. @@ -130,7 +130,7 @@ test.describe( 'Navigation block', () => { editor, requestUtils, } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await requestUtils.createNavigationMenu( { title: 'Test Menu 1', content: @@ -183,7 +183,7 @@ test.describe( 'Navigation block', () => { editor, requestUtils, } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await requestUtils.createNavigationMenu( { title: 'Test Menu', content: '', @@ -220,7 +220,7 @@ test.describe( 'Navigation block', () => { editor, requestUtils, } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await requestUtils.createNavigationMenu( { title: 'Test Menu', content: @@ -264,7 +264,7 @@ test.describe( 'Navigation block', () => { admin, editor, } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await editor.insertBlock( { name: 'core/navigation', @@ -308,7 +308,7 @@ test.describe( 'Navigation block', () => { } ) ).toHaveLength( 0 ); - await admin.createNewPost(); + await admin.visitPostEditor(); await editor.insertBlock( { name: 'core/navigation', diff --git a/test/e2e/specs/editor/blocks/paragraph.spec.js b/test/e2e/specs/editor/blocks/paragraph.spec.js index 3cf3654870a351..616d1c1d10bee8 100644 --- a/test/e2e/specs/editor/blocks/paragraph.spec.js +++ b/test/e2e/specs/editor/blocks/paragraph.spec.js @@ -16,7 +16,7 @@ test.use( { test.describe( 'Paragraph', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'should output unwrapped editable paragraph', async ( { diff --git a/test/e2e/specs/editor/blocks/post-title.spec.js b/test/e2e/specs/editor/blocks/post-title.spec.js index b5c536c0ff2460..f00699d465a378 100644 --- a/test/e2e/specs/editor/blocks/post-title.spec.js +++ b/test/e2e/specs/editor/blocks/post-title.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Post Title block', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'Can edit the post title', async ( { editor, page } ) => { diff --git a/test/e2e/specs/editor/blocks/preformatted.spec.js b/test/e2e/specs/editor/blocks/preformatted.spec.js index 5cd20a051c4fb8..ad50f11d8b9414 100644 --- a/test/e2e/specs/editor/blocks/preformatted.spec.js +++ b/test/e2e/specs/editor/blocks/preformatted.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Preformatted', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'should preserve character newlines', async ( { editor, page } ) => { diff --git a/test/e2e/specs/editor/blocks/pullquote.spec.js b/test/e2e/specs/editor/blocks/pullquote.spec.js index 33f833ca536788..9c78b8271f6882 100644 --- a/test/e2e/specs/editor/blocks/pullquote.spec.js +++ b/test/e2e/specs/editor/blocks/pullquote.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Quote', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'can be created by converting a quote and converted back to quote', async ( { diff --git a/test/e2e/specs/editor/blocks/query.spec.js b/test/e2e/specs/editor/blocks/query.spec.js index 79b15222630efa..44035e2a20f31e 100644 --- a/test/e2e/specs/editor/blocks/query.spec.js +++ b/test/e2e/specs/editor/blocks/query.spec.js @@ -21,7 +21,10 @@ test.describe( 'Query block', () => { } ); test.beforeEach( async ( { admin } ) => { - await admin.createNewPost( { postType: 'page', title: 'Query Page' } ); + await admin.visitPostEditor( { + postType: 'page', + title: 'Query Page', + } ); } ); test.afterEach( async ( { requestUtils } ) => { diff --git a/test/e2e/specs/editor/blocks/quote.spec.js b/test/e2e/specs/editor/blocks/quote.spec.js index d25dedd4a0a397..20cbde17bb67ae 100644 --- a/test/e2e/specs/editor/blocks/quote.spec.js +++ b/test/e2e/specs/editor/blocks/quote.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Quote', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.afterEach( async ( { requestUtils } ) => { diff --git a/test/e2e/specs/editor/blocks/search.spec.js b/test/e2e/specs/editor/blocks/search.spec.js index d11efd7328afeb..e51c4e1463cad5 100644 --- a/test/e2e/specs/editor/blocks/search.spec.js +++ b/test/e2e/specs/editor/blocks/search.spec.js @@ -6,7 +6,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Search', () => { test.beforeEach( async ( { admin, requestUtils } ) => { await requestUtils.deleteAllMenus(); - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.afterAll( async ( { requestUtils } ) => { diff --git a/test/e2e/specs/editor/blocks/separator.spec.js b/test/e2e/specs/editor/blocks/separator.spec.js index 70c61535e71bf7..35e608172efbdb 100644 --- a/test/e2e/specs/editor/blocks/separator.spec.js +++ b/test/e2e/specs/editor/blocks/separator.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Separator', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'can be created by three dashes and enter', async ( { diff --git a/test/e2e/specs/editor/blocks/spacer.spec.js b/test/e2e/specs/editor/blocks/spacer.spec.js index f089402514623c..4093bf7218aa52 100644 --- a/test/e2e/specs/editor/blocks/spacer.spec.js +++ b/test/e2e/specs/editor/blocks/spacer.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Spacer', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'can be created by typing "/spacer"', async ( { editor, page } ) => { diff --git a/test/e2e/specs/editor/blocks/table.spec.js b/test/e2e/specs/editor/blocks/table.spec.js index 1e6dfdcd76e188..da6380b807e2d3 100644 --- a/test/e2e/specs/editor/blocks/table.spec.js +++ b/test/e2e/specs/editor/blocks/table.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Table', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'displays a form for choosing the row and column count of the table', async ( { diff --git a/test/e2e/specs/editor/blocks/verse-code-preformatted.spec.js b/test/e2e/specs/editor/blocks/verse-code-preformatted.spec.js index c3642bfbca3121..8c0b8a7067fed6 100644 --- a/test/e2e/specs/editor/blocks/verse-code-preformatted.spec.js +++ b/test/e2e/specs/editor/blocks/verse-code-preformatted.spec.js @@ -7,7 +7,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); [ 'core/verse', 'core/code', 'core/preformatted' ].forEach( ( blockName ) => { test.describe( blockName, () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'should exit on triple Enter and merge back', async ( { diff --git a/test/e2e/specs/editor/plugins/allowed-blocks.spec.js b/test/e2e/specs/editor/plugins/allowed-blocks.spec.js index 4211e428238218..1008b93e4474db 100644 --- a/test/e2e/specs/editor/plugins/allowed-blocks.spec.js +++ b/test/e2e/specs/editor/plugins/allowed-blocks.spec.js @@ -9,7 +9,7 @@ test.describe( 'Allowed Blocks Filter', () => { } ); test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.afterAll( async ( { requestUtils } ) => { diff --git a/test/e2e/specs/editor/plugins/block-api.spec.js b/test/e2e/specs/editor/plugins/block-api.spec.js index dd2a89cd2beca2..dbac441f812fae 100644 --- a/test/e2e/specs/editor/plugins/block-api.spec.js +++ b/test/e2e/specs/editor/plugins/block-api.spec.js @@ -16,7 +16,7 @@ test.describe( 'Using Block API', () => { admin, editor, } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await editor.insertBlock( { name: 'e2e-tests/hello-world' } ); diff --git a/test/e2e/specs/editor/plugins/block-variations.spec.js b/test/e2e/specs/editor/plugins/block-variations.spec.js index 9f12c987efd39b..9c8de2f6985dac 100644 --- a/test/e2e/specs/editor/plugins/block-variations.spec.js +++ b/test/e2e/specs/editor/plugins/block-variations.spec.js @@ -9,7 +9,7 @@ test.describe( 'Block variations', () => { } ); test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.afterAll( async ( { requestUtils } ) => { diff --git a/test/e2e/specs/editor/plugins/custom-post-types.spec.js b/test/e2e/specs/editor/plugins/custom-post-types.spec.js index 17a497f26cee02..4208cb52870e59 100644 --- a/test/e2e/specs/editor/plugins/custom-post-types.spec.js +++ b/test/e2e/specs/editor/plugins/custom-post-types.spec.js @@ -19,7 +19,7 @@ test.describe( 'Test Custom Post Types', () => { editor, page, } ) => { - await admin.createNewPost( { postType: 'hierar-no-title' } ); + await admin.visitPostEditor( { postType: 'hierar-no-title' } ); await editor.canvas .locator( 'role=button[name="Add default block"i]' ) .click(); @@ -27,7 +27,7 @@ test.describe( 'Test Custom Post Types', () => { await editor.publishPost(); // Create a post that is a child of the previously created post. - await admin.createNewPost( { postType: 'hierar-no-title' } ); + await admin.visitPostEditor( { postType: 'hierar-no-title' } ); await editor.openDocumentSettingsSidebar(); await page .getByRole( 'region', { name: 'Editor settings' } ) @@ -71,7 +71,7 @@ test.describe( 'Test Custom Post Types', () => { editor, page, } ) => { - await admin.createNewPost( { postType: 'leg_block_in_tpl' } ); + await admin.visitPostEditor( { postType: 'leg_block_in_tpl' } ); await editor.canvas .locator( 'role=button[name="Add default block"i]' ) .click(); diff --git a/test/e2e/specs/editor/plugins/deprecated-node-matcher.spec.js b/test/e2e/specs/editor/plugins/deprecated-node-matcher.spec.js index 58f742341ebc3b..3fc89c987a6807 100644 --- a/test/e2e/specs/editor/plugins/deprecated-node-matcher.spec.js +++ b/test/e2e/specs/editor/plugins/deprecated-node-matcher.spec.js @@ -14,7 +14,7 @@ test.describe( 'Deprecated Node Matcher', () => { } ); test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.afterAll( async ( { requestUtils } ) => { diff --git a/test/e2e/specs/editor/plugins/format-api.spec.js b/test/e2e/specs/editor/plugins/format-api.spec.js index 1e631615313bd1..d861194dfdc9ad 100644 --- a/test/e2e/specs/editor/plugins/format-api.spec.js +++ b/test/e2e/specs/editor/plugins/format-api.spec.js @@ -13,7 +13,7 @@ test.describe( 'Using Format API', () => { } ); test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'Clicking the control wraps the selected text properly with HTML code', async ( { diff --git a/test/e2e/specs/editor/plugins/hooks-api.spec.js b/test/e2e/specs/editor/plugins/hooks-api.spec.js index 95bc5bf8bfd2c0..d397f4b33c0a4c 100644 --- a/test/e2e/specs/editor/plugins/hooks-api.spec.js +++ b/test/e2e/specs/editor/plugins/hooks-api.spec.js @@ -14,7 +14,7 @@ test.describe( 'Using Hooks API', () => { } ); test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'Should contain a reset block button on the sidebar', async ( { diff --git a/test/e2e/specs/editor/plugins/iframed-block.spec.js b/test/e2e/specs/editor/plugins/iframed-block.spec.js index 0b5343169d5bf8..8325c3a7589a7a 100644 --- a/test/e2e/specs/editor/plugins/iframed-block.spec.js +++ b/test/e2e/specs/editor/plugins/iframed-block.spec.js @@ -6,7 +6,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Iframed block', () => { test.beforeEach( async ( { requestUtils, admin } ) => { await requestUtils.activatePlugin( 'gutenberg-test-iframed-block' ); - await admin.createNewPost( { postType: 'page' } ); + await admin.visitPostEditor( { postType: 'page' } ); } ); test.afterEach( async ( { requestUtils } ) => { diff --git a/test/e2e/specs/editor/plugins/iframed-enqueue-block-editor-settings.spec.js b/test/e2e/specs/editor/plugins/iframed-enqueue-block-editor-settings.spec.js index b4f502b2c9d0ba..cfa19599487fc4 100644 --- a/test/e2e/specs/editor/plugins/iframed-enqueue-block-editor-settings.spec.js +++ b/test/e2e/specs/editor/plugins/iframed-enqueue-block-editor-settings.spec.js @@ -11,7 +11,7 @@ test.describe( 'iframed block editor settings styles', () => { } ); test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.afterAll( async ( { requestUtils } ) => { diff --git a/test/e2e/specs/editor/plugins/iframed-equeue-block-assets.spec.js b/test/e2e/specs/editor/plugins/iframed-equeue-block-assets.spec.js index a523ba1f8e9e3d..02877de0a7396f 100644 --- a/test/e2e/specs/editor/plugins/iframed-equeue-block-assets.spec.js +++ b/test/e2e/specs/editor/plugins/iframed-equeue-block-assets.spec.js @@ -14,7 +14,7 @@ test.describe( 'iframed enqueue block assets', () => { } ); test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.afterAll( async ( { requestUtils } ) => { diff --git a/test/e2e/specs/editor/plugins/iframed-inline-styles.spec.js b/test/e2e/specs/editor/plugins/iframed-inline-styles.spec.js index 8fa4cbffa9df8c..b1ba8af1a5414e 100644 --- a/test/e2e/specs/editor/plugins/iframed-inline-styles.spec.js +++ b/test/e2e/specs/editor/plugins/iframed-inline-styles.spec.js @@ -28,7 +28,7 @@ test.describe( 'iframed inline styles', () => { } } ); - await admin.createNewPost( { postType: 'page' } ); + await admin.visitPostEditor( { postType: 'page' } ); await editor.insertBlock( { name: 'test/iframed-inline-styles' } ); const block = editor.canvas.getByRole( 'document', { diff --git a/test/e2e/specs/editor/plugins/iframed-masonry-block.spec.js b/test/e2e/specs/editor/plugins/iframed-masonry-block.spec.js index edc6b0a68cd4ab..c06346df0c17a1 100644 --- a/test/e2e/specs/editor/plugins/iframed-masonry-block.spec.js +++ b/test/e2e/specs/editor/plugins/iframed-masonry-block.spec.js @@ -11,7 +11,7 @@ test.describe( 'iframed masonry block', () => { } ); test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.afterAll( async ( { requestUtils } ) => { diff --git a/test/e2e/specs/editor/plugins/iframed-multiple-block-stylesheets.spec.js b/test/e2e/specs/editor/plugins/iframed-multiple-block-stylesheets.spec.js index 2e6f5b6b0cb6a0..81af1c7666dc94 100644 --- a/test/e2e/specs/editor/plugins/iframed-multiple-block-stylesheets.spec.js +++ b/test/e2e/specs/editor/plugins/iframed-multiple-block-stylesheets.spec.js @@ -11,7 +11,7 @@ test.describe( 'iframed multiple block stylesheets', () => { } ); test.beforeEach( async ( { admin } ) => { - await admin.createNewPost( { postType: 'page' } ); + await admin.visitPostEditor( { postType: 'page' } ); } ); test.afterAll( async ( { requestUtils } ) => { diff --git a/test/e2e/specs/editor/plugins/image-size.spec.js b/test/e2e/specs/editor/plugins/image-size.spec.js index 1e0bc91407565d..efb57f41c1b5a0 100644 --- a/test/e2e/specs/editor/plugins/image-size.spec.js +++ b/test/e2e/specs/editor/plugins/image-size.spec.js @@ -31,7 +31,7 @@ test.describe( 'changing image size', () => { const filename = '1024x768_e2e_test_image_size.jpeg'; const filepath = path.join( './test/e2e/assets', filename ); - await admin.createNewPost(); + await admin.visitPostEditor(); const media = await requestUtils.uploadMedia( filepath ); await editor.insertBlock( { diff --git a/test/e2e/specs/editor/plugins/inner-blocks-allowed-blocks.spec.js b/test/e2e/specs/editor/plugins/inner-blocks-allowed-blocks.spec.js index c0627121f16497..e61814019f1fad 100644 --- a/test/e2e/specs/editor/plugins/inner-blocks-allowed-blocks.spec.js +++ b/test/e2e/specs/editor/plugins/inner-blocks-allowed-blocks.spec.js @@ -17,7 +17,7 @@ test.describe( 'Allowed Blocks Setting on InnerBlocks', () => { } ); test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'allows all blocks if the allowed blocks setting was not set', async ( { diff --git a/test/e2e/specs/editor/plugins/nonce.spec.js b/test/e2e/specs/editor/plugins/nonce.spec.js index 1fbb6add87ff7b..b15d0534c485ce 100644 --- a/test/e2e/specs/editor/plugins/nonce.spec.js +++ b/test/e2e/specs/editor/plugins/nonce.spec.js @@ -14,7 +14,7 @@ test.describe( 'Nonce', () => { requestUtils, editor, } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await expect( editor.canvas.getByRole( 'textbox', { name: 'Add title' } ) ).toBeFocused(); diff --git a/test/e2e/specs/editor/plugins/post-type-templates.spec.js b/test/e2e/specs/editor/plugins/post-type-templates.spec.js index a95f826c1f74c7..17a05cac3f1e42 100644 --- a/test/e2e/specs/editor/plugins/post-type-templates.spec.js +++ b/test/e2e/specs/editor/plugins/post-type-templates.spec.js @@ -12,7 +12,7 @@ test.describe( 'Post type templates', () => { } ); test.beforeEach( async ( { admin } ) => { - await admin.createNewPost( { postType: 'book' } ); + await admin.visitPostEditor( { postType: 'book' } ); } ); test.afterAll( async ( { requestUtils } ) => { @@ -99,7 +99,7 @@ test.describe( 'Post type templates', () => { admin, editor, } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await expect.poll( editor.getEditedPostContent ) .toBe( ` @@ -112,7 +112,7 @@ test.describe( 'Post type templates', () => { page, editor, } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); // Remove the default block template to verify that it's not // re-added after saving and reloading the editor. @@ -133,7 +133,7 @@ test.describe( 'Post type templates', () => { admin, editor, } ) => { - await admin.createNewPost( { postType: 'page' } ); + await admin.visitPostEditor( { postType: 'page' } ); await expect.poll( editor.getEditedPostContent ).toBe( '' ); } ); diff --git a/test/e2e/specs/editor/plugins/register-block-type-hooks.spec.js b/test/e2e/specs/editor/plugins/register-block-type-hooks.spec.js index 2ec62ffd056d31..4e3e6cc8d4351b 100644 --- a/test/e2e/specs/editor/plugins/register-block-type-hooks.spec.js +++ b/test/e2e/specs/editor/plugins/register-block-type-hooks.spec.js @@ -8,7 +8,7 @@ test.describe( 'Register block type hooks', () => { await requestUtils.activatePlugin( 'gutenberg-test-register-block-type-hooks' ); - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.afterEach( async ( { requestUtils } ) => { diff --git a/test/e2e/specs/editor/plugins/wp-editor-meta-box.spec.js b/test/e2e/specs/editor/plugins/wp-editor-meta-box.spec.js index 710e06b35e124f..f50a0073d49f67 100644 --- a/test/e2e/specs/editor/plugins/wp-editor-meta-box.spec.js +++ b/test/e2e/specs/editor/plugins/wp-editor-meta-box.spec.js @@ -17,7 +17,7 @@ test.describe( 'WP Editor Meta Boxes', () => { } ); test( 'Should save the changes', async ( { admin, editor, page } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); // Add title to enable valid non-empty post save. await page diff --git a/test/e2e/specs/editor/various/a11y-region-navigation.spec.js b/test/e2e/specs/editor/various/a11y-region-navigation.spec.js index d8dda0cabdf843..09bdef52179d10 100644 --- a/test/e2e/specs/editor/various/a11y-region-navigation.spec.js +++ b/test/e2e/specs/editor/various/a11y-region-navigation.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Region navigation (@firefox, @webkit)', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.afterAll( async ( { requestUtils } ) => { diff --git a/test/e2e/specs/editor/various/a11y.spec.js b/test/e2e/specs/editor/various/a11y.spec.js index 0a5e421debedb7..9fa6dfbbf34cb3 100644 --- a/test/e2e/specs/editor/various/a11y.spec.js +++ b/test/e2e/specs/editor/various/a11y.spec.js @@ -14,7 +14,7 @@ test.use( { test.describe( 'a11y (@firefox, @webkit)', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'navigating through the Editor regions four times should land on the Editor top bar region', async ( { diff --git a/test/e2e/specs/editor/various/adding-inline-tokens.spec.js b/test/e2e/specs/editor/various/adding-inline-tokens.spec.js index 15f9d9ea877320..d65ecd543345c8 100644 --- a/test/e2e/specs/editor/various/adding-inline-tokens.spec.js +++ b/test/e2e/specs/editor/various/adding-inline-tokens.spec.js @@ -13,7 +13,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'adding inline tokens', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'should insert inline image', async ( { diff --git a/test/e2e/specs/editor/various/adding-patterns.spec.js b/test/e2e/specs/editor/various/adding-patterns.spec.js index 94b9dbd2646e8b..da47978054d8a6 100644 --- a/test/e2e/specs/editor/various/adding-patterns.spec.js +++ b/test/e2e/specs/editor/various/adding-patterns.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'adding patterns', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'should insert a block pattern', async ( { page, editor } ) => { diff --git a/test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js b/test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js index 9d6fa02802efe4..1504fe67f9c24d 100644 --- a/test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js +++ b/test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js @@ -68,7 +68,7 @@ test.describe( 'Autocomplete (@firefox, @webkit)', () => { } ); test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.afterEach( async ( { editor } ) => { diff --git a/test/e2e/specs/editor/various/block-deletion.spec.js b/test/e2e/specs/editor/various/block-deletion.spec.js index 9346412c46bcb2..1601a4a8253a9f 100644 --- a/test/e2e/specs/editor/various/block-deletion.spec.js +++ b/test/e2e/specs/editor/various/block-deletion.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Block deletion', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'deleting the last block via its options menu', async ( { diff --git a/test/e2e/specs/editor/various/block-hierarchy-navigation.spec.js b/test/e2e/specs/editor/various/block-hierarchy-navigation.spec.js index f0bfe5bff203fb..f9a1d8b3ffc434 100644 --- a/test/e2e/specs/editor/various/block-hierarchy-navigation.spec.js +++ b/test/e2e/specs/editor/various/block-hierarchy-navigation.spec.js @@ -34,7 +34,7 @@ const COLUMNS_BLOCK = [ test.describe( 'Navigating the block hierarchy', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'should navigate using the list view sidebar', async ( { diff --git a/test/e2e/specs/editor/various/block-locking.spec.js b/test/e2e/specs/editor/various/block-locking.spec.js index b40e7a4b7448a8..b172ca8cc5f76b 100644 --- a/test/e2e/specs/editor/various/block-locking.spec.js +++ b/test/e2e/specs/editor/various/block-locking.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Block Locking', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'can prevent removal', async ( { editor, page } ) => { diff --git a/test/e2e/specs/editor/various/block-mover.spec.js b/test/e2e/specs/editor/various/block-mover.spec.js index 5c3b04a0697743..48aa48bff3207d 100644 --- a/test/e2e/specs/editor/various/block-mover.spec.js +++ b/test/e2e/specs/editor/various/block-mover.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'block mover', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'should show block mover when more than one block exists', async ( { diff --git a/test/e2e/specs/editor/various/block-moving-mode.spec.js b/test/e2e/specs/editor/various/block-moving-mode.spec.js index 5b8ef6bdcd051b..7fe7b2f9b03831 100644 --- a/test/e2e/specs/editor/various/block-moving-mode.spec.js +++ b/test/e2e/specs/editor/various/block-moving-mode.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Block moving mode', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.afterEach( async ( { requestUtils } ) => { diff --git a/test/e2e/specs/editor/various/block-renaming.spec.js b/test/e2e/specs/editor/various/block-renaming.spec.js index f8d9548fbe8667..3fb99a77f0d443 100644 --- a/test/e2e/specs/editor/various/block-renaming.spec.js +++ b/test/e2e/specs/editor/various/block-renaming.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Block Renaming', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.describe( 'Dialog renaming', () => { diff --git a/test/e2e/specs/editor/various/block-switcher-test.spec.js b/test/e2e/specs/editor/various/block-switcher-test.spec.js index 12fd843ed2ed12..e707f693635b9c 100644 --- a/test/e2e/specs/editor/various/block-switcher-test.spec.js +++ b/test/e2e/specs/editor/various/block-switcher-test.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Block Switcher', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'Block variation transforms', async ( { editor, page } ) => { diff --git a/test/e2e/specs/editor/various/compatibility-classic-editor.spec.js b/test/e2e/specs/editor/various/compatibility-classic-editor.spec.js index 71522c1d439a54..11fce3aa66401e 100644 --- a/test/e2e/specs/editor/various/compatibility-classic-editor.spec.js +++ b/test/e2e/specs/editor/various/compatibility-classic-editor.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Compatibility with classic editor', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.afterEach( async ( { requestUtils } ) => { diff --git a/test/e2e/specs/editor/various/content-only-lock.spec.js b/test/e2e/specs/editor/various/content-only-lock.spec.js index e7d52562636f3b..fdebb38cf648fa 100644 --- a/test/e2e/specs/editor/various/content-only-lock.spec.js +++ b/test/e2e/specs/editor/various/content-only-lock.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Content-only lock', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'should be able to edit the content of blocks with content-only lock', async ( { diff --git a/test/e2e/specs/editor/various/convert-block-type.spec.js b/test/e2e/specs/editor/various/convert-block-type.spec.js index b26cc6124f831f..9dac8d2f57588c 100644 --- a/test/e2e/specs/editor/various/convert-block-type.spec.js +++ b/test/e2e/specs/editor/various/convert-block-type.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Code block', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.afterEach( async ( { requestUtils } ) => { diff --git a/test/e2e/specs/editor/various/copy-cut-paste.spec.js b/test/e2e/specs/editor/various/copy-cut-paste.spec.js index 04113e013930b0..3e0c40df80b340 100644 --- a/test/e2e/specs/editor/various/copy-cut-paste.spec.js +++ b/test/e2e/specs/editor/various/copy-cut-paste.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Copy/cut/paste', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'should copy and paste individual blocks with collapsed selection', async ( { diff --git a/test/e2e/specs/editor/various/draggable-blocks.spec.js b/test/e2e/specs/editor/various/draggable-blocks.spec.js index fb56b43dc6e031..236ff463efe68e 100644 --- a/test/e2e/specs/editor/various/draggable-blocks.spec.js +++ b/test/e2e/specs/editor/various/draggable-blocks.spec.js @@ -20,7 +20,7 @@ test.use( { test.describe( 'Draggable block', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'can drag and drop to the top of a vertical block list', async ( { diff --git a/test/e2e/specs/editor/various/duplicating-blocks.spec.js b/test/e2e/specs/editor/various/duplicating-blocks.spec.js index aabb93e2295722..521f98fcce4ae0 100644 --- a/test/e2e/specs/editor/various/duplicating-blocks.spec.js +++ b/test/e2e/specs/editor/various/duplicating-blocks.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Duplicating blocks', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'should duplicate blocks using the block settings menu and keyboard shortcut', async ( { diff --git a/test/e2e/specs/editor/various/font-size-picker.spec.js b/test/e2e/specs/editor/various/font-size-picker.spec.js index 5c6cb4b186e25e..f3c70fb8495977 100644 --- a/test/e2e/specs/editor/various/font-size-picker.spec.js +++ b/test/e2e/specs/editor/various/font-size-picker.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Font Size Picker', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.afterEach( async ( { page } ) => { diff --git a/test/e2e/specs/editor/various/footnotes.spec.js b/test/e2e/specs/editor/various/footnotes.spec.js index 14a2fc653e3873..fa79e410c69420 100644 --- a/test/e2e/specs/editor/various/footnotes.spec.js +++ b/test/e2e/specs/editor/various/footnotes.spec.js @@ -23,7 +23,7 @@ async function getFootnotes( page, withoutSave = false ) { test.describe( 'Footnotes', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'can be inserted', async ( { editor, page } ) => { diff --git a/test/e2e/specs/editor/various/format-library/text-color.spec.js b/test/e2e/specs/editor/various/format-library/text-color.spec.js index aba77251e38336..15cc5f9f250b58 100644 --- a/test/e2e/specs/editor/various/format-library/text-color.spec.js +++ b/test/e2e/specs/editor/various/format-library/text-color.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Format Library - Text color', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'should remove highlighting element', async ( { diff --git a/test/e2e/specs/editor/various/fullscreen-mode.spec.js b/test/e2e/specs/editor/various/fullscreen-mode.spec.js index 8b7a0785a7ed6d..447498fd0a4dda 100644 --- a/test/e2e/specs/editor/various/fullscreen-mode.spec.js +++ b/test/e2e/specs/editor/various/fullscreen-mode.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Fullscreen Mode', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.afterEach( async ( { requestUtils } ) => { diff --git a/test/e2e/specs/editor/various/inner-blocks-templates.spec.js b/test/e2e/specs/editor/various/inner-blocks-templates.spec.js index 0f9aed33d0773b..4742b3b749d7e9 100644 --- a/test/e2e/specs/editor/various/inner-blocks-templates.spec.js +++ b/test/e2e/specs/editor/various/inner-blocks-templates.spec.js @@ -11,7 +11,7 @@ test.describe( 'Inner blocks templates', () => { } ); test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.afterAll( async ( { requestUtils } ) => { diff --git a/test/e2e/specs/editor/various/inserting-blocks.spec.js b/test/e2e/specs/editor/various/inserting-blocks.spec.js index a48fe117c97a2c..44f35037b1741e 100644 --- a/test/e2e/specs/editor/various/inserting-blocks.spec.js +++ b/test/e2e/specs/editor/various/inserting-blocks.spec.js @@ -30,7 +30,7 @@ test.describe( 'Inserting blocks (@firefox, @webkit)', () => { 'The clientX value is always 0 in firefox, see https://github.com/microsoft/playwright/issues/17761 for more info.' ); - await admin.createNewPost(); + await admin.visitPostEditor(); await editor.switchToLegacyCanvas(); // We need a dummy block in place to display the drop indicator due to a bug. @@ -108,7 +108,7 @@ test.describe( 'Inserting blocks (@firefox, @webkit)', () => { editor, insertingBlocksUtils, } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await editor.switchToLegacyCanvas(); // We need a dummy block in place to display the drop indicator due to a bug. @@ -174,7 +174,7 @@ test.describe( 'Inserting blocks (@firefox, @webkit)', () => { 'The clientX value is always 0 in firefox, see https://github.com/microsoft/playwright/issues/17761 for more info.' ); - await admin.createNewPost(); + await admin.visitPostEditor(); await editor.switchToLegacyCanvas(); // We need a dummy block in place to display the drop indicator due to a bug. @@ -244,7 +244,7 @@ test.describe( 'Inserting blocks (@firefox, @webkit)', () => { editor, insertingBlocksUtils, } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await editor.switchToLegacyCanvas(); // We need a dummy block in place to display the drop indicator due to a bug. @@ -308,7 +308,7 @@ test.describe( 'Inserting blocks (@firefox, @webkit)', () => { page, editor, } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); const inserterButton = page.getByRole( 'button', { name: 'Toggle block inserter', @@ -354,7 +354,7 @@ test.describe( 'insert media from inserter', () => { page, editor, } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await page.click( 'role=region[name="Editor top bar"i] >> role=button[name="Toggle block inserter"i]' diff --git a/test/e2e/specs/editor/various/keep-styles-on-block-transforms.spec.js b/test/e2e/specs/editor/various/keep-styles-on-block-transforms.spec.js index 57b958fdfc4b44..712435730d5c17 100644 --- a/test/e2e/specs/editor/various/keep-styles-on-block-transforms.spec.js +++ b/test/e2e/specs/editor/various/keep-styles-on-block-transforms.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Keep styles on block transforms', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'Should keep colors during a transform', async ( { diff --git a/test/e2e/specs/editor/various/keyboard-navigable-blocks.spec.js b/test/e2e/specs/editor/various/keyboard-navigable-blocks.spec.js index 080abe011206a7..d4410ff4305719 100644 --- a/test/e2e/specs/editor/various/keyboard-navigable-blocks.spec.js +++ b/test/e2e/specs/editor/various/keyboard-navigable-blocks.spec.js @@ -13,7 +13,7 @@ test.use( { test.describe( 'Order of block keyboard navigation', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'permits tabbing through paragraph blocks in the expected order', async ( { diff --git a/test/e2e/specs/editor/various/list-view.spec.js b/test/e2e/specs/editor/various/list-view.spec.js index 222d743acdf395..93662974c839cc 100644 --- a/test/e2e/specs/editor/various/list-view.spec.js +++ b/test/e2e/specs/editor/various/list-view.spec.js @@ -11,7 +11,7 @@ test.describe( 'List View', () => { } ); test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'allows a user to drag a block to a new sibling position', async ( { diff --git a/test/e2e/specs/editor/various/mentions.spec.js b/test/e2e/specs/editor/various/mentions.spec.js index fef3b1c3e3d2e1..bd953e36567387 100644 --- a/test/e2e/specs/editor/various/mentions.spec.js +++ b/test/e2e/specs/editor/various/mentions.spec.js @@ -15,7 +15,7 @@ test.describe( 'autocomplete mentions', () => { } ); test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.afterAll( async ( { requestUtils } ) => { diff --git a/test/e2e/specs/editor/various/multi-block-selection.spec.js b/test/e2e/specs/editor/various/multi-block-selection.spec.js index 4fb39783954fad..cee9dcca194bea 100644 --- a/test/e2e/specs/editor/various/multi-block-selection.spec.js +++ b/test/e2e/specs/editor/various/multi-block-selection.spec.js @@ -18,7 +18,7 @@ test.describe( 'Multi-block selection', () => { } ); test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'should select with double ctrl+a and speak', async ( { diff --git a/test/e2e/specs/editor/various/navigable-toolbar.spec.js b/test/e2e/specs/editor/various/navigable-toolbar.spec.js index abdb1800d150a2..3d35c42a8c5970 100644 --- a/test/e2e/specs/editor/various/navigable-toolbar.spec.js +++ b/test/e2e/specs/editor/various/navigable-toolbar.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Block Toolbar', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.describe( 'Contextual Toolbar', () => { diff --git a/test/e2e/specs/editor/various/new-post-default-content.spec.js b/test/e2e/specs/editor/various/new-post-default-content.spec.js index db9e3c38dc2962..b68d9df7a071fc 100644 --- a/test/e2e/specs/editor/various/new-post-default-content.spec.js +++ b/test/e2e/specs/editor/various/new-post-default-content.spec.js @@ -11,7 +11,7 @@ test.describe( 'new editor filtered state', () => { } ); test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.afterAll( async ( { requestUtils } ) => { diff --git a/test/e2e/specs/editor/various/new-post.spec.js b/test/e2e/specs/editor/various/new-post.spec.js index cc0243eb8e6312..f33cf4a77208f3 100644 --- a/test/e2e/specs/editor/various/new-post.spec.js +++ b/test/e2e/specs/editor/various/new-post.spec.js @@ -21,7 +21,7 @@ test.describe( 'new editor state', () => { page, editor, } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await expect( page ).toHaveURL( /post-new.php/ ); @@ -45,7 +45,7 @@ test.describe( 'new editor state', () => { } ); test( 'should have no history', async ( { admin, page } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await expect( page.locator( 'role=button[name="Undo"i]' ) @@ -59,7 +59,7 @@ test.describe( 'new editor state', () => { admin, editor, } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await expect( editor.canvas.locator( 'role=textbox[name="Add title"i]' ) @@ -71,7 +71,7 @@ test.describe( 'new editor state', () => { page, editor, } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); // Enter a title for this post. await editor.canvas @@ -93,7 +93,7 @@ test.describe( 'new editor state', () => { admin, page, } ) => { - await admin.createNewPost( { title: 'Here is the title' } ); + await admin.visitPostEditor( { title: 'Here is the title' } ); // Verify saveable by presence of the Save Draft button. const saveDraftButton = page.locator( diff --git a/test/e2e/specs/editor/various/patterns.spec.js b/test/e2e/specs/editor/various/patterns.spec.js index 941ae7e910a9b2..3015de75576e22 100644 --- a/test/e2e/specs/editor/various/patterns.spec.js +++ b/test/e2e/specs/editor/various/patterns.spec.js @@ -10,7 +10,7 @@ test.describe( 'Unsynced pattern', () => { } ); test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.afterEach( async ( { requestUtils } ) => { diff --git a/test/e2e/specs/editor/various/popovers.spec.js b/test/e2e/specs/editor/various/popovers.spec.js index 149e188db46f28..e1e6d515d3cbf6 100644 --- a/test/e2e/specs/editor/various/popovers.spec.js +++ b/test/e2e/specs/editor/various/popovers.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'popovers', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.describe( 'dropdown', () => { diff --git a/test/e2e/specs/editor/various/post-editor-template-mode.spec.js b/test/e2e/specs/editor/various/post-editor-template-mode.spec.js index b9bfbf9dd6b05e..8dc98223054f0e 100644 --- a/test/e2e/specs/editor/various/post-editor-template-mode.spec.js +++ b/test/e2e/specs/editor/various/post-editor-template-mode.spec.js @@ -153,7 +153,7 @@ class PostEditorTemplateMode { } async createPostAndSaveDraft() { - await this.admin.createNewPost(); + await this.admin.visitPostEditor(); // Create a random post. await this.page.keyboard.type( 'Just an FSE Post' ); await this.page.keyboard.press( 'Enter' ); diff --git a/test/e2e/specs/editor/various/post-visibility.spec.js b/test/e2e/specs/editor/various/post-visibility.spec.js index 365209ef2e4e55..dc23f65bf43d7e 100644 --- a/test/e2e/specs/editor/various/post-visibility.spec.js +++ b/test/e2e/specs/editor/various/post-visibility.spec.js @@ -13,7 +13,7 @@ test.describe( 'Post visibility', () => { } ) => { await pageUtils.setBrowserViewport( viewport ); - await admin.createNewPost(); + await admin.visitPostEditor(); await editor.openDocumentSettingsSidebar(); @@ -42,7 +42,7 @@ test.describe( 'Post visibility', () => { } ) => { await pageUtils.setBrowserViewport( viewport ); - await admin.createNewPost(); + await admin.visitPostEditor(); await editor.openDocumentSettingsSidebar(); @@ -75,7 +75,7 @@ test.describe( 'Post visibility', () => { admin, editor, } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); // Enter a title for this post. await editor.canvas diff --git a/test/e2e/specs/editor/various/preview.spec.js b/test/e2e/specs/editor/various/preview.spec.js index cfec384adba9bf..bb293f79ed187d 100644 --- a/test/e2e/specs/editor/various/preview.spec.js +++ b/test/e2e/specs/editor/various/preview.spec.js @@ -11,7 +11,7 @@ test.use( { test.describe( 'Preview', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'should open a preview window for a new post', async ( { @@ -217,7 +217,7 @@ test.describe( 'Preview', () => { test.describe( 'Preview with Custom Fields enabled', () => { test.beforeEach( async ( { admin, previewUtils } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await previewUtils.toggleCustomFieldsOption( true ); } ); @@ -294,7 +294,10 @@ test.describe( 'Preview with private custom post type', () => { admin, page, } ) => { - await admin.createNewPost( { postType: 'not_public', title: 'aaaaa' } ); + await admin.visitPostEditor( { + postType: 'not_public', + title: 'aaaaa', + } ); // Open the view menu. await page.click( 'role=button[name="Preview"i]' ); diff --git a/test/e2e/specs/editor/various/publish-panel.spec.js b/test/e2e/specs/editor/various/publish-panel.spec.js index 1ea72d7eb11a22..ec0c8e13fccad3 100644 --- a/test/e2e/specs/editor/various/publish-panel.spec.js +++ b/test/e2e/specs/editor/various/publish-panel.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'Post publish panel', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'should move focus back to the Publish panel toggle button when canceling', async ( { diff --git a/test/e2e/specs/editor/various/rich-text-deprecated-multiline.spec.js b/test/e2e/specs/editor/various/rich-text-deprecated-multiline.spec.js index 9fa3fef903c7fc..3a27a76dcec277 100644 --- a/test/e2e/specs/editor/various/rich-text-deprecated-multiline.spec.js +++ b/test/e2e/specs/editor/various/rich-text-deprecated-multiline.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'RichText deprecated multiline', () => { test.beforeEach( async ( { admin, page, editor } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await page.evaluate( () => { const registerBlockType = window.wp.blocks.registerBlockType; const { useBlockProps, RichText } = window.wp.blockEditor; diff --git a/test/e2e/specs/editor/various/rich-text.spec.js b/test/e2e/specs/editor/various/rich-text.spec.js index 2969a33d254852..2b0e29067dd365 100644 --- a/test/e2e/specs/editor/various/rich-text.spec.js +++ b/test/e2e/specs/editor/various/rich-text.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'RichText', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'should handle change in tag name gracefully', async ( { diff --git a/test/e2e/specs/editor/various/rtl.spec.js b/test/e2e/specs/editor/various/rtl.spec.js index aaf1186cc5abae..69e519c945726d 100644 --- a/test/e2e/specs/editor/various/rtl.spec.js +++ b/test/e2e/specs/editor/various/rtl.spec.js @@ -16,7 +16,7 @@ test.describe( 'RTL', () => { } ); test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test.afterAll( async ( { requestUtils } ) => { diff --git a/test/e2e/specs/editor/various/shortcut-focus-toolbar.spec.js b/test/e2e/specs/editor/various/shortcut-focus-toolbar.spec.js index 0223821613f55e..98ff86e55dc11b 100644 --- a/test/e2e/specs/editor/various/shortcut-focus-toolbar.spec.js +++ b/test/e2e/specs/editor/various/shortcut-focus-toolbar.spec.js @@ -11,7 +11,7 @@ test.use( { test.describe( 'Focus toolbar shortcut (alt + F10)', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'Focuses correct toolbar in default view options in edit mode', async ( { diff --git a/test/e2e/specs/editor/various/shortcut-help.spec.js b/test/e2e/specs/editor/various/shortcut-help.spec.js index 1aaf5e93c975c5..b172611a633984 100644 --- a/test/e2e/specs/editor/various/shortcut-help.spec.js +++ b/test/e2e/specs/editor/various/shortcut-help.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'keyboard shortcut help modal', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'opens from the options menu, closes with its close button and returns focus', async ( { diff --git a/test/e2e/specs/editor/various/splitting-merging.spec.js b/test/e2e/specs/editor/various/splitting-merging.spec.js index 29e7e5d64522c9..a8f77cb5a8f09d 100644 --- a/test/e2e/specs/editor/various/splitting-merging.spec.js +++ b/test/e2e/specs/editor/various/splitting-merging.spec.js @@ -5,7 +5,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.describe( 'splitting and merging blocks (@firefox, @webkit)', () => { test.beforeEach( async ( { admin, editor } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await expect( editor.canvas.getByRole( 'textbox', { name: 'Add title' } ) ).toBeFocused(); diff --git a/test/e2e/specs/editor/various/style-variation.spec.js b/test/e2e/specs/editor/various/style-variation.spec.js index cc13dd1ad9238e..467d3593291c20 100644 --- a/test/e2e/specs/editor/various/style-variation.spec.js +++ b/test/e2e/specs/editor/various/style-variation.spec.js @@ -9,7 +9,7 @@ test.describe( 'adding blocks', () => { editor, page, } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); // Inserting a quote block await editor.insertBlock( { diff --git a/test/e2e/specs/editor/various/toolbar-roving-tabindex.spec.js b/test/e2e/specs/editor/various/toolbar-roving-tabindex.spec.js index e706dfc3607dc3..324975805227cb 100644 --- a/test/e2e/specs/editor/various/toolbar-roving-tabindex.spec.js +++ b/test/e2e/specs/editor/various/toolbar-roving-tabindex.spec.js @@ -11,7 +11,7 @@ test.use( { test.describe( 'Toolbar roving tabindex', () => { test.beforeEach( async ( { admin, editor, page } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await editor.insertBlock( { name: 'core/paragraph' } ); await page.keyboard.type( 'First block' ); diff --git a/test/e2e/specs/editor/various/undo.spec.js b/test/e2e/specs/editor/various/undo.spec.js index 9df1c43b594746..c11a611b10d6ca 100644 --- a/test/e2e/specs/editor/various/undo.spec.js +++ b/test/e2e/specs/editor/various/undo.spec.js @@ -11,7 +11,7 @@ test.use( { test.describe( 'undo', () => { test.beforeEach( async ( { admin } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); } ); test( 'should undo typing after a pause', async ( { diff --git a/test/e2e/specs/editor/various/writing-flow.spec.js b/test/e2e/specs/editor/various/writing-flow.spec.js index a772bd91276c21..b31969ec519123 100644 --- a/test/e2e/specs/editor/various/writing-flow.spec.js +++ b/test/e2e/specs/editor/various/writing-flow.spec.js @@ -11,7 +11,7 @@ test.use( { test.describe( 'Writing Flow (@firefox, @webkit)', () => { test.beforeEach( async ( { admin, editor } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await expect( editor.canvas.getByRole( 'textbox', { name: 'Add title' } ) ).toBeFocused(); diff --git a/test/performance/specs/post-editor.spec.js b/test/performance/specs/post-editor.spec.js index 6001f0d938cf49..0ca617c4e41532 100644 --- a/test/performance/specs/post-editor.spec.js +++ b/test/performance/specs/post-editor.spec.js @@ -51,7 +51,7 @@ test.describe( 'Post Editor Performance', () => { let draftId = null; test( 'Setup the test post', async ( { admin, perfUtils } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await perfUtils.loadBlocksForLargePost(); draftId = await perfUtils.saveDraft(); } ); @@ -97,7 +97,7 @@ test.describe( 'Post Editor Performance', () => { let draftId = null; test( 'Setup the test post', async ( { admin, perfUtils, editor } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await perfUtils.loadBlocksForLargePost(); await editor.insertBlock( { name: 'core/paragraph' } ); draftId = await perfUtils.saveDraft(); @@ -150,7 +150,7 @@ test.describe( 'Post Editor Performance', () => { let draftId = null; test( 'Set up the test post', async ( { admin, perfUtils } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await perfUtils.loadBlocksForSmallPostWithContainers(); draftId = await perfUtils.saveDraft(); } ); @@ -206,7 +206,7 @@ test.describe( 'Post Editor Performance', () => { let draftId = null; test( 'Set up the test post', async ( { admin, perfUtils } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await perfUtils.load1000Paragraphs(); draftId = await perfUtils.saveDraft(); } ); @@ -261,7 +261,7 @@ test.describe( 'Post Editor Performance', () => { let draftId = null; test( 'Set up the test page', async ( { admin, perfUtils } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await perfUtils.load1000Paragraphs(); draftId = await perfUtils.saveDraft(); } ); @@ -311,7 +311,7 @@ test.describe( 'Post Editor Performance', () => { let draftId = null; test( 'Set up the test page', async ( { admin, perfUtils } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await perfUtils.load1000Paragraphs(); draftId = await perfUtils.saveDraft(); } ); @@ -367,7 +367,7 @@ test.describe( 'Post Editor Performance', () => { let draftId = null; test( 'Set up the test page', async ( { admin, perfUtils } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await perfUtils.load1000Paragraphs(); draftId = await perfUtils.saveDraft(); } ); @@ -423,7 +423,7 @@ test.describe( 'Post Editor Performance', () => { let draftId = null; test( 'Set up the test page', async ( { admin, perfUtils } ) => { - await admin.createNewPost(); + await admin.visitPostEditor(); await perfUtils.load1000Paragraphs(); draftId = await perfUtils.saveDraft(); } ); diff --git a/test/performance/specs/site-editor.spec.js b/test/performance/specs/site-editor.spec.js index f2f211dd52e6e0..46e7067c5e3c96 100644 --- a/test/performance/specs/site-editor.spec.js +++ b/test/performance/specs/site-editor.spec.js @@ -60,7 +60,7 @@ test.describe( 'Site Editor Performance', () => { let draftURL = null; test( 'Setup the test page', async ( { page, admin, perfUtils } ) => { - await admin.createNewPost( { postType: 'page' } ); + await admin.visitPostEditor( { postType: 'page' } ); await perfUtils.loadBlocksForLargePost(); await perfUtils.saveDraft(); @@ -117,7 +117,7 @@ test.describe( 'Site Editor Performance', () => { editor, perfUtils, } ) => { - await admin.createNewPost( { postType: 'page' } ); + await admin.visitPostEditor( { postType: 'page' } ); await perfUtils.loadBlocksForLargePost(); await editor.insertBlock( { name: 'core/paragraph' } ); await perfUtils.saveDraft();