diff --git a/core/drupalci.yml b/core/drupalci.yml index cd92d8102d7..106e27b1748 100644 --- a/core/drupalci.yml +++ b/core/drupalci.yml @@ -3,49 +3,15 @@ # https://www.drupal.org/drupalorg/docs/drupal-ci/customizing-drupalci-testing _phpunit_testgroups_to_execute: &testgroups # Default: all of Drupal core's test suite runs. - testgroups: '--all' + #testgroups: '--all' # Alternative: run only the tests for one particular module. - # testgroups: '--module ckeditor5' + testgroups: '--repeat 50 --class "\Drupal\Tests\media\FunctionalJavascript\MediaStandardProfileTest"' build: assessment: testing: - # Run code quality checks. - container_command.commit-checks: - commands: - - "core/scripts/dev/commit-code-check.sh --drupalci" - halt-on-fail: true - # run_tests task is executed several times in order of performance speeds. - # halt-on-fail can be set on the run_tests tasks in order to fail fast. - # suppress-deprecations is false in order to be alerted to usages of - # deprecated code. - run_tests.phpunit: - types: 'PHPUnit-Unit' - suppress-deprecations: false - halt-on-fail: false - <<: *testgroups - run_tests.kernel: - types: 'PHPUnit-Kernel' - suppress-deprecations: false - halt-on-fail: false - <<: *testgroups - run_tests.build: - # Limit concurrency due to disk space concerns. - concurrency: 15 - types: 'PHPUnit-Build' - suppress-deprecations: false - halt-on-fail: false - <<: *testgroups - run_tests.functional: - types: 'PHPUnit-Functional' - suppress-deprecations: false - halt-on-fail: false - <<: *testgroups run_tests.javascript: concurrency: 15 types: 'PHPUnit-FunctionalJavascript' suppress-deprecations: false halt-on-fail: false <<: *testgroups - # Run nightwatch testing. - # @see https://www.drupal.org/project/drupal/issues/2869825 - nightwatchjs: {} diff --git a/core/modules/media/src/Plugin/Validation/Constraint/OEmbedResourceConstraintValidator.php b/core/modules/media/src/Plugin/Validation/Constraint/OEmbedResourceConstraintValidator.php index e39b2055cc7..d6436e1e468 100644 --- a/core/modules/media/src/Plugin/Validation/Constraint/OEmbedResourceConstraintValidator.php +++ b/core/modules/media/src/Plugin/Validation/Constraint/OEmbedResourceConstraintValidator.php @@ -134,6 +134,7 @@ protected function handleException(\Exception $e, $error_message = NULL) { $this->context->addViolation($error_message); } + $messages = []; // The oEmbed system makes heavy use of exception wrapping, so log the // entire exception chain to help with troubleshooting. do { @@ -141,8 +142,10 @@ protected function handleException(\Exception $e, $error_message = NULL) { // debugging information contained in those exceptions in // https://www.drupal.org/project/drupal/issues/2972846. $this->logger->error($e->getMessage()); + $messages[] = $e->getMessage(); $e = $e->getPrevious(); } while ($e); + throw new \Exception(implode("\n", $messages)); } } diff --git a/core/modules/media/tests/src/FunctionalJavascript/MediaStandardProfileTest.php b/core/modules/media/tests/src/FunctionalJavascript/MediaStandardProfileTest.php index 17bf826a1c3..742f484e38c 100644 --- a/core/modules/media/tests/src/FunctionalJavascript/MediaStandardProfileTest.php +++ b/core/modules/media/tests/src/FunctionalJavascript/MediaStandardProfileTest.php @@ -88,11 +88,11 @@ public function testMediaSources() { ], ])->save(); - $this->audioTest(); - $this->documentTest(); - $this->imageTest(); + // $this->audioTest(); + // $this->documentTest(); + // $this->imageTest(); $this->remoteVideoTest(); - $this->videoTest(); + // $this->videoTest(); } /** @@ -123,6 +123,9 @@ protected function audioTest() { $result = $assert_session->waitForButton('Remove'); $this->assertNotEmpty($result); $page->pressButton('Save'); + $this->assertSession()->waitForText("Audio $test_filename has been created."); + $this->assertSession()->pageTextContains("Audio $test_filename has been created."); + $audio_media_id = $this->container ->get('entity_type.manager') ->getStorage('media') @@ -171,6 +174,8 @@ protected function audioTest() { $result = $assert_session->waitForButton('Remove'); $this->assertNotEmpty($result); $page->pressButton('Save'); + $this->assertSession()->waitForText("Audio $test_filename_updated has been updated."); + $this->assertSession()->pageTextContains("Audio $test_filename_updated has been updated."); $this->drupalGet('/node/' . $node->id()); @@ -211,6 +216,8 @@ protected function imageTest() { $this->assertNotEmpty($result); $page->fillField("{$source_field_id}[0][alt]", 'Image Alt Text 1'); $page->pressButton('Save'); + $this->assertSession()->waitForText("Image $image_media_name has been created."); + $this->assertSession()->pageTextContains("Image $image_media_name has been created."); $image_media_id = $this->container ->get('entity_type.manager') ->getStorage('media') @@ -265,6 +272,8 @@ protected function imageTest() { $this->assertNotEmpty($result); $page->fillField("{$source_field_id}[0][alt]", 'Image Alt Text 2'); $page->pressButton('Save'); + $this->assertSession()->waitForText("Image $image_media_name_updated has been updated."); + $this->assertSession()->pageTextContains("Image $image_media_name_updated has been updated."); $this->drupalGet('/node/' . $node->id()); @@ -314,6 +323,9 @@ protected function documentTest() { $result = $assert_session->waitForButton('Remove'); $this->assertNotEmpty($result); $page->pressButton('Save'); + $this->assertSession()->waitForText("Document $test_filename has been created."); + $this->assertSession()->pageTextContains("Document $test_filename has been created."); + $file_media_id = $this->container ->get('entity_type.manager') ->getStorage('media') @@ -359,6 +371,8 @@ protected function documentTest() { $result = $assert_session->waitForButton('Remove'); $this->assertNotEmpty($result); $page->pressButton('Save'); + $this->assertSession()->waitForText("Document $test_filename_updated has been updated."); + $this->assertSession()->pageTextContains("Document $test_filename_updated has been updated."); $this->drupalGet('/node/' . $node->id()); @@ -402,6 +416,9 @@ protected function remoteVideoTest() { // Create a media item. $page->fillField("{$source_field_id}[0][value]", $video_url); $page->pressButton('Save'); + $this->assertSession()->waitForText("Remote video $video_title has been created."); + $this->assertSession()->pageTextContains("Remote video $video_title has been created."); + $remote_video_media_id = $this->container ->get('entity_type.manager') ->getStorage('media') @@ -448,6 +465,8 @@ protected function remoteVideoTest() { $this->drupalGet('media/' . $remote_video_media_id . '/edit'); $page->fillField("{$source_field_id}[0][value]", $video_url_updated); $page->pressButton('Save'); + $this->assertSession()->waitForText("Remote video $video_title_updated has been updated."); + $this->assertSession()->pageTextContains("Remote video $video_title_updated has been updated."); $this->drupalGet('/node/' . $node->id()); @@ -499,6 +518,9 @@ protected function videoTest() { $result = $assert_session->waitForButton('Remove'); $this->assertNotEmpty($result); $page->pressButton('Save'); + $this->assertSession()->waitForText("Video $test_filename has been created."); + $this->assertSession()->pageTextContains("Video $test_filename has been created."); + $video_media_id = $this->container ->get('entity_type.manager') ->getStorage('media') @@ -547,6 +569,8 @@ protected function videoTest() { $result = $assert_session->waitForButton('Remove'); $this->assertNotEmpty($result); $page->pressButton('Save'); + $this->assertSession()->waitForText("Video $test_filename_updated has been updated."); + $this->assertSession()->pageTextContains("Video $test_filename_updated has been updated."); $this->drupalGet('/node/' . $node->id()); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php b/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php index 8348b76f280..fd276b7d4ff 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php @@ -96,6 +96,10 @@ protected function tearDown(): void { if ($status === BaseTestRunner::STATUS_ERROR || $status === BaseTestRunner::STATUS_WARNING || $status === BaseTestRunner::STATUS_FAILURE) { // Ensure we capture the output at point of failure. @$this->htmlOutput(); + $this->getSession()->resizeWindow(1024, 2048); + $image_filename = $this->htmlOutputClassName . '-ERROR-' . $this->htmlOutputCounter . '-' . $this->htmlOutputTestId . '.jpg'; + $this->createScreenshot($this->htmlOutputDirectory . '/' . $image_filename); + $this->getSession()->resizeWindow(1024, 768); } // Wait for all requests to finish. It is possible that an AJAX request is // still on-going.