withName($segmentName)->create(); $formName = 'My fancy form'; $form = new Form(); $form->withName($formName)->withSegments([$segment])->create(); $i->wantTo('Add first name to the editor and preview form without saving it'); $i->login(); $i->amOnMailPoetPage('Forms'); $i->waitForText($formName); $i->clickItemRowActionByItemName($formName, 'Edit'); $i->waitForElement('[data-automation-id="form_title_input"]'); $i->addFromBlockInEditor('First name'); // Open preview $i->click('[data-automation-id="form_preview_button"]'); $i->waitForElement('[data-automation-id="form_preview_iframe"]'); // Check first name was rendered in iframe $i->switchToIFrame('[data-automation-id="form_preview_iframe"]'); $i->waitForElement('[data-automation-id="form_first_name"]'); $i->switchToIFrame(); // Change preview type and form type and check again $i->click('[data-automation-id="preview_type_mobile"]'); $i->selectOption('[data-automation-id="form_type_selection"]', 'Fixed bar'); $i->switchToIFrame('[data-automation-id="form_preview_iframe"]'); $i->waitForElement('[data-automation-id="form_first_name"]'); $i->switchToIFrame(); // Reload page and check preview settings $i->reloadPage(); $i->acceptPopup(); $i->waitForElement('[data-automation-id="form_preview_button"]'); $i->click('[data-automation-id="form_preview_button"]'); $i->waitForElement('[data-automation-id="form_preview_iframe"]'); $i->seeOptionIsSelected('[data-automation-id="form_type_selection"]', 'Fixed bar'); $i->seeOptionIsSelected('[data-automation-id="form_type_selection"]', 'Fixed bar'); } }