public function EntityReferenceActionsTest::testMediaEditInArticle in Thunder 6.1.x
Same name and namespace in other branches
- 8.5 tests/src/FunctionalJavascript/Integration/EntityReferenceActionsTest.php \Drupal\Tests\thunder\FunctionalJavascript\Integration\EntityReferenceActionsTest::testMediaEditInArticle()
- 6.2.x tests/src/FunctionalJavascript/Integration/EntityReferenceActionsTest.php \Drupal\Tests\thunder\FunctionalJavascript\Integration\EntityReferenceActionsTest::testMediaEditInArticle()
Test editing of media items in an embedded gallery.
File
- tests/
src/ FunctionalJavascript/ Integration/ EntityReferenceActionsTest.php, line 25
Class
- EntityReferenceActionsTest
- Tests integration with the entity_reference_actions and views_bulk_edit.
Namespace
Drupal\Tests\thunder\FunctionalJavascript\IntegrationCode
public function testMediaEditInArticle() {
$node = $this
->loadNodeByUuid('36b2e2b2-3df0-43eb-a282-d792b0999c07');
$this
->drupalGet($node
->toUrl('edit-form'));
$page = $this
->getSession()
->getPage();
$this
->editParagraph($page, 'field_paragraphs', 0);
// Wait for all images to be displayed properly.
$this
->getSession()
->wait(10000, "jQuery('[data-drupal-selector=\"edit-field-paragraphs-0-subform-field-media-0-inline-entity-form-field-media-images-current\"] .media-form__item-widget--image').filter(function() {return jQuery(this).width() === 182;}).length === 5");
$this
->scrollElementInView('#field_media_images_media_edit_action_button');
$this
->getSession()
->getPage()
->pressButton('Edit all media items');
$this
->assertSession()
->assertWaitOnAjaxRequest();
$this
->getSession()
->getPage()
->checkField('media[image][_field_selector][field_copyright]');
$this
->getSession()
->getPage()
->fillField('media[image][field_copyright][0][value]', 'Test copyright');
$this
->assertSession()
->elementExists('css', '.ui-dialog-buttonpane')
->pressButton('Confirm');
$this
->assertSession()
->assertWaitOnAjaxRequest();
$this
->assertSession()
->pageTextContains('Action was successfully applied');
for ($i = 0; $i < 4; $i++) {
$this
->clickAjaxButtonCssSelector('[data-drupal-selector="edit-field-paragraphs-0-subform-field-media-0-inline-entity-form-field-media-images-current-items-' . $i . '-edit-button"]');
$this
->assertSession()
->assertWaitOnAjaxRequest();
$this
->assertSession()
->fieldValueEquals('field_copyright[0][value]', 'Test copyright');
$this
->assertSession()
->elementExists('css', '.ui-dialog-buttonpane')
->pressButton('Save');
}
}