diff --git a/modules/video_embed_wysiwyg/tests/src/Functional/TextFormatConfigurationTest.php b/modules/video_embed_wysiwyg/tests/src/Functional/TextFormatConfigurationTest.php
index 35f9a26..ff42d4a 100644
--- a/modules/video_embed_wysiwyg/tests/src/Functional/TextFormatConfigurationTest.php
+++ b/modules/video_embed_wysiwyg/tests/src/Functional/TextFormatConfigurationTest.php
@@ -28,13 +28,20 @@ class TextFormatConfigurationTest extends BrowserTestBase {
   ];
 
   /**
+   * The URL for the filter format.
+   *
+   * @var string
+   */
+  protected $formatUrl = 'admin/config/content/formats/manage/plain_text';
+
+  /**
    * {@inheritdoc}
    */
   protected function setUp() {
     parent::setUp();
 
     $this->drupalLogin($this->createAdminUser());
-    $this->drupalGet('admin/config/content/formats/manage/plain_text');
+    $this->drupalGet($this->formatUrl);
 
     // Setup the filter to have an editor.
     $this->getSession()->getPage()->find('css', '[name="editor[editor]"]')->setValue('ckeditor');
@@ -47,21 +54,21 @@ class TextFormatConfigurationTest extends BrowserTestBase {
    */
   public function testFormatConfiguration() {
     // Save the settings with the filter enabled, but with no button.
-    $this->drupalGet('admin/config/content/formats/manage/plain_text');
+    $this->drupalGet($this->formatUrl);
     $this->submitForm([
       'filters[video_embed_wysiwyg][status]' => TRUE,
       'editor[settings][toolbar][button_groups]' => '[]',
     ], t('Save configuration'));
     $this->assertSession()->pageTextContains('To embed videos, make sure you have enabled the "Video Embed WYSIWYG" filter and dragged the video icon into the WYSIWYG toolbar.');
 
-    $this->drupalGet('admin/config/content/formats/manage/plain_text');
+    $this->drupalGet($this->formatUrl);
     $this->submitForm([
       'filters[video_embed_wysiwyg][status]' => FALSE,
       'editor[settings][toolbar][button_groups]' => '[[{"name":"Group","items":["video_embed"]}]]',
     ], t('Save configuration'));
     $this->assertSession()->pageTextContains('To embed videos, make sure you have enabled the "Video Embed WYSIWYG" filter and dragged the video icon into the WYSIWYG toolbar.');
 
-    $this->drupalGet('admin/config/content/formats/manage/plain_text');
+    $this->drupalGet($this->formatUrl);
     $this->submitForm([
       'filters[video_embed_wysiwyg][status]' => TRUE,
       'editor[settings][toolbar][button_groups]' => '[[{"name":"Group","items":["video_embed"]}]]',
@@ -70,10 +77,34 @@ class TextFormatConfigurationTest extends BrowserTestBase {
   }
 
   /**
+   * Test the filter weights are in the correct order.
+   */
+  public function testWeightOrder() {
+    $this->drupalGet($this->formatUrl);
+    $this->submitForm([
+      // Enable the URL filter and the WYSIWYG embed.
+      'filters[filter_url][status]' => TRUE,
+      'filters[video_embed_wysiwyg][status]' => TRUE,
+      'editor[settings][toolbar][button_groups]' => '[[{"name":"Group","items":["video_embed"]}]]',
+      // Setup the weights so the URL filter runs first.
+      'filters[video_embed_wysiwyg][weight]' => '10',
+      'filters[filter_url][weight]' => '-10',
+    ], 'Save configuration');
+    $this->assertSession()->pageTextContains('The "Video Embed WYSIWYG" filter must run before the "Convert URLs into links" filter to function correctly.');
+
+    // Submit the form with the weights reversed.
+    $this->submitForm([
+      'filters[video_embed_wysiwyg][weight]' => '-10',
+      'filters[filter_url][weight]' => '10',
+    ], 'Save configuration');
+    $this->assertSession()->pageTextContains('The text format Plain text has been updated.');
+  }
+
+  /**
    * Test the dialog defaults can be set and work correctly.
    */
   public function testDialogDefaultValues() {
-    $this->drupalGet('admin/config/content/formats/manage/plain_text');
+    $this->drupalGet($this->formatUrl);
 
     // Assert all the form fields that appear on the modal, appear as
     // configurable defaults.
diff --git a/modules/video_embed_wysiwyg/video_embed_wysiwyg.module b/modules/video_embed_wysiwyg/video_embed_wysiwyg.module
index dacd9e4..0f06328 100644
--- a/modules/video_embed_wysiwyg/video_embed_wysiwyg.module
+++ b/modules/video_embed_wysiwyg/video_embed_wysiwyg.module
@@ -20,6 +20,7 @@ function video_embed_wysiwyg_ckeditor_css_alter(array &$css, Editor $editor) {
  */
 function video_embed_wysiwyg_form_filter_format_form_alter(&$form, $form_state, $form_id) {
   $form['#validate'][] = 'video_embed_wysiwyg_toolbar_filter_validate';
+  $form['#validate'][] = 'video_embed_wysiwyg_filter_weight_validate';
 }
 
 /**
@@ -44,3 +45,17 @@ function video_embed_wysiwyg_toolbar_filter_validate($form, FormStateInterface $
     $form_state->setError($form['filters']['status']['video_embed_wysiwyg'], t('To embed videos, make sure you have enabled the "Video Embed WYSIWYG" filter and dragged the video icon into the WYSIWYG toolbar.'));
   }
 }
+
+/**
+ * Validate the filters are not in an order that will cause conflicts.
+ */
+function video_embed_wysiwyg_filter_weight_validate($form, FormStateInterface $form_state) {
+  $wysiwyg_filter_enabled = !empty($form_state->getValue(['filters', 'video_embed_wysiwyg', 'status']));
+  $url_filter_enabled = !empty($form_state->getValue(['filters', 'filter_url', 'status']));
+  if (!$wysiwyg_filter_enabled || !$url_filter_enabled) {
+    return;
+  }
+  if ($form_state->getValue(['filters', 'video_embed_wysiwyg', 'weight']) > $form_state->getValue(['filters', 'filter_url', 'weight'])) {
+    $form_state->setError($form['filters']['status']['video_embed_wysiwyg'], t('The "Video Embed WYSIWYG" filter must run before the "Convert URLs into links" filter to function correctly.'));
+  }
+}
diff --git a/tests/src/Functional/WidgetTest.php b/tests/src/Functional/WidgetTest.php
index 5b86139..c8da9af 100644
--- a/tests/src/Functional/WidgetTest.php
+++ b/tests/src/Functional/WidgetTest.php
@@ -40,14 +40,14 @@ class WidgetTest extends BrowserTestBase {
       'title[0][value]' => $node_title,
       $this->fieldName . '[0][value]' => 'Some useless value.',
     ], t('Save and publish'));
-    $this->assertContains('Could not find a video provider to handle the given URL.', $this->getSession()->getPage()->getHtml());
+    $this->assertSession()->pageTextContains('Could not find a video provider to handle the given URL.');
 
     // Test a valid input.
     $valid_input = 'https://vimeo.com/80896303';
     $this->submitForm([
       $this->fieldName . '[0][value]' => $valid_input,
     ], t('Save and publish'));
-    $this->assertContains(sprintf('%s <em class="placeholder">%s</em> has been created.', $this->contentTypeName, $node_title), $this->getSession()->getPage()->getHtml());
+    $this->assertSession()->pageTextContains(sprintf('%s %s has been created.', $this->contentTypeName, $node_title));
 
     // Load the saved node and assert the valid value was saved into the field.
     $nodes = \Drupal::entityTypeManager()
