From 979ce508c214bac22be997b224fab16d9f4f2551 Mon Sep 17 00:00:00 2001
From: Jochen Roth <jochen.roth@b13.com>
Date: Wed, 8 Jun 2022 15:42:30 +0200
Subject: [PATCH] [BUGFIX] Wait for element in page tree to disappear
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Currently the clearFilterReloadsPageTreeWithoutFilterApplied
randomly fails due to a still existing element.
This seems to be caused by performance issues in CI.

This is now solved by waiting for the element to actually
disappear.

Resolves: #97749
Releases: main, 11.5
Change-Id: Ib417fc97dcff6ddf0f3c1370ffa419a79f21eba6
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/74875
Tested-by: core-ci <typo3@b13.com>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
---
 .../Application/PageTree/PageTreeFilterCest.php           | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/typo3/sysext/core/Tests/Acceptance/Application/PageTree/PageTreeFilterCest.php b/typo3/sysext/core/Tests/Acceptance/Application/PageTree/PageTreeFilterCest.php
index f43a42b8d3d0..07110a3fffa7 100644
--- a/typo3/sysext/core/Tests/Acceptance/Application/PageTree/PageTreeFilterCest.php
+++ b/typo3/sysext/core/Tests/Acceptance/Application/PageTree/PageTreeFilterCest.php
@@ -46,11 +46,9 @@ class PageTreeFilterCest
     {
         $I->fillField($this->filterInputField, 'Group');
         $this->waitForPageTreeLoad($I);
-        $I->waitForElementNotVisible('//*[text()=\'inline expandsingle\']');
-
         // [#91884] no Enter key press on purpose. The search should start by itself without additional Enter key press
         // and this assertion makes sure the filter worked
-        $I->cantSee('inline expandsingle', $this->inPageTree);
+        $I->waitForElementNotVisible('//*[text()=\'inline expandsingle\']');
 
         $I->canSee('elements group', $this->inPageTree);
         $I->canSee('inline mngroup', $this->inPageTree);
@@ -73,17 +71,17 @@ class PageTreeFilterCest
     {
         $I->fillField($this->filterInputField, 'Group');
         $this->waitForPageTreeLoad($I);
+        $I->waitForElementNotVisible('//*[text()=\'inline expandsingle\']');
 
         $I->canSee('elements group', $this->inPageTree);
         $I->canSee('inline mngroup', $this->inPageTree);
-        $I->cantSee('inline expandsingle', $this->inPageTree);
 
         $I->pressKey($this->filterInputField, WebDriverKeys::ESCAPE);
         $this->waitForPageTreeLoad($I);
 
+        $I->waitForElementVisible('//*[text()=\'inline expandsingle\']');
         $I->canSee('elements group', $this->inPageTree);
         $I->canSee('inline mngroup', $this->inPageTree);
-        $I->canSee('inline expandsingle', $this->inPageTree);
     }
 
     /**
-- 
GitLab