Skip to content
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

Testing: Update end-to-end tests to use Escape press to activate block toolbar #15063

Merged
merged 1 commit into from
Apr 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/e2e-tests/specs/block-deletion.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ describe( 'block deletion -', () => {
// The blocks can't be empty to trigger the toolbar
await page.keyboard.type( 'Paragraph to remove' );

// Move the mouse to show the block toolbar
await page.mouse.move( 200, 300, { steps: 10 } );
Copy link
Contributor

Choose a reason for hiding this comment

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

Last time I tried this change, the mouse moving was still more reliable but I don't remember the details, maybe it's better this time :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Last time I tried this change, the mouse moving was still more reliable but I don't remember the details, maybe it's better this time :)

I can't imagine why that would be 🤷‍♂️ The tests are passing here at least. Let me know if you can find a reference to the issues you'd seen previously.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't remember precisely and I agree it's better using the keyboard shortcuts. The intent is clearer.

// Press Escape to show the block toolbar
await page.keyboard.press( 'Escape' );

await clickOnBlockSettingsMenuItem( 'Remove Block' );
expect( await getEditedPostContent() ).toMatchSnapshot();
Expand Down
16 changes: 8 additions & 8 deletions packages/e2e-tests/specs/editor-modes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ describe( 'Editing modes (visual/HTML)', () => {
let visualBlock = await page.$$( '.block-editor-block-list__layout .block-editor-block-list__block .block-editor-rich-text' );
expect( visualBlock ).toHaveLength( 1 );

// Move the mouse to show the block toolbar
await page.mouse.move( 200, 300, { steps: 10 } );
// Press Escape to show the block toolbar
await page.keyboard.press( 'Escape' );

// Change editing mode from "Visual" to "HTML".
await page.waitForSelector( 'button[aria-label="More options"]' );
Expand All @@ -32,8 +32,8 @@ describe( 'Editing modes (visual/HTML)', () => {
const htmlBlock = await page.$$( '.block-editor-block-list__layout .block-editor-block-list__block .block-editor-block-list__block-html-textarea' );
expect( htmlBlock ).toHaveLength( 1 );

// Move the mouse to show the block toolbar
await page.mouse.move( 200, 300, { steps: 10 } );
// Press Escape to show the block toolbar
await page.keyboard.press( 'Escape' );

// Change editing mode from "HTML" back to "Visual".
await page.waitForSelector( 'button[aria-label="More options"]' );
Expand All @@ -47,8 +47,8 @@ describe( 'Editing modes (visual/HTML)', () => {
} );

it( 'should display sidebar in HTML mode', async () => {
// Move the mouse to show the block toolbar
await page.mouse.move( 200, 300, { steps: 10 } );
// Press Escape to show the block toolbar
await page.keyboard.press( 'Escape' );

// Change editing mode from "Visual" to "HTML".
await page.waitForSelector( 'button[aria-label="More options"]' );
Expand All @@ -63,8 +63,8 @@ describe( 'Editing modes (visual/HTML)', () => {
} );

it( 'should update HTML in HTML mode when sidebar is used', async () => {
// Move the mouse to show the block toolbar
await page.mouse.move( 200, 300, { steps: 10 } );
// Press Escape to show the block toolbar
await page.keyboard.press( 'Escape' );

// Change editing mode from "Visual" to "HTML".
await page.waitForSelector( 'button[aria-label="More options"]' );
Expand Down