diff --git a/packages/e2e-tests/specs/site-editor/site-editor-inserter.test.js b/packages/e2e-tests/specs/site-editor/site-editor-inserter.test.js deleted file mode 100644 index d698b35e9e7589..00000000000000 --- a/packages/e2e-tests/specs/site-editor/site-editor-inserter.test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * WordPress dependencies - */ -import { - deleteAllTemplates, - activateTheme, - visitSiteEditor, -} from '@wordpress/e2e-test-utils'; - -describe( 'Site Editor Inserter', () => { - beforeAll( async () => { - await activateTheme( 'emptytheme' ); - await deleteAllTemplates( 'wp_template' ); - await deleteAllTemplates( 'wp_template_part' ); - } ); - afterAll( async () => { - await activateTheme( 'twentytwentyone' ); - } ); - beforeEach( async () => { - await visitSiteEditor(); - } ); - - it( 'inserter toggle button should toggle global inserter', async () => { - await page.click( '.edit-site-header-edit-mode__inserter-toggle' ); - await page.waitForSelector( '.edit-site-editor__inserter-panel', { - visible: true, - } ); - await page.click( '.edit-site-header-edit-mode__inserter-toggle' ); - await page.waitForSelector( '.edit-site-editor__inserter-panel', { - hidden: true, - } ); - } ); -} ); diff --git a/test/e2e/specs/site-editor/site-editor-inserter.spec.js b/test/e2e/specs/site-editor/site-editor-inserter.spec.js new file mode 100644 index 00000000000000..d079176bace94e --- /dev/null +++ b/test/e2e/specs/site-editor/site-editor-inserter.spec.js @@ -0,0 +1,42 @@ +/** + * WordPress dependencies + */ +const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); + +test.describe( 'Site Editor Inserter', () => { + test.beforeAll( async ( { requestUtils } ) => { + await Promise.all( [ + requestUtils.activateTheme( 'emptytheme' ), + requestUtils.deleteAllTemplates( 'wp_template' ), + requestUtils.deleteAllTemplates( 'wp_template_part' ), + ] ); + } ); + + test.afterAll( async ( { requestUtils } ) => { + await requestUtils.activateTheme( 'twentytwentyone' ); + } ); + + test.beforeEach( async ( { admin } ) => { + await admin.visitSiteEditor(); + } ); + + test( 'inserter toggle button should toggle global inserter', async ( { + page, + } ) => { + await page.click( 'role=button[name="Toggle block inserter"i]' ); + + // Visibility check + await expect( + page.locator( + 'role=searchbox[name="Search for blocks and patterns"i]' + ) + ).toBeVisible(); + await page.click( 'role=button[name="Toggle block inserter"i]' ); + //Hidden State check + await expect( + page.locator( + 'role=searchbox[name="Search for blocks and patterns"i]' + ) + ).toBeHidden(); + } ); +} );