Add acceptance test for basic form editing
[MAILPOET-2455]
This commit is contained in:
committed by
Jack Kitterhing
parent
ab7a4babea
commit
a1ac7cb4fd
@@ -25,6 +25,7 @@ export default () => {
|
|||||||
id="form-title"
|
id="form-title"
|
||||||
className="editor-post-title__input"
|
className="editor-post-title__input"
|
||||||
placeholder={MailPoet.I18n.t('addFormName')}
|
placeholder={MailPoet.I18n.t('addFormName')}
|
||||||
|
data-automation-id="form_title_input"
|
||||||
rows="1"
|
rows="1"
|
||||||
onFocus={() => setIsSelected(true)}
|
onFocus={() => setIsSelected(true)}
|
||||||
onKeyPress={() => setIsSelected(false)}
|
onKeyPress={() => setIsSelected(false)}
|
||||||
|
@@ -24,6 +24,7 @@ export default () => {
|
|||||||
isLarge
|
isLarge
|
||||||
isDefault
|
isDefault
|
||||||
className="editor-post-publish-button"
|
className="editor-post-publish-button"
|
||||||
|
data-automation-id="form_save_button"
|
||||||
isBusy={isFormSaving}
|
isBusy={isFormSaving}
|
||||||
onClick={saveForm}
|
onClick={saveForm}
|
||||||
>
|
>
|
||||||
|
@@ -22,7 +22,7 @@ export default () => {
|
|||||||
/>
|
/>
|
||||||
<NoticeList
|
<NoticeList
|
||||||
notices={dismissibleNotices}
|
notices={dismissibleNotices}
|
||||||
className="components-editor-notices__dismissible"
|
className="components-editor-notices__dismissible automation-dismissible-notices"
|
||||||
onRemove={removeNotice}
|
onRemove={removeNotice}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
|
@@ -125,6 +125,18 @@ class AcceptanceTester extends \Codeception\Actor { // phpcs:ignore PSR1.Classes
|
|||||||
$I->pressKey($element, \WebDriverKeys::ENTER);
|
$I->pressKey($element, \WebDriverKeys::ENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check selected value in select2..
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
* @param string $element
|
||||||
|
*/
|
||||||
|
public function seeSelectedInSelect2($value, $element = '.select2-container') {
|
||||||
|
$I = $this;
|
||||||
|
$I->waitForElement($element);
|
||||||
|
$I->see($value, $element);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Navigate to the editor for a newsletter.
|
* Navigate to the editor for a newsletter.
|
||||||
*
|
*
|
||||||
|
40
tests/acceptance/FormEditorUpdateNewFormCest.php
Normal file
40
tests/acceptance/FormEditorUpdateNewFormCest.php
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace MailPoet\Test\Acceptance;
|
||||||
|
|
||||||
|
use MailPoet\Features\FeaturesController;
|
||||||
|
use MailPoet\Test\DataFactories\Features;
|
||||||
|
use MailPoet\Test\DataFactories\Segment;
|
||||||
|
|
||||||
|
class FormEditorUpdateNewFormCest {
|
||||||
|
function updateNewForm(\AcceptanceTester $I) {
|
||||||
|
$segment_factory = new Segment();
|
||||||
|
$segment_name = 'Fancy List';
|
||||||
|
$segment_factory->withName($segment_name)->create();
|
||||||
|
$features = new Features();
|
||||||
|
$features->withFeatureEnabled(FeaturesController::NEW_FORM_EDITOR);
|
||||||
|
$I->wantTo('Create and update form');
|
||||||
|
$I->login();
|
||||||
|
$I->amOnMailPoetPage('Forms');
|
||||||
|
// Create a new form
|
||||||
|
$form_name = 'My awesome form';
|
||||||
|
$I->click('[data-automation-id="create_new_form"]');
|
||||||
|
$I->waitForElement('[data-automation-id="form_title_input"]');
|
||||||
|
$I->fillField('[data-automation-id="form_title_input"]', $form_name);
|
||||||
|
// Try saving form without selected list
|
||||||
|
$I->click('[data-automation-id="form_save_button"]');
|
||||||
|
$I->waitForText('Please select a list', 10, '.automation-dismissible-notices');
|
||||||
|
$I->seeNoJSErrors();
|
||||||
|
// Select list and save form
|
||||||
|
$I->selectOptionInSelect2($segment_name);
|
||||||
|
$I->click('[data-automation-id="form_save_button"]');
|
||||||
|
$I->waitForText('Form saved', 10, '.automation-dismissible-notices');
|
||||||
|
$I->seeNoJSErrors();
|
||||||
|
// Reload page and check data were saved
|
||||||
|
$I->reloadPage();
|
||||||
|
$I->waitForElement('[data-automation-id="form_title_input"]');
|
||||||
|
$I->see($form_name, '[data-automation-id="form_title_input"]');
|
||||||
|
$I->seeSelectedInSelect2($segment_name);
|
||||||
|
$I->seeNoJSErrors();
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user