Tests paragraph types.
public function testParagraphTypes() {
$this
->addParagraphedContentType('paragraphed_test');
$this
->loginAsAdmin([
'create paragraphed_test content',
'edit any paragraphed_test content',
'administer paragraphs library',
]);
$this
->drupalGet('/node/add/paragraphed_test');
$this
->submitForm([], 'field_paragraphs_image_add_more');
$this
->submitForm([], 'field_paragraphs_image_text_add_more');
$image = current($this
->getTestFiles('image'));
$file_system = \Drupal::service('file_system');
$edit = [
'title[0][value]' => 'Paragraph types example',
'files[field_paragraphs_0_subform_paragraphs_image_0]' => $file_system
->realpath($image->uri),
'field_paragraphs[1][subform][paragraphs_text][0][value]' => 'Text test with image',
'files[field_paragraphs_1_subform_paragraphs_image_0]' => $file_system
->realpath($image->uri),
];
$this
->submitForm($edit, 'Save');
// Asserts the text and image type.
$this
->assertSession()
->pageTextContains('Text test with image');
$this
->assertSession()
->responseContains($image->filename);
}