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
Migrate Navigable toolbar test to Playwright #51514
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
Check failure on line 1 in test/e2e/specs/editor/various/navigable-toolbar.spec.js GitHub Actions / Playwright - 2[chromium] › editor/various/navigable-toolbar.spec.js:12:3 › Block Toolbar › Contextual Toolbar › should not scroll page
Check failure on line 1 in test/e2e/specs/editor/various/navigable-toolbar.spec.js GitHub Actions / Playwright - 2[chromium] › editor/various/navigable-toolbar.spec.js:12:3 › Block Toolbar › Contextual Toolbar › should not scroll page
Check failure on line 1 in test/e2e/specs/editor/various/navigable-toolbar.spec.js GitHub Actions / Playwright - 2[chromium] › editor/various/navigable-toolbar.spec.js:12:3 › Block Toolbar › Contextual Toolbar › should not scroll page
Check failure on line 1 in test/e2e/specs/editor/various/navigable-toolbar.spec.js GitHub Actions / Playwright - 2[chromium] › editor/various/navigable-toolbar.spec.js:12:3 › Block Toolbar › Contextual Toolbar › should not scroll page
|
||
* WordPress dependencies | ||
*/ | ||
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); | ||
|
||
test.describe( 'Block Toolbar', () => { | ||
test.beforeEach( async ( { admin } ) => { | ||
await admin.createNewPost(); | ||
} ); | ||
|
||
test.describe( 'Contextual Toolbar', () => { | ||
test( 'should not scroll page', async ( { page, pageUtils } ) => { | ||
while ( | ||
await page.evaluate( () => { | ||
const scrollable = window.wp.dom.getScrollContainer( | ||
document.activeElement | ||
); | ||
return ! scrollable || scrollable.scrollTop === 0; | ||
} ) | ||
) { | ||
await page.keyboard.press( 'Enter' ); | ||
Check failure on line 21 in test/e2e/specs/editor/various/navigable-toolbar.spec.js GitHub Actions / Playwright - 2[chromium] › editor/various/navigable-toolbar.spec.js:12:3 › Block Toolbar › Contextual Toolbar › should not scroll page
Check failure on line 21 in test/e2e/specs/editor/various/navigable-toolbar.spec.js GitHub Actions / Playwright - 2[chromium] › editor/various/navigable-toolbar.spec.js:12:3 › Block Toolbar › Contextual Toolbar › should not scroll page
Check failure on line 21 in test/e2e/specs/editor/various/navigable-toolbar.spec.js GitHub Actions / Playwright - 2[chromium] › editor/various/navigable-toolbar.spec.js:12:3 › Block Toolbar › Contextual Toolbar › should not scroll page
|
||
} | ||
|
||
await page.keyboard.type( 'a' ); | ||
|
||
const scrollTopBefore = await page.evaluate( | ||
() => | ||
window.wp.dom.getScrollContainer( document.activeElement ) | ||
.scrollTop | ||
); | ||
await pageUtils.pressKeys( 'alt+F10' ); | ||
await expect( | ||
page | ||
.getByRole( 'toolbar', { name: 'Block Tools' } ) | ||
.getByRole( 'button', { name: 'Paragraph' } ) | ||
).toBeFocused(); | ||
|
||
const scrollTopAfter = await page.evaluate( | ||
() => | ||
window.wp.dom.getScrollContainer( document.activeElement ) | ||
.scrollTop | ||
); | ||
|
||
expect( scrollTopBefore ).toBe( scrollTopAfter ); | ||
} ); | ||
} ); | ||
} ); |
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.
I'm not sure why yet, but when I run this test locally and watch it in the browser, it gets stuck in a cycle of pressing Enter over and over without moving on to the code after it.
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.
I think something got messed up during a copy/paste or search/replace. I copy/pasted the old test from
[navigable-toolbar.test](https://raw.githubusercontent.com/WordPress/gutenberg/6c0f4a50324b7f09b4c13c8ce2b974b1e2243bd1/packages/e2e-tests/specs/editor/various/navigable-toolbar.test.js)
and replaced theexpect( await isInBlockToolbar() ).toBe( true );
part, and the test passes.Could you try copy/pasting it again and see if it works for you?