Skip to content

Commit

Permalink
Migrate 'iframed masonry block' tests to Playwright (#55016)
Browse files Browse the repository at this point in the history
* Migrate 'iframed masonry block' tests to Playwright
* Remove old test files
* Use boundingBox
  • Loading branch information
Mamaduka authored Oct 4, 2023
1 parent b4c0938 commit 8f80a11
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 63 deletions.
7 changes: 0 additions & 7 deletions packages/e2e-tests/plugins/iframed-masonry-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
* @package gutenberg-test-iframed-masonry-block
*/

add_action(
'setup_theme',
static function () {
add_theme_support( 'block-templates' );
}
);

add_action(
'init',
static function () {
Expand Down

This file was deleted.

This file was deleted.

44 changes: 44 additions & 0 deletions test/e2e/specs/editor/plugins/iframed-masonry-block.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* WordPress dependencies
*/
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );

test.describe( 'iframed masonry block', () => {
test.beforeAll( async ( { requestUtils } ) => {
await requestUtils.activatePlugin(
'gutenberg-test-iframed-masonry-block'
);
} );

test.beforeEach( async ( { admin } ) => {
await admin.createNewPost();
} );

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.deactivatePlugin(
'gutenberg-test-iframed-masonry-block'
);
} );

test( 'should load script and dependencies in iframe', async ( {
editor,
} ) => {
await editor.insertBlock( { name: 'test/iframed-masonry-block' } );

const masonry = editor.canvas.getByRole( 'document', {
name: 'Block: Iframed Masonry Block',
} );
await expect( masonry ).toBeVisible();

const masonryBox = await masonry.boundingBox();

// Expect Masonry to set a non-zero height.
expect( masonryBox.height ).toBeGreaterThan( 0 );

// Expect Masonry to absolute position items.
await expect( masonry.locator( '.grid-item' ).first() ).toHaveCSS(
'position',
'absolute'
);
} );
} );

1 comment on commit 8f80a11

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 8f80a11.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6401720809
📝 Reported issues:

Please sign in to comment.