Repository navigation
Migrate 'iframed inline styles' tests to Playwright #55009
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |
| */ | ||
| const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); | ||
|
|
||
| test.describe( 'iframed inline styles', () => { | ||
| test.describe( 'iframed enqueue block assets', () => { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I missed that there was a copy/paste issue when migrating this test. |
||
| test.beforeAll( async ( { requestUtils } ) => { | ||
| await Promise.all( [ | ||
| requestUtils.activateTheme( 'emptytheme' ), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| /** | ||
| * WordPress dependencies | ||
| */ | ||
| const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); | ||
|
|
||
| test.describe( 'iframed inline styles', () => { | ||
| test.beforeAll( async ( { requestUtils } ) => { | ||
| await requestUtils.activatePlugin( | ||
| 'gutenberg-test-iframed-inline-styles' | ||
| ); | ||
| } ); | ||
|
|
||
| test.afterAll( async ( { requestUtils } ) => { | ||
| await requestUtils.deactivatePlugin( | ||
| 'gutenberg-test-iframed-inline-styles' | ||
| ); | ||
| } ); | ||
|
|
||
| test( 'should load inline styles in iframe', async ( { | ||
| admin, | ||
| editor, | ||
| page, | ||
| } ) => { | ||
| let hasWarning; | ||
| page.on( 'console', ( msg ) => { | ||
| if ( msg.type() === 'warning' ) { | ||
| hasWarning = true; | ||
| } | ||
| } ); | ||
|
|
||
| await admin.createNewPost( { postType: 'page' } ); | ||
| await editor.insertBlock( { name: 'test/iframed-inline-styles' } ); | ||
|
|
||
| const block = editor.canvas.getByRole( 'document', { | ||
| name: 'Block: Iframed Inline Styles', | ||
| } ); | ||
| await expect( block ).toBeVisible(); | ||
|
|
||
| // Inline styles of properly enqueued stylesheet should load. | ||
| await expect( block ).toHaveCSS( 'padding', '20px' ); | ||
|
|
||
| // Inline styles of stylesheet loaded with the compatibility layer should load. | ||
| await expect( block ).toHaveCSS( 'border-width', '2px' ); | ||
| expect( hasWarning ).toBe( true ); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It will be nice to at least know what warnings are being thrown, but not required in this PR as a part of the migration.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also wanted to do that, but I decided to stick with linear migration for now 😅 Happy to follow up if this causes any flaky test reports. By the way, Can we loosely assert array strings? e.g., Confirm array has value containing 'example' string?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep! I think we can do |
||
| } ); | ||
| } ); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is no longer needed as the editor canvas renders in iframed by default now.