From 793cfa3c822b9c3c389bfb7acdcd769ebb92c014 Mon Sep 17 00:00:00 2001
From: Liam Morland <lkmorlan@uwaterloo.ca>
Date: Wed, 23 Jun 2021 16:00:21 -0400
Subject: [PATCH] ISTWCMS-4881: Test for CAPTCHA component in Webforms

---
 tests/src/Functional/UwWcmsBasicTest.php | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/src/Functional/UwWcmsBasicTest.php b/tests/src/Functional/UwWcmsBasicTest.php
index c3fde9ec1..12b4bdc2f 100644
--- a/tests/src/Functional/UwWcmsBasicTest.php
+++ b/tests/src/Functional/UwWcmsBasicTest.php
@@ -249,6 +249,9 @@ class UwWcmsBasicTest extends BrowserTestBase {
     ];
     $this->drupalPostForm('admin/structure/webform/add', $edit, 'Save');
 
+    // Test for existence Webform CAPTCHA component on newly-created Webform.
+    $this->assertFieldByXPath('//table[@id="edit-webform-ui-elements"]/tbody/tr[@data-webform-type="captcha"]', NULL, 'CAPTCHA component exists.');
+
     // The variable $test_paths stores Drupal paths and permission information.
     // In this array, the keys are paths. If the value is TRUE, everyone has
     // access. Otherwise, the value must be an array of roles that have access.
-- 
GitLab