Skip to content

Commit

Permalink
[Automated Testing]: Fix partial selection copy flaky tests (#40607)
Browse files Browse the repository at this point in the history
* [Automated Testing]: Fix partial selection copy flaky tests

* add same delay to the other similar tests
  • Loading branch information
ntsekouras authored Apr 26, 2022
1 parent d8fd70c commit 7f0c753
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/e2e/specs/editor/various/copy-cut-paste.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,11 @@ test.describe( 'Copy/cut/paste', () => {
await pageUtils.pressKeyWithModifier( 'shift', 'ArrowUp' );
await pageUtils.pressKeyWithModifier( 'primary', 'c' );
await pageUtils.pressKeyWithModifier( 'primary', 'ArrowLeft' );
// Sometimes the caret has not moved to the correct position before pressing Enter.
// @see https://github.com/WordPress/gutenberg/issues/40303#issuecomment-1109434887
await page.waitForFunction(
() => window.getSelection().type === 'Caret'
);
// Create a new block at the top of the document to paste there.
await page.keyboard.press( 'Enter' );
await page.keyboard.press( 'ArrowUp' );
Expand All @@ -268,6 +273,11 @@ test.describe( 'Copy/cut/paste', () => {
await pageUtils.pressKeyWithModifier( 'shift', 'ArrowUp' );
await pageUtils.pressKeyWithModifier( 'primary', 'c' );
await pageUtils.pressKeyWithModifier( 'primary', 'ArrowLeft' );
// Sometimes the caret has not moved to the correct position before pressing Enter.
// @see https://github.com/WordPress/gutenberg/issues/40303#issuecomment-1109434887
await page.waitForFunction(
() => window.getSelection().type === 'Caret'
);
// Create a new block at the top of the document to paste there.
await page.keyboard.press( 'Enter' );
await page.keyboard.press( 'ArrowUp' );
Expand All @@ -289,6 +299,11 @@ test.describe( 'Copy/cut/paste', () => {
await pageUtils.pressKeyWithModifier( 'shift', 'ArrowUp' );
await pageUtils.pressKeyWithModifier( 'primary', 'x' );
await pageUtils.pressKeyWithModifier( 'primary', 'ArrowLeft' );
// Sometimes the caret has not moved to the correct position before pressing Enter.
// @see https://github.com/WordPress/gutenberg/issues/40303#issuecomment-1109434887
await page.waitForFunction(
() => window.getSelection().type === 'Caret'
);
// Create a new block at the top of the document to paste there.
await page.keyboard.press( 'Enter' );
await page.keyboard.press( 'ArrowUp' );
Expand All @@ -311,6 +326,11 @@ test.describe( 'Copy/cut/paste', () => {
await pageUtils.pressKeyWithModifier( 'shift', 'ArrowUp' );
await pageUtils.pressKeyWithModifier( 'primary', 'x' );
await pageUtils.pressKeyWithModifier( 'primary', 'ArrowLeft' );
// Sometimes the caret has not moved to the correct position before pressing Enter.
// @see https://github.com/WordPress/gutenberg/issues/40303#issuecomment-1109434887
await page.waitForFunction(
() => window.getSelection().type === 'Caret'
);
// Create a new block at the top of the document to paste there.
await page.keyboard.press( 'Enter' );
await page.keyboard.press( 'ArrowUp' );
Expand All @@ -332,6 +352,11 @@ test.describe( 'Copy/cut/paste', () => {
await pageUtils.pressKeyWithModifier( 'shift', 'ArrowUp' );
await pageUtils.pressKeyWithModifier( 'primary', 'x' );
await pageUtils.pressKeyWithModifier( 'primary', 'ArrowLeft' );
// Sometimes the caret has not moved to the correct position before pressing Enter.
// @see https://github.com/WordPress/gutenberg/issues/40303#issuecomment-1109434887
await page.waitForFunction(
() => window.getSelection().type === 'Caret'
);
// Create a new block at the top of the document to paste there.
await page.keyboard.press( 'Enter' );
await page.keyboard.press( 'ArrowUp' );
Expand Down

0 comments on commit 7f0c753

Please sign in to comment.