From fb1b177044b95b082c7141501daf3b8ad079e4a5 Mon Sep 17 00:00:00 2001
From: Patryk Miedziaszczyk <p.miedziaszczyk@macopedia.com>
Date: Thu, 8 Jul 2021 13:50:20 +0200
Subject: [PATCH] [TASK] Acceptance tests for the Indexed Search

Basic test for Indexed Search backend module checking
main modes are loading properly.

Releases: master
Resolves: #94467
Change-Id: I6a0276ba0b881e57ee256793e584f60312406b5b
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/69763
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
---
 .../IndexedSearch/IndexedSearchModuleCest.php | 64 +++++++++++++++++++
 .../Extension/BackendCoreEnvironment.php      |  3 +-
 2 files changed, 66 insertions(+), 1 deletion(-)
 create mode 100644 typo3/sysext/core/Tests/Acceptance/Backend/IndexedSearch/IndexedSearchModuleCest.php

diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/IndexedSearch/IndexedSearchModuleCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/IndexedSearch/IndexedSearchModuleCest.php
new file mode 100644
index 000000000000..d7d2f263fca8
--- /dev/null
+++ b/typo3/sysext/core/Tests/Acceptance/Backend/IndexedSearch/IndexedSearchModuleCest.php
@@ -0,0 +1,64 @@
+<?php
+
+declare(strict_types=1);
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\IndexedSearch;
+
+use TYPO3\CMS\Core\Tests\Acceptance\Support\BackendTester;
+
+/**
+ * Tests for the Indexed Search module
+ */
+class IndexedSearchModuleCest
+{
+    /**
+     * @param BackendTester $I
+     */
+    public function _before(BackendTester $I)
+    {
+        $I->useExistingSession('admin');
+    }
+
+    /**
+     * @param BackendTester $I
+     */
+    public function checkExpectedTextOnIndexedSearchPages(BackendTester $I)
+    {
+        $I->click('#web_IndexedSearchIsearch');
+        $I->switchToContentFrame();
+        $I->seeElement('.t3-js-jumpMenuBox');
+        $I->selectOption('.t3-js-jumpMenuBox', 'General statistics');
+        $I->see('Indexing Engine Statistics', '.t3js-module-body');
+        $I->see('General statistics', '.t3js-module-body');
+        $I->see('Row count by database table', '.t3js-module-body');
+        $rowCount = $I->grabMultiple('table > tbody >tr > td:nth-child(2)');
+        foreach ($rowCount as $count) {
+            $I->assertEquals('0', $count);
+        }
+
+        $I->selectOption('.t3-js-jumpMenuBox', 'List: Pages');
+        $I->see('Indexing Engine Statistics', '.t3js-module-body');
+        $I->see('Pages', '.t3js-module-body');
+
+        $I->selectOption('.t3-js-jumpMenuBox', 'List: External documents');
+        $I->see('Indexing Engine Statistics', '.t3js-module-body');
+        $I->see('External documents', '.t3js-module-body');
+
+        $I->selectOption('.t3-js-jumpMenuBox', 'Detailed statistics');
+        $I->see('Indexing Engine Statistics', '.t3js-module-body');
+        $I->see('Please select a page from the page tree.', '.t3js-module-body');
+    }
+}
diff --git a/typo3/sysext/core/Tests/Acceptance/Support/Extension/BackendCoreEnvironment.php b/typo3/sysext/core/Tests/Acceptance/Support/Extension/BackendCoreEnvironment.php
index 46768676ab9f..342c058fe02d 100644
--- a/typo3/sysext/core/Tests/Acceptance/Support/Extension/BackendCoreEnvironment.php
+++ b/typo3/sysext/core/Tests/Acceptance/Support/Extension/BackendCoreEnvironment.php
@@ -55,7 +55,8 @@ class BackendCoreEnvironment extends BackendEnvironment
             'lowlevel',
             'dashboard',
             'workspaces',
-            'info'
+            'info',
+            'indexed_search'
         ],
         'testExtensionsToLoad' => [
             'typo3conf/ext/styleguide'
-- 
GitLab