From 2b9866cabd2efb8f828d0d41c0ffa21c713639b5 Mon Sep 17 00:00:00 2001 From: Bart Kalisz Date: Wed, 31 Aug 2022 13:25:22 +0200 Subject: [PATCH 1/7] Test: See if clearing session storage fixes draggable block tests --- package.json | 2 +- .../specs/editor/various/draggable-block.test.js | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 7f0c55260fd9f5..580753159dfb76 100755 --- a/package.json +++ b/package.json @@ -292,7 +292,7 @@ "storybook:dev": "concurrently \"npm run dev:packages\" \"start-storybook -c ./storybook -p 50240\"", "test": "npm-run-all lint test:unit", "test:create-block": "bash ./bin/test-create-block.sh", - "test:e2e": "wp-scripts test-e2e --config packages/e2e-tests/jest.config.js", + "test:e2e": "wp-scripts test-e2e packages/e2e-tests/specs/editor/various/draggable-block.test.js --config packages/e2e-tests/jest.config.js", "test:e2e:debug": "wp-scripts --inspect-brk test-e2e --config packages/e2e-tests/jest.config.js --puppeteer-devtools", "test:e2e:playwright": "playwright test --config test/e2e/playwright.config.ts", "test:e2e:watch": "npm run test:e2e -- --watch", diff --git a/packages/e2e-tests/specs/editor/various/draggable-block.test.js b/packages/e2e-tests/specs/editor/various/draggable-block.test.js index 500e32c1661a39..6b87b9dfbc9e7c 100644 --- a/packages/e2e-tests/specs/editor/various/draggable-block.test.js +++ b/packages/e2e-tests/specs/editor/various/draggable-block.test.js @@ -7,15 +7,14 @@ import { deactivatePlugin, activatePlugin, showBlockToolbar, - setBrowserViewport, waitForWindowDimensions, clickBlockAppender, } from '@wordpress/e2e-test-utils'; -describe.skip( 'Draggable block', () => { +describe( 'Draggable block', () => { // Tests don't seem to pass if beforeAll and afterAll are used. // Unsure why. - beforeEach( async () => { + beforeAll( async () => { await deactivatePlugin( 'gutenberg-test-plugin-disables-the-css-animations' ); @@ -24,15 +23,16 @@ describe.skip( 'Draggable block', () => { // 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 ); + beforeEach( async () => { + await page.evaluate( () => window.sessionStorage.clear() ); + await createNewPost(); + } ); - // Reset the viewport to normal large size. - await setBrowserViewport( 'large' ); + afterAll( async () => { + await page.setDragInterception( false ); await activatePlugin( 'gutenberg-test-plugin-disables-the-css-animations' ); From 238603665a5ed29fe9313691ba95231dad1fe4f5 Mon Sep 17 00:00:00 2001 From: Bart Kalisz Date: Wed, 31 Aug 2022 14:18:27 +0200 Subject: [PATCH 2/7] Check without clearing session storage --- .github/workflows/end2end-test.yml | 3 +-- .../e2e-tests/specs/editor/various/draggable-block.test.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/end2end-test.yml b/.github/workflows/end2end-test.yml index e8e140bcd0e776..9e5660b5e1fba3 100644 --- a/.github/workflows/end2end-test.yml +++ b/.github/workflows/end2end-test.yml @@ -45,8 +45,7 @@ jobs: - name: Running the tests run: | - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == ${{ matrix.part }} - 1' < ~/.jest-e2e-tests ) + $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath packages/e2e-tests/specs/editor/various/draggable-block.test.js - name: Archive debug artifacts (screenshots, HTML snapshots) uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 # v2.2.2 diff --git a/packages/e2e-tests/specs/editor/various/draggable-block.test.js b/packages/e2e-tests/specs/editor/various/draggable-block.test.js index 6b87b9dfbc9e7c..cfe4dad5e7c3d2 100644 --- a/packages/e2e-tests/specs/editor/various/draggable-block.test.js +++ b/packages/e2e-tests/specs/editor/various/draggable-block.test.js @@ -27,7 +27,7 @@ describe( 'Draggable block', () => { } ); beforeEach( async () => { - await page.evaluate( () => window.sessionStorage.clear() ); + // await page.evaluate( () => window.sessionStorage.clear() ); await createNewPost(); } ); From a139585ddd6affb93bbfee810b31aeabdbcbf70b Mon Sep 17 00:00:00 2001 From: Bart Kalisz Date: Wed, 31 Aug 2022 14:53:12 +0200 Subject: [PATCH 3/7] Run all the specs --- .github/workflows/end2end-test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/end2end-test.yml b/.github/workflows/end2end-test.yml index 9e5660b5e1fba3..e8e140bcd0e776 100644 --- a/.github/workflows/end2end-test.yml +++ b/.github/workflows/end2end-test.yml @@ -45,7 +45,8 @@ jobs: - name: Running the tests run: | - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath packages/e2e-tests/specs/editor/various/draggable-block.test.js + $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests + $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == ${{ matrix.part }} - 1' < ~/.jest-e2e-tests ) - name: Archive debug artifacts (screenshots, HTML snapshots) uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 # v2.2.2 From 846d54b989ed1956de6700d7d26f09a34de461bc Mon Sep 17 00:00:00 2001 From: Marco Ciampini Date: Wed, 31 Aug 2022 18:33:15 +0200 Subject: [PATCH 4/7] cleanup --- package.json | 2 +- packages/e2e-tests/specs/editor/various/draggable-block.test.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 580753159dfb76..7f0c55260fd9f5 100755 --- a/package.json +++ b/package.json @@ -292,7 +292,7 @@ "storybook:dev": "concurrently \"npm run dev:packages\" \"start-storybook -c ./storybook -p 50240\"", "test": "npm-run-all lint test:unit", "test:create-block": "bash ./bin/test-create-block.sh", - "test:e2e": "wp-scripts test-e2e packages/e2e-tests/specs/editor/various/draggable-block.test.js --config packages/e2e-tests/jest.config.js", + "test:e2e": "wp-scripts test-e2e --config packages/e2e-tests/jest.config.js", "test:e2e:debug": "wp-scripts --inspect-brk test-e2e --config packages/e2e-tests/jest.config.js --puppeteer-devtools", "test:e2e:playwright": "playwright test --config test/e2e/playwright.config.ts", "test:e2e:watch": "npm run test:e2e -- --watch", diff --git a/packages/e2e-tests/specs/editor/various/draggable-block.test.js b/packages/e2e-tests/specs/editor/various/draggable-block.test.js index cfe4dad5e7c3d2..77204a7dee05ff 100644 --- a/packages/e2e-tests/specs/editor/various/draggable-block.test.js +++ b/packages/e2e-tests/specs/editor/various/draggable-block.test.js @@ -27,7 +27,6 @@ describe( 'Draggable block', () => { } ); beforeEach( async () => { - // await page.evaluate( () => window.sessionStorage.clear() ); await createNewPost(); } ); From 7ec02bf35e2549a987e10169d5af3e3ed9c4a945 Mon Sep 17 00:00:00 2001 From: Marco Ciampini Date: Thu, 1 Sep 2022 08:00:55 +0200 Subject: [PATCH 5/7] Remove old comments --- packages/e2e-tests/specs/editor/various/draggable-block.test.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/e2e-tests/specs/editor/various/draggable-block.test.js b/packages/e2e-tests/specs/editor/various/draggable-block.test.js index 77204a7dee05ff..67916cfc5241d7 100644 --- a/packages/e2e-tests/specs/editor/various/draggable-block.test.js +++ b/packages/e2e-tests/specs/editor/various/draggable-block.test.js @@ -12,8 +12,6 @@ import { } from '@wordpress/e2e-test-utils'; describe( 'Draggable block', () => { - // Tests don't seem to pass if beforeAll and afterAll are used. - // Unsure why. beforeAll( async () => { await deactivatePlugin( 'gutenberg-test-plugin-disables-the-css-animations' From 6f31f9217c5d43d8ba7a720f7fa807e386581f10 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Sat, 3 Sep 2022 15:19:25 +1000 Subject: [PATCH 6/7] Try keeping animations disabled to see if blocks are added --- .../specs/editor/various/draggable-block.test.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/e2e-tests/specs/editor/various/draggable-block.test.js b/packages/e2e-tests/specs/editor/various/draggable-block.test.js index 67916cfc5241d7..13de84cbd9fdca 100644 --- a/packages/e2e-tests/specs/editor/various/draggable-block.test.js +++ b/packages/e2e-tests/specs/editor/various/draggable-block.test.js @@ -13,9 +13,9 @@ import { describe( 'Draggable block', () => { beforeAll( async () => { - await deactivatePlugin( - 'gutenberg-test-plugin-disables-the-css-animations' - ); + // 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. @@ -30,9 +30,9 @@ describe( 'Draggable block', () => { afterAll( async () => { await page.setDragInterception( false ); - await activatePlugin( - 'gutenberg-test-plugin-disables-the-css-animations' - ); + // await activatePlugin( + // 'gutenberg-test-plugin-disables-the-css-animations' + // ); } ); it( 'can drag and drop to the top of a block list', async () => { From 3168646a29a24c4783f5f830147493f0c49c2ff8 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Sat, 3 Sep 2022 16:42:14 +1000 Subject: [PATCH 7/7] Revert "Try keeping animations disabled to see if blocks are added" This reverts commit 6f31f9217c5d43d8ba7a720f7fa807e386581f10. --- .../specs/editor/various/draggable-block.test.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/e2e-tests/specs/editor/various/draggable-block.test.js b/packages/e2e-tests/specs/editor/various/draggable-block.test.js index 13de84cbd9fdca..67916cfc5241d7 100644 --- a/packages/e2e-tests/specs/editor/various/draggable-block.test.js +++ b/packages/e2e-tests/specs/editor/various/draggable-block.test.js @@ -13,9 +13,9 @@ import { describe( 'Draggable block', () => { beforeAll( async () => { - // await deactivatePlugin( - // 'gutenberg-test-plugin-disables-the-css-animations' - // ); + 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. @@ -30,9 +30,9 @@ describe( 'Draggable block', () => { afterAll( async () => { await page.setDragInterception( false ); - // await activatePlugin( - // 'gutenberg-test-plugin-disables-the-css-animations' - // ); + await activatePlugin( + 'gutenberg-test-plugin-disables-the-css-animations' + ); } ); it( 'can drag and drop to the top of a block list', async () => {