public function UiPatternsFieldGroupSettingsTest::testWarningMessage in UI Patterns 8
Make sure a warning message is displayed when using pattern formatter.
File
- modules/
ui_patterns_field_group/ tests/ src/ FunctionalJavascript/ UiPatternsFieldGroupSettingsTest.php, line 47
Class
- UiPatternsFieldGroupSettingsTest
- Test Field Group pattern settings.
Namespace
Drupal\Tests\ui_patterns_field_group\FunctionalJavascriptCode
public function testWarningMessage() {
$page = $this
->getSession()
->getPage();
$assert_session = $this
->assertSession();
$user = $this
->drupalCreateUser([], NULL, TRUE);
$this
->drupalLogin($user);
// Visit Article's field group creation page.
$this
->drupalGet('/admin/structure/types/manage/article/display/add-group');
// Add new Pattern field group.
$page
->selectFieldOption('Add a new group', 'Pattern');
$assert_session
->assertWaitOnAjaxRequest();
// Select pattern and save.
$page
->fillField('Label', 'Metadata');
$page
->waitFor(10, function (DocumentElement $page) {
return $page
->hasContent('Machine name: group_metadata');
});
$page
->pressButton('Save and continue');
// Assert warning message.
$assert_session
->pageTextContains("Attention: you have to add fields to this field group and save the whole entity display before being able to to access the pattern display configuration.");
}