From e4c3b1eb51a2d077cf5805d76b3a2337cc8182f9 Mon Sep 17 00:00:00 2001
From: Lily Yan <lily.yan@uwaterloo.ca>
Date: Fri, 23 Jul 2021 15:14:24 -0400
Subject: [PATCH] ISTWCMS-3002 Add quick node clone test function

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

diff --git a/tests/src/Functional/UwWcmsBasicTest.php b/tests/src/Functional/UwWcmsBasicTest.php
index 686055b71..2058d0487 100644
--- a/tests/src/Functional/UwWcmsBasicTest.php
+++ b/tests/src/Functional/UwWcmsBasicTest.php
@@ -102,6 +102,7 @@ class UwWcmsBasicTest extends BrowserTestBase {
     $this->bannerBlockTest();
     $this->ofisTest();
     $this->nodeRevisionDeleteTest();
+    $this->quickNodeCloneTest();
   }
 
   /**
@@ -2656,4 +2657,55 @@ class UwWcmsBasicTest extends BrowserTestBase {
     $this->getSession()->getPage()->findField('edit-node-revision-delete-when-to-delete-time-time')->getValue('months');
   }
 
+  /**
+   * Test for quick node clone.
+   */
+  public function quickNodeCloneTest() {
+    $this->drupalLogin($this->drupalUsers['administrator']);
+    // Check quick node clone setting for node.
+    $this->drupalGet('admin/config/quick-node-clone');
+    $this->assertSession()->statusCodeEquals(200);
+    $this->getSession()->getPage()->findField('edit-text-to-prepend-to-title')->getValue('Clone of');
+    $this->assertSession()->checkboxNotChecked('edit-clone-status');
+    $this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-ct-blog');
+    $this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-ct-catalog-item');
+    $this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-ct-contact');
+    $this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-ct-event');
+    $this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-ct-news-item');
+    $this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-ct-profile');
+    $this->assertSession()->checkboxChecked('edit-bundle-names-uw-ct-sidebar');
+    $this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-ct-site-footer');
+    $this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-ct-web-page');
+    $this->assertSession()->checkboxChecked('edit-uw-ct-sidebar-field-uw-attach-page');
+    $this->assertSession()->checkboxNotChecked('edit-uw-ct-sidebar-layout-builder-layout');
+    $this->assertSession()->checkboxChecked('edit-allowed-bundles-uw-ct-blog');
+    $this->assertSession()->checkboxChecked('edit-allowed-bundles-uw-ct-catalog-item');
+    $this->assertSession()->checkboxChecked('edit-allowed-bundles-uw-ct-contact');
+    $this->assertSession()->checkboxChecked('edit-allowed-bundles-uw-ct-event');
+    $this->assertSession()->checkboxChecked('edit-allowed-bundles-uw-ct-news-item');
+    $this->assertSession()->checkboxChecked('edit-allowed-bundles-uw-ct-profile');
+    $this->assertSession()->checkboxChecked('edit-allowed-bundles-uw-ct-sidebar');
+    $this->assertSession()->checkboxNotChecked('edit-allowed-bundles-uw-ct-site-footer');
+    $this->assertSession()->checkboxChecked('edit-allowed-bundles-uw-ct-web-page');
+
+    // Check quick node clone setting for paragraph.
+    $this->drupalGet('admin/config/quick-node-clone-paragraph');
+    $this->assertSession()->statusCodeEquals(200);
+    $this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-para-call-to-action');
+    $this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-para-fact-figure');
+    $this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-para-ff');
+    $this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-para-image-banner');
+    $this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-para-local-video-banner');
+    $this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-para-timeline');
+    $this->assertSession()->checkboxNotChecked('edit-bundle-names-uw-para-vimeo-video-banner');
+    $this->assertSession()->checkboxNotChecked('edit-allowed-bundles-uw-para-call-to-action');
+    $this->assertSession()->checkboxNotChecked('edit-allowed-bundles-uw-para-fact-figure');
+    $this->assertSession()->checkboxNotChecked('edit-allowed-bundles-uw-para-ff');
+    $this->assertSession()->checkboxNotChecked('edit-allowed-bundles-uw-para-image-banner');
+    $this->assertSession()->checkboxNotChecked('edit-allowed-bundles-uw-para-local-video-banner');
+    $this->assertSession()->checkboxNotChecked('edit-allowed-bundles-uw-para-timeline');
+    $this->assertSession()->checkboxNotChecked('edit-allowed-bundles-uw-para-vimeo-video-banner');
+
+  }
+
 }
-- 
GitLab