$this->
assertSession()->
elementNotExists('css', '.layout--twocol'
);
$this->
assertSession()->
elementNotExists('css', '.layout__region'
);
$this->
assertSession()->
pageTextNotContains('The field test text value'
);
// After a refresh the new regions are still there.
$this->
drupalGet('entity_test/structure/entity_test/display'
);
$this->
assertEquals(['Top', 'First', 'Second', 'Bottom', 'Disabled'
],
$this->
getRegionTitles());
$this->
assertSession()->
waitForElement('css', '.tabledrag-handle'
);
$id =
$this->
getSession()->
getPage()->
find('css', '[name="form_build_id"]'
)->
getValue();
// Drag the field to the first region.
$this->
assertTrue($this->
assertSession()->
optionExists('fields[field_test_text][region]', 'hidden'
)->
isSelected());
$field_test_text_row =
$this->
getSession()->
getPage()->
find('css', '#field-test-text'
);
$first_region_row =
$this->
getSession()->
getPage()->
find('css', '.region-first-message'
);
$field_test_text_row->
find('css', '.handle'
)->
dragTo($first_region_row);
$this->
assertSession()->
assertWaitOnAjaxRequest();
$this->
assertFalse($this->
assertSession()->
optionExists('fields[field_test_text][region]', 'hidden'
)->
isSelected());
$this->
assertSession()->
waitForElement('css', "[name='form_build_id']:not([value='
$id'])"
);
$this->
submitForm([], 'Save'
);
$this->
assertSession()->
pageTextContains('Your settings have been saved.'
);
// The new layout is used.
$this->
drupalGet('entity_test/1'
);