Skip to content

Commit

Permalink
Migrate 'iframed multiple block stylesheets' tests to Playwright (#55003
Browse files Browse the repository at this point in the history
)

* Migrate 'iframed multiple block stylesheets' tests to Playwright
* Remove old test file
  • Loading branch information
Mamaduka authored Oct 4, 2023
1 parent dbe1948 commit 8a5dd61
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 65 deletions.
7 changes: 0 additions & 7 deletions packages/e2e-tests/plugins/iframed-multiple-stylesheets.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
* @package gutenberg-test-iframed-multiple-stylesheets
*/

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

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

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* WordPress dependencies
*/
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );

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

test.beforeEach( async ( { admin } ) => {
await admin.createNewPost( { postType: 'page' } );
} );

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

test( 'should load multiple block stylesheets in iframe', async ( {
editor,
} ) => {
await editor.insertBlock( {
name: 'test/iframed-multiple-stylesheets',
} );
const block = editor.canvas.getByRole( 'document', {
name: 'Block: Iframed Multiple Stylesheets',
} );

await expect( block ).toBeVisible();

// Style loaded from the main stylesheet.
await expect( block ).toHaveCSS( 'border-style', 'dashed' );
// Style loaded from the additional stylesheet.
await expect( block ).toHaveCSS( 'border-color', 'rgb(255, 0, 0)' );
// Style loaded from the a stylesheet using path instead of handle.
await expect( block ).toHaveCSS( 'border-color', 'rgb(255, 0, 0)' );
} );
} );

1 comment on commit 8a5dd61

@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 8a5dd61.
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/6404274826
📝 Reported issues:

Please sign in to comment.