Skip to content

Commit

Permalink
Fix embed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed May 6, 2024
1 parent de9e5c6 commit 4d43223
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions test/e2e/specs/editor/various/embedding.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ const MOCK_BAD_WORDPRESS_RESPONSE = {
};

test.use( {
embedUtils: async ( { page, editor }, use ) => {
await use( new EmbedUtils( { page, editor } ) );
embedUtils: async ( { page, editor, pageUtils }, use ) => {
await use( new EmbedUtils( { page, editor, pageUtils } ) );
},
} );

Expand Down Expand Up @@ -263,10 +263,12 @@ class EmbedUtils {
#page;
/** @type {Editor} */
#editor;
#pageUtils;

constructor( { page, editor } ) {
constructor( { page, editor, pageUtils } ) {
this.#page = page;
this.#editor = editor;
this.#pageUtils = pageUtils;
}

/**
Expand Down Expand Up @@ -301,10 +303,10 @@ class EmbedUtils {
async insertEmbed( url ) {
await test.step( `Inserting embed ${ url }`, async () => {
await this.#editor.insertBlock( { name: 'core/embed' } );
await this.#editor.canvas
.getByRole( 'textbox', { name: 'Embed URL' } )
.last()
.fill( url );
// Do not use `fill` here, it's not how the user interacts with the
// block.
this.#pageUtils.setClipboardData( { plainText: url } );
await this.#pageUtils.pressKeys( 'primary+v' );
await this.#page.keyboard.press( 'Enter' );
} );
}
Expand Down

0 comments on commit 4d43223

Please sign in to comment.