From 6ec87cbe52abfef75a4ce20c67c9454ba11feb8c Mon Sep 17 00:00:00 2001
From: Lily Yan <lily.yan@uwaterloo.ca>
Date: Wed, 7 Apr 2021 10:01:22 -0400
Subject: [PATCH] ISTWCMS-4775 Check pathauto pattern for Contact and Profile
 content types

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

diff --git a/tests/src/Functional/UwWcmsBasicTest.php b/tests/src/Functional/UwWcmsBasicTest.php
index 38a4e5e2e..e29c7fd01 100644
--- a/tests/src/Functional/UwWcmsBasicTest.php
+++ b/tests/src/Functional/UwWcmsBasicTest.php
@@ -1572,6 +1572,21 @@ class UwWcmsBasicTest extends BrowserTestBase {
     $this->submitForm($req_fields, 'Save');
     // Contact successfully created when only required fields are submitted.
     $this->assertSession()->statusCodeEquals(200);
+
+    // Check pathauto pattern to make sure they are in same row.
+    $this->drupalGet('admin/config/search/path/patterns');
+    $this->assertSession()->statusCodeEquals(200);
+    $elements = $this->xpath('//div[@id="block-uw-theme-admin-mainpagecontent"]
+    //table/tbody/tr[@data-drupal-selector="edit-entities-uw-path-contact"]/td');
+    $expected_items = [
+      'Contact path pattern',
+      'contacts/[node:title]',
+      'Content',
+      'The node bundle is uw_ct_contact',
+    ];
+    foreach ($expected_items as $key => $value) {
+      $this->assertEqual($elements[$key]->getText(), $value);
+    }
   }
 
   /**
@@ -1629,6 +1644,21 @@ class UwWcmsBasicTest extends BrowserTestBase {
 
     // Validate new content has been created with same name.
     $this->assertSession()->pageTextContains('Profile ' . $profile_name . ' has been created.');
+
+    // Check pathauto pattern to make sure they are in same row.
+    $this->drupalGet('admin/config/search/path/patterns');
+    $this->assertSession()->statusCodeEquals(200);
+    $elements = $this->xpath('//div[@id="block-uw-theme-admin-mainpagecontent"]
+    //table/tbody/tr[@data-drupal-selector="edit-entities-uw-path-profile"]/td');
+    $expected_items = [
+      'Profile path pattern',
+      'profiles/[node:title]',
+      'Content',
+      'The node bundle is uw_ct_profile',
+    ];
+    foreach ($expected_items as $key => $value) {
+      $this->assertEqual($elements[$key]->getText(), $value);
+    }
   }
 
   /**
-- 
GitLab