From 2d99682c7b77c09e91b63817f6340a7daba7ac96 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Wed, 7 Sep 2022 10:31:43 +0800 Subject: [PATCH] Remove puppeteer test --- .../draggable-block.test.js.snap | 41 ------ .../editor/various/draggable-block.test.js | 128 ------------------ 2 files changed, 169 deletions(-) delete mode 100644 packages/e2e-tests/specs/editor/various/__snapshots__/draggable-block.test.js.snap delete mode 100644 packages/e2e-tests/specs/editor/various/draggable-block.test.js diff --git a/packages/e2e-tests/specs/editor/various/__snapshots__/draggable-block.test.js.snap b/packages/e2e-tests/specs/editor/various/__snapshots__/draggable-block.test.js.snap deleted file mode 100644 index cef8263aca7c6a..00000000000000 --- a/packages/e2e-tests/specs/editor/various/__snapshots__/draggable-block.test.js.snap +++ /dev/null @@ -1,41 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Draggable block can drag and drop to the bottom of a block list 1`] = ` -" -

1

- - - -

2

-" -`; - -exports[`Draggable block can drag and drop to the bottom of a block list 2`] = ` -" -

2

- - - -

1

-" -`; - -exports[`Draggable block can drag and drop to the top of a block list 1`] = ` -" -

1

- - - -

2

-" -`; - -exports[`Draggable block can drag and drop to the top of a block list 2`] = ` -" -

2

- - - -

1

-" -`; diff --git a/packages/e2e-tests/specs/editor/various/draggable-block.test.js b/packages/e2e-tests/specs/editor/various/draggable-block.test.js deleted file mode 100644 index 500e32c1661a39..00000000000000 --- a/packages/e2e-tests/specs/editor/various/draggable-block.test.js +++ /dev/null @@ -1,128 +0,0 @@ -/** - * WordPress dependencies - */ -import { - getEditedPostContent, - createNewPost, - deactivatePlugin, - activatePlugin, - showBlockToolbar, - setBrowserViewport, - waitForWindowDimensions, - clickBlockAppender, -} from '@wordpress/e2e-test-utils'; - -describe.skip( 'Draggable block', () => { - // Tests don't seem to pass if beforeAll and afterAll are used. - // Unsure why. - beforeEach( async () => { - await deactivatePlugin( - 'gutenberg-test-plugin-disables-the-css-animations' - ); - - // Set the viewport at a larger size than normal to ensure scrolling doesn't occur. - // Scrolling can interfere with the drag coordinates. - await page.setViewport( { width: 960, height: 1024 } ); - await waitForWindowDimensions( 960, 1024 ); - await createNewPost(); - await page.setDragInterception( true ); - } ); - - afterEach( async () => { - await page.setDragInterception( false ); - - // Reset the viewport to normal large size. - await setBrowserViewport( 'large' ); - await activatePlugin( - 'gutenberg-test-plugin-disables-the-css-animations' - ); - } ); - - it( 'can drag and drop to the top of a block list', async () => { - await clickBlockAppender(); - await page.keyboard.type( '1' ); - await page.keyboard.press( 'Enter' ); - await page.keyboard.type( '2' ); - - // Confirm correct setup. - expect( await getEditedPostContent() ).toMatchSnapshot(); - - await showBlockToolbar(); - const dragHandle = await page.waitForSelector( - '.block-editor-block-mover__drag-handle' - ); - const dragHandlePoint = await dragHandle.clickablePoint(); - - const firstParagraph = await page.$( '[data-type="core/paragraph"]' ); - const targetPoint = await firstParagraph.clickablePoint(); - const targetRect = await firstParagraph.boundingBox(); - const target = { - x: targetPoint.x, - // Drag to the top half. - y: targetPoint.y - targetRect.height * 0.25, - }; - - const dragData = await page.mouse.drag( dragHandlePoint, target ); - await page.mouse.dragEnter( target, dragData ); - await page.mouse.dragOver( target, dragData ); - - // Wait for the insertion point to be visible. - const insertionPoint = await page.waitForSelector( - '.block-editor-block-list__insertion-point' - ); - - // Expect the insertion point to be visible above the first paragraph. - const insertionPointBoundingBox = await insertionPoint.boundingBox(); - expect( insertionPointBoundingBox.y ).toBeLessThan( target.y ); - - await page.mouse.drop( target, dragData ); - - expect( await getEditedPostContent() ).toMatchSnapshot(); - } ); - - it( 'can drag and drop to the bottom of a block list', async () => { - await clickBlockAppender(); - await page.keyboard.type( '1' ); - await page.keyboard.press( 'Enter' ); - await page.keyboard.type( '2' ); - await page.keyboard.press( 'ArrowUp' ); - - // Confirm correct setup. - expect( await getEditedPostContent() ).toMatchSnapshot(); - - const [ , secondParagraph ] = await page.$$( - '[data-type="core/paragraph"]' - ); - - await showBlockToolbar(); - const dragHandle = await page.waitForSelector( - '.block-editor-block-mover__drag-handle' - ); - const dragHandlePoint = await dragHandle.clickablePoint(); - - const targetPoint = await secondParagraph.clickablePoint(); - const targetRect = await secondParagraph.boundingBox(); - const target = { - x: targetPoint.x, - // Drag to the bottom half. - y: targetPoint.y + targetRect.height * 0.25, - }; - - const dragData = await page.mouse.drag( dragHandlePoint, target ); - await page.mouse.dragEnter( target, dragData ); - await page.mouse.dragOver( target, dragData ); - - // Wait for the insertion point to be visible. - const insertionPoint = await page.waitForSelector( - '.block-editor-block-list__insertion-point' - ); - - // Expect the insertion point to be visible below the first paragraph. - const insertionPointBoundingBox = await insertionPoint.boundingBox(); - expect( insertionPointBoundingBox.y ).toBeGreaterThan( target.y ); - - await page.mouse.drop( target, dragData ); - - expect( await getEditedPostContent() ).toMatchSnapshot(); - } ); -} );