Add acceptance test for undo/redo

[MAILPOET-1976]
This commit is contained in:
Ján Mikláš
2019-06-18 14:19:34 +02:00
committed by M. Shull
parent 4f1f236bce
commit 66800ae994
2 changed files with 45 additions and 0 deletions

View File

@@ -117,6 +117,7 @@ Module.ButtonBlockSettingsView = base.BlockSettingsView.extend({
});
Module.ButtonWidgetView = base.WidgetView.extend({
id: 'automation_editor_block_button',
getTemplate: function () { return window.templates.buttonInsertion; },
behaviors: {
DraggableBehavior: {

View File

@@ -0,0 +1,44 @@
<?php
namespace MailPoet\Test\Acceptance;
use MailPoet\Test\DataFactories\Newsletter;
require_once __DIR__ . '/../DataFactories/Newsletter.php';
class EditorHistoryCest {
const BUTTON_SELECTOR = '.mailpoet_button_block';
function undoRedo(\AcceptanceTester $I) {
$I->wantTo('Undo and redo');
$newsletter = (new Newsletter())
->loadBodyFrom('newsletterWithText.json')
->withSubject('Undo redo test')
->create();
$I->login();
$I->amEditingNewsletter($newsletter->id);
$I->dragAndDrop('#automation_editor_block_button', '#mce_0');
$I->waitForElementVisible(self::BUTTON_SELECTOR);
$I->waitForText('Autosaved');
// Mouse undo
$I->click('#mailpoet-history-arrow-undo');
$I->waitForElementNotVisible(self::BUTTON_SELECTOR);
// Mouse redo
$I->click('#mailpoet-history-arrow-redo');
$I->waitForElementVisible(self::BUTTON_SELECTOR);
// Keyboard undo
$I->pressKey('body', [\WebDriverKeys::CONTROL, 'z']);
$I->waitForElementNotVisible(self::BUTTON_SELECTOR);
// Keyboard redo
$I->pressKey('body', [\WebDriverKeys::SHIFT, \WebDriverKeys::CONTROL, 'z']);
$I->waitForElementVisible(self::BUTTON_SELECTOR);
}
}