Skip to content

Commit

Permalink
Fix remaining test issues
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed May 5, 2022
1 parent 40365bf commit ff79eb5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions test/e2e/specs/editor/various/copy-cut-paste.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ test.describe( 'Copy/cut/paste', () => {
await editor.insertBlock( { name: 'core/spacer' } );
// At this point the spacer wrapper should be focused.
await pageUtils.pressKeyWithModifier( 'primary', 'x' );
expect( await pageUtils.getEditedPostContent() ).toBe( '' );
expect( await editor.getEditedPostContent() ).toBe( '' );

// The block appender is only visible when there's no selection.
await page.evaluate( () => {
Expand Down Expand Up @@ -211,7 +211,7 @@ test.describe( 'Copy/cut/paste', () => {
expect( await editor.getEditedPostContent() ).toBe( '' );

// Insert a non textual element (a spacer)
await pageUtils.insertBlock( { name: 'core/spacer' } );
await editor.insertBlock( { name: 'core/spacer' } );
// Spacer is focused.
await page.evaluate( () => {
window.e2eTestPasteOnce = [];
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/specs/editor/various/style-variation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ test.use( {

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

// Inserting a quote block
await pageUtils.insertBlock( {
await editor.insertBlock( {
name: 'core/quote',
attributes: { value: '<p>Quote content</p>' },
} );
Expand All @@ -32,7 +32,7 @@ test.describe( 'adding blocks', () => {
await page.click( 'role=menuitem[name="Plain"i]' );

// Check the content
const content = await pageUtils.getEditedPostContent();
const content = await editor.getEditedPostContent();
expect( content ).toBe(
`<!-- wp:quote {"className":"is-style-plain"} -->
<blockquote class="wp-block-quote is-style-plain"><p>Quote content</p></blockquote>
Expand Down
11 changes: 7 additions & 4 deletions test/e2e/specs/widgets/customizing-widgets.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
const {
test,
expect,
Admin,
Editor,
} = require( '@wordpress/e2e-test-utils-playwright' );

Expand All @@ -18,8 +19,8 @@ test.use( {
editor: async ( { page }, use ) => {
await use( new Editor( { page } ) );
},
widgetsCustomizerPage: async ( { page, pageUtils }, use ) => {
await use( new WidgetsCustomizerPage( { page, pageUtils } ) );
widgetsCustomizerPage: async ( { admin, page, pageUtils }, use ) => {
await use( new WidgetsCustomizerPage( { admin, page, pageUtils } ) );
},
} );

Expand Down Expand Up @@ -577,10 +578,12 @@ test.describe( 'Widgets Customizer', () => {
class WidgetsCustomizerPage {
/**
* @param {Object} config
* @param {Admin} config.admin
* @param {Page} config.page
* @param {PageUtils} config.pageUtils
*/
constructor( { page, pageUtils } ) {
constructor( { admin, page, pageUtils } ) {
this.admin = admin;
this.page = page;
this.pageUtils = pageUtils;

Expand All @@ -593,7 +596,7 @@ class WidgetsCustomizerPage {
}

async visitCustomizerPage() {
await this.pageUtils.visitAdminPage( 'customize.php' );
await this.admin.visitAdminPage( 'customize.php' );

// Disable welcome guide.
await this.page.evaluate( () => {
Expand Down

0 comments on commit ff79eb5

Please sign in to comment.