Improve the test to include checks for the blank form
[MAILPOET-5316]
This commit is contained in:
@@ -6,13 +6,16 @@ use MailPoet\Test\DataFactories\Segment;
|
|||||||
|
|
||||||
class EditorCreateBlankFormCest {
|
class EditorCreateBlankFormCest {
|
||||||
public function createBlankForm(\AcceptanceTester $i) {
|
public function createBlankForm(\AcceptanceTester $i) {
|
||||||
$i->wantTo('Create a blamk form');
|
$i->wantTo('Create a blank form');
|
||||||
|
|
||||||
$segmentFactory = new Segment();
|
$segmentFactory = new Segment();
|
||||||
$segmentName = 'Fancy List';
|
$segmentName = 'Fancy List';
|
||||||
$segmentFactory->withName($segmentName)->create();
|
$segmentFactory->withName($segmentName)->create();
|
||||||
|
|
||||||
$i->login();
|
$i->login();
|
||||||
|
|
||||||
$i->amOnMailPoetPage('Forms');
|
$i->amOnMailPoetPage('Forms');
|
||||||
|
|
||||||
// Create a new form
|
// Create a new form
|
||||||
$formName = 'My awesome form';
|
$formName = 'My awesome form';
|
||||||
$i->click('[data-automation-id="create_new_form"]');
|
$i->click('[data-automation-id="create_new_form"]');
|
||||||
@@ -20,9 +23,26 @@ class EditorCreateBlankFormCest {
|
|||||||
$i->click('[data-automation-id="create_blank_form"]');
|
$i->click('[data-automation-id="create_blank_form"]');
|
||||||
$i->waitForElement('[data-automation-id="form_title_input"]');
|
$i->waitForElement('[data-automation-id="form_title_input"]');
|
||||||
$i->fillField('[data-automation-id="form_title_input"]', $formName);
|
$i->fillField('[data-automation-id="form_title_input"]', $formName);
|
||||||
|
|
||||||
|
// Verify the elements of a blank form
|
||||||
|
$i->seeElement('[data-automation-id="editor_email_input"]');
|
||||||
|
$i->seeElement('[data-automation-id="editor_submit_input"]');
|
||||||
|
$i->dontSeeElement('[data-automation-id="editor_first_name_input"]');
|
||||||
|
$i->dontSeeElement('[data-automation-id="editor_divider_block"]');
|
||||||
|
$i->dontSeeElement('[data-automation-id="editor_spacer_block"]');
|
||||||
|
|
||||||
|
// Verify the form default toggles
|
||||||
|
$i->seeCheckboxIsChecked('.components-form-toggle__input');
|
||||||
|
$i->click('[data-automation-id="form_preview_button"]');
|
||||||
|
$i->waitForElementVisible('[data-automation-id="form_type_selection"]');
|
||||||
|
$i->seeOptionIsSelected('[data-automation-id="form_type_selection"]', 'Others (widget)');
|
||||||
|
$i->click('[data-automation-id="mailpoet-modal-close"]');
|
||||||
|
|
||||||
// Select list and save form
|
// Select list and save form
|
||||||
|
$i->waitForElementVisible('[data-automation-id="editor_submit_input"]');
|
||||||
$i->selectOptionInSelect2($segmentName);
|
$i->selectOptionInSelect2($segmentName);
|
||||||
$i->saveFormInEditor();
|
$i->saveFormInEditor();
|
||||||
|
|
||||||
// Reload page and check data were saved
|
// Reload page and check data were saved
|
||||||
$i->reloadPage();
|
$i->reloadPage();
|
||||||
$i->waitForElement('[data-automation-id="form_title_input"]');
|
$i->waitForElement('[data-automation-id="form_title_input"]');
|
||||||
|
Reference in New Issue
Block a user