Skip to content

Commit 694159e

Browse files
committed
Add a list view typing test to catch perfromance regressions
1 parent f2093f4 commit 694159e

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

test/performance/config/performance-reporter.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export interface WPRawPerformanceResults {
2929
typeWithoutInspector: number[];
3030
typeWithTopToolbar: number[];
3131
typeContainer: number[];
32+
typeWithListViewOpen: number[];
3233
focus: number[];
3334
inserterOpen: number[];
3435
inserterSearch: number[];
@@ -65,6 +66,7 @@ export interface WPPerformanceResults {
6566
typeWithoutInspector?: PerformanceStats;
6667
typeWithTopToolbar?: PerformanceStats;
6768
typeContainer?: PerformanceStats;
69+
typeWithListViewOpen?: PerformanceStats;
6870
focus?: PerformanceStats;
6971
inserterOpen?: PerformanceStats;
7072
inserterSearch?: PerformanceStats;
@@ -103,6 +105,7 @@ export function curateResults(
103105
typeWithoutInspector: stats( results.typeWithoutInspector ),
104106
typeWithTopToolbar: stats( results.typeWithTopToolbar ),
105107
typeContainer: stats( results.typeContainer ),
108+
typeWithListViewOpen: stats( results.typeWithListViewOpen ),
106109
focus: stats( results.focus ),
107110
inserterOpen: stats( results.inserterOpen ),
108111
inserterSearch: stats( results.inserterSearch ),

test/performance/specs/post-editor.spec.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const results = {
2727
typeContainer: [],
2828
focus: [],
2929
listViewOpen: [],
30+
typeWithListViewOpen: [],
3031
inserterOpen: [],
3132
inserterHover: [],
3233
inserterSearch: [],
@@ -355,6 +356,41 @@ test.describe( 'Post Editor Performance', () => {
355356
} );
356357
} );
357358

359+
test.describe( 'Typing (with List View open)', () => {
360+
let draftId = null;
361+
362+
test( 'Setup the test post', async ( { admin, perfUtils, editor } ) => {
363+
await admin.createNewPost();
364+
await perfUtils.loadBlocksForLargePost();
365+
await editor.insertBlock( { name: 'core/paragraph' } );
366+
draftId = await perfUtils.saveDraft();
367+
} );
368+
369+
test( 'Run the test', async ( { admin, perfUtils, metrics, page } ) => {
370+
await admin.editPost( draftId );
371+
await perfUtils.disableAutosave();
372+
373+
// Open List View
374+
const listViewToggle = page.getByRole( 'button', {
375+
name: 'Document Overview',
376+
} );
377+
await listViewToggle.click();
378+
await perfUtils.expectExpandedState( listViewToggle, 'true' );
379+
380+
const canvas = await perfUtils.getCanvas();
381+
382+
const paragraph = canvas.getByRole( 'document', {
383+
name: /Empty block/i,
384+
} );
385+
386+
await type( paragraph, metrics, 'typeWithListViewOpen' );
387+
388+
// Close List View
389+
await listViewToggle.click();
390+
await perfUtils.expectExpandedState( listViewToggle, 'false' );
391+
} );
392+
} );
393+
358394
test.describe( 'Opening Inserter', () => {
359395
let draftId = null;
360396

0 commit comments

Comments
 (0)