comparison core/modules/media/tests/src/FunctionalJavascript/MediaUiJavascriptTest.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children 129ea1e6d783
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
36 */ 36 */
37 protected function setUp() { 37 protected function setUp() {
38 parent::setUp(); 38 parent::setUp();
39 $this->drupalPlaceBlock('local_actions_block'); 39 $this->drupalPlaceBlock('local_actions_block');
40 $this->drupalPlaceBlock('local_tasks_block'); 40 $this->drupalPlaceBlock('local_tasks_block');
41
42 // We need to test without any default configuration in place.
43 // @TODO: Remove this as part of https://www.drupal.org/node/2883813.
44 MediaType::load('file')->delete();
45 MediaType::load('image')->delete();
46 } 41 }
47 42
48 /** 43 /**
49 * Tests a media type administration. 44 * Tests a media type administration.
50 */ 45 */
66 $this->assertJsCondition("jQuery('.machine-name-value').html() == '$machine_name'"); 61 $this->assertJsCondition("jQuery('.machine-name-value').html() == '$machine_name'");
67 $page->selectFieldOption('source', 'test'); 62 $page->selectFieldOption('source', 'test');
68 $this->assertJsCondition("jQuery('.form-item-source-configuration-test-config-value').length > 0;"); 63 $this->assertJsCondition("jQuery('.form-item-source-configuration-test-config-value').length > 0;");
69 $page->fillField('description', $description); 64 $page->fillField('description', $description);
70 $page->pressButton('Save'); 65 $page->pressButton('Save');
66 // The wait prevents intermittent test failures.
67 $result = $assert_session->waitForLink('Add media type');
68 $this->assertNotEmpty($result);
69 $assert_session->addressEquals('admin/structure/media');
71 $assert_session->pageTextContains('The media type ' . $name . ' has been added.'); 70 $assert_session->pageTextContains('The media type ' . $name . ' has been added.');
72 $this->drupalGet('admin/structure/media'); 71 $this->drupalGet('admin/structure/media');
73 $assert_session->pageTextContains($name); 72 $assert_session->pageTextContains($name);
74 $assert_session->pageTextContains($description); 73 $assert_session->pageTextContains($description);
75 74
137 $page->selectFieldOption('field_map[attribute_1]', 'name'); 136 $page->selectFieldOption('field_map[attribute_1]', 'name');
138 $page->checkField('options[new_revision]'); 137 $page->checkField('options[new_revision]');
139 $page->uncheckField('options[status]'); 138 $page->uncheckField('options[status]');
140 $page->checkField('options[queue_thumbnail_downloads]'); 139 $page->checkField('options[queue_thumbnail_downloads]');
141 $page->pressButton('Save'); 140 $page->pressButton('Save');
141 // The wait prevents intermittent test failures.
142 $result = $assert_session->waitForLink('Add media type');
143 $this->assertNotEmpty($result);
144 $assert_session->addressEquals('admin/structure/media');
142 $assert_session->pageTextContains("The media type $new_name has been updated."); 145 $assert_session->pageTextContains("The media type $new_name has been updated.");
143 146
144 // Test if edit worked and if new field values have been saved as expected. 147 // Test if edit worked and if new field values have been saved as expected.
145 $this->drupalGet('admin/structure/media/manage/' . $this->testMediaType->id()); 148 $this->drupalGet('admin/structure/media/manage/' . $this->testMediaType->id());
146 $assert_session->fieldValueEquals('label', $new_name); 149 $assert_session->fieldValueEquals('label', $new_name);