-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate Navigable toolbar test to Playwright (#51514)
Removed tests related to the alt + 10 shortcut as they are covered elsewhere.
- Loading branch information
1 parent
a96091b
commit 1d9c4fa
Showing
2 changed files
with
48 additions
and
104 deletions.
There are no files selected for viewing
104 changes: 0 additions & 104 deletions
104
packages/e2e-tests/specs/editor/various/navigable-toolbar.test.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* 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 { activeElement } = | ||
document.activeElement?.contentDocument ?? document; | ||
const scrollable = | ||
window.wp.dom.getScrollContainer( activeElement ); | ||
return ! scrollable || scrollable.scrollTop === 0; | ||
} ) | ||
) { | ||
await page.keyboard.press( 'Enter' ); | ||
} | ||
|
||
await page.keyboard.type( 'a' ); | ||
|
||
const scrollTopBefore = await page.evaluate( () => { | ||
const { activeElement } = | ||
document.activeElement?.contentDocument ?? document; | ||
window.scrollContainer = | ||
window.wp.dom.getScrollContainer( activeElement ); | ||
return window.scrollContainer.scrollTop; | ||
} ); | ||
|
||
await pageUtils.pressKeys( 'alt+F10' ); | ||
await expect( | ||
page | ||
.getByRole( 'toolbar', { name: 'Block Tools' } ) | ||
.getByRole( 'button', { name: 'Paragraph' } ) | ||
).toBeFocused(); | ||
|
||
const scrollTopAfter = await page.evaluate( () => { | ||
return window.scrollContainer.scrollTop; | ||
} ); | ||
expect( scrollTopBefore ).toBe( scrollTopAfter ); | ||
} ); | ||
} ); | ||
} ); |
1d9c4fa
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.
Flaky tests detected in 1d9c4fa.
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/5291878028
📝 Reported issues:
/test/e2e/specs/editor/various/keep-styles-on-block-transforms.spec.js
/test/e2e/specs/editor/various/toolbar-roving-tabindex.spec.js
/test/e2e/specs/editor/blocks/navigation.spec.js