diff --git a/test/e2e/specs/editor/various/block-renaming.spec.js b/test/e2e/specs/editor/various/block-renaming.spec.js index c7304023b970c..6dc1e9a3a49f4 100644 --- a/test/e2e/specs/editor/various/block-renaming.spec.js +++ b/test/e2e/specs/editor/various/block-renaming.spec.js @@ -36,26 +36,10 @@ test.describe( 'Block Renaming', () => { page, pageUtils, } ) => { - // Turn on block list view by default. - await editor.setPreferences( 'core', { - showListViewByDefault: true, - } ); - - const listView = page.getByRole( 'treegrid', { - name: 'Block navigation structure', - } ); - - await editor.insertBlock( { - name: 'core/group', - attributes: { content: 'First Paragraph' }, - } ); + await editor.insertBlock( { name: 'core/group' } ); // Select via keyboard. await pageUtils.pressKeys( 'primary+a' ); - - // Convert to a Group block which supports renaming. - await editor.clickBlockOptionsMenuItem( 'Group' ); - await editor.clickBlockOptionsMenuItem( 'Rename' ); const renameMenuItem = page.getByRole( 'menuitem', { @@ -107,11 +91,18 @@ test.describe( 'Block Renaming', () => { 'false' ); - // Check custom name reflected in List View. - listView.getByRole( 'link', { - name: 'My new name', + await pageUtils.pressKeys( 'access+o' ); + const listView = page.getByRole( 'treegrid', { + name: 'Block navigation structure', } ); + await expect( + listView.getByRole( 'link', { + name: 'My new name', + } ), + 'should reflect custom name in List View' + ).toBeVisible(); + await expect.poll( editor.getBlocks ).toMatchObject( [ { name: 'core/group', @@ -123,7 +114,8 @@ test.describe( 'Block Renaming', () => { }, ] ); - // Re-trigger the rename dialog. + // Re-trigger the rename dialog from the List View. + await listView.getByRole( 'button', { name: 'Options' } ).click(); await renameMenuItem.click(); // Expect modal input to contain the custom name. @@ -142,10 +134,12 @@ test.describe( 'Block Renaming', () => { await saveButton.click(); - // Check the original block name to reflected in List View. - listView.getByRole( 'link', { - name: 'Group', - } ); + await expect( + listView.getByRole( 'link', { + name: 'Group', + } ), + 'should reflect original name in List View' + ).toBeVisible(); // Expect block to have no custom name (i.e. it should be reset to the original block name). await expect.poll( editor.getBlocks ).toMatchObject( [