Skip to content

Commit

Permalink
Fix flaky change detection tests causing intermittent failures (#31861)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed May 15, 2021
1 parent b1f0b3d commit 0b9af84
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions packages/e2e-tests/specs/editor/various/change-detection.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,17 @@ describe( 'Change detection', () => {
// Keyboard shortcut Ctrl+S save.
await pressKeyWithModifier( 'primary', 'S' );

// Start this check immediately after save since dirtying the post will
// remove the "Saved" with the Save button.
const savedPromise = page.waitForSelector(
'.editor-post-saved-state.is-saved'
);

// Dirty post while save is in-flight.
await page.type( '.editor-post-title__input', '!' );

// Allow save to complete. Disabling interception flushes pending.
await Promise.all( [
page.waitForSelector( '.editor-post-saved-state.is-saved' ),
releaseSaveIntercept(),
] );
await Promise.all( [ savedPromise, releaseSaveIntercept() ] );

await assertIsDirty( true );
} );
Expand All @@ -302,14 +305,17 @@ describe( 'Change detection', () => {
// Keyboard shortcut Ctrl+S save.
await pressKeyWithModifier( 'primary', 'S' );

// Start this check immediately after save since dirtying the post will
// remove the "Saved" with the Save button.
const savedPromise = page.waitForSelector(
'.editor-post-saved-state.is-saved'
);

await clickBlockAppender();
await page.keyboard.type( 'Paragraph' );

// Allow save to complete. Disabling interception flushes pending.
await Promise.all( [
page.waitForSelector( '.editor-post-saved-state.is-saved' ),
releaseSaveIntercept(),
] );
await Promise.all( [ savedPromise, releaseSaveIntercept() ] );

await assertIsDirty( true );
} );
Expand Down

0 comments on commit 0b9af84

Please sign in to comment.