diff --git a/assets/js/src/newsletter_editor/blocks/image.js b/assets/js/src/newsletter_editor/blocks/image.js index 978d877dd3..fdc0f4e3da 100644 --- a/assets/js/src/newsletter_editor/blocks/image.js +++ b/assets/js/src/newsletter_editor/blocks/image.js @@ -140,6 +140,7 @@ Module.ImageBlockSettingsView = base.BlockSettingsView.extend({ }); ImageWidgetView = base.WidgetView.extend({ + id: 'automation_editor_block_image', getTemplate: function () { return window.templates.imageInsertion; }, behaviors: { DraggableBehavior: { diff --git a/tests/_data/unicornsplaceholder.png b/tests/_data/unicornsplaceholder.png new file mode 100644 index 0000000000..eb6bead128 Binary files /dev/null and b/tests/_data/unicornsplaceholder.png differ diff --git a/tests/acceptance/EditorImageBlockCest.php b/tests/acceptance/EditorImageBlockCest.php new file mode 100644 index 0000000000..06eb868ca4 --- /dev/null +++ b/tests/acceptance/EditorImageBlockCest.php @@ -0,0 +1,34 @@ +wantTo('add image block to newsletter'); + $I->cli('media import /wp-core/wp-content/plugins/mailpoet/tests/_data/unicornsplaceholder.png --allow-root'); + $newsletterTitle = 'Image Block Newsletter'; + (new Newsletter()) + ->withSubject($newsletterTitle) + ->loadBodyFrom('newsletterWithText.json') + ->create(); + $I->login(); + $I->amOnMailpoetPage('Emails'); + $I->waitForText($newsletterTitle); + $I->clickItemRowActionByItemName($newsletterTitle, 'Edit'); + // Create image block + $I->waitForText('Image'); + $I->wait(1); // just to be sure + $I->dragAndDrop('#automation_editor_block_image', '#mce_0'); + $I->waitForText('Add images'); + $I->click('Media Library'); + $I->click('.thumbnail'); + $I->waitForElementClickable('.media-button-insert', 10); + $I->click('Select Image'); + $I->waitForText('IMAGE'); + $I->click('Done'); + } +} \ No newline at end of file