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

Migrate style variation test to Playwright #40216

Merged
merged 8 commits into from
Apr 11, 2022
Merged
Show file tree
Hide file tree
Changes from 7 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
36 changes: 0 additions & 36 deletions packages/e2e-tests/specs/editor/various/style-variation.test.js

This file was deleted.

32 changes: 32 additions & 0 deletions test/e2e/specs/editor/various/style-variation.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* WordPress dependencies
*/
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );

test.describe( 'adding blocks', () => {
test( 'Should switch to the plain style of the quote block', async ( {
page,
pageUtils,
} ) => {
await pageUtils.createNewPost();

// Inserting a quote block

JustinyAhin marked this conversation as resolved.
Show resolved Hide resolved
await pageUtils.insertBlock( {
Copy link
Member

@oandregal oandregal Apr 20, 2022

Choose a reason for hiding this comment

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

Hey, as far as I understand, this PR changed the original test behaviour. Previously, we:

  1. added a block
  2. typed some content

These steps covered the case for which we wanted to make sure that users could type right after the block was inserted.

The playwright test does this instead:

  1. adds a block with the contents we want

It doesn't look like we're testing for typing. Sorry, I'm not very familiar with playwright, but shouldn't we respect the existing behavior when migrating tests? @JustinyAhin @kevin940726

Copy link
Member

Choose a reason for hiding this comment

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

name: 'core/quote',
attributes: { value: '<p>Quote content</p>' },
} );

await pageUtils.clickBlockToolbarButton( 'Quote' );

await page.click( 'role=menuitem[name="Plain"i]' );

// Check the content
const content = await pageUtils.getEditedPostContent();
expect( content ).toBe(
`<!-- wp:quote {"className":"is-style-plain"} -->
<blockquote class="wp-block-quote is-style-plain"><p>Quote content</p></blockquote>
<!-- /wp:quote -->`
);
} );
} );