Commit 520ecd36 authored by Simon Schaufelberger's avatar Simon Schaufelberger Committed by Stefan Bürk
Browse files

[BUGFIX] Fix randomly failing PageTreeFilterCest

Sometimes it happens that the page tree is not updated
within a certain amount of time resulting in failing tests.
This patch will add a timeout and makes sure that the page
tree is updated.

Resolves: #97714
Releases: main, 11.5
Change-Id: Id28d955ccda6838701aea63e6aa97b5ee9c602b5
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/74793


Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Oliver Klee's avatarOliver Klee <typo3-coding@oliverklee.de>
Tested-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: Oliver Klee's avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
parent f32e7128
......@@ -45,9 +45,8 @@ class PageTreeFilterCest
public function filterTreeForPage(ApplicationTester $I): void
{
$I->fillField($this->filterInputField, 'Group');
$this->timeoutForAjaxRequest($I);
$I->waitForElement('#typo3-pagetree-tree .nodes .node', 10);
$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);
......@@ -61,8 +60,7 @@ class PageTreeFilterCest
$I->click($this->pageTreeSecondaryOptions);
$I->click($this->pageTreeReloadButton);
$this->timeoutForAjaxRequest($I);
$I->waitForElement('#typo3-pagetree-tree .nodes .node', 5);
$this->waitForPageTreeLoad($I);
// [#91885] filter must still apply after page tree reload
$I->amGoingTo('prove the filter applies after page tree reload');
......@@ -73,14 +71,14 @@ class PageTreeFilterCest
public function clearFilterReloadsPageTreeWithoutFilterApplied(ApplicationTester $I): void
{
$I->fillField($this->filterInputField, 'Group');
$this->timeoutForAjaxRequest($I);
$this->waitForPageTreeLoad($I);
$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->timeoutForAjaxRequest($I);
$this->waitForPageTreeLoad($I);
$I->canSee('elements group', $this->inPageTree);
$I->canSee('inline mngroup', $this->inPageTree);
......@@ -93,23 +91,24 @@ class PageTreeFilterCest
public function deletingPageWithFilterAppliedRespectsFilterUponPageTreeReload(ApplicationTester $I, ModalDialog $modalDialog): void
{
$I->fillField($this->filterInputField, 'Group');
$this->timeoutForAjaxRequest($I);
$this->waitForPageTreeLoad($I);
$I->canSee('elements group', $this->inPageTree);
$I->canSee('inline mngroup', $this->inPageTree);
$I->waitForElement('//*[text()=\'inline mn\']');
$I->clickWithRightButton('//*[text()=\'inline mn\']');
$I->canSeeElement('#contentMenu0');
$I->waitForElement('#contentMenu0');
$I->click('[data-callback-action="deleteRecord"]', '#contentMenu0');
// don't use $modalDialog->clickButtonInDialog due to too low timeout
$modalDialog->canSeeDialog();
$I->click('button[name="delete"]', ModalDialog::$openedModalButtonContainerSelector);
$I->waitForElementNotVisible(ModalDialog::$openedModalSelector, 30);
$this->timeoutForAjaxRequest($I);
$this->waitForPageTreeLoad($I);
$I->canSee('elements group', $this->inPageTree);
$I->waitForElementNotVisible('//*[text()=\'inline mn\']');
$I->cantSee('inline mngroup', $this->inPageTree);
$I->cantSee('inline expandsingle', $this->inPageTree);
}
......@@ -121,8 +120,9 @@ class PageTreeFilterCest
$I->click($this->pageTreeReloadButton);
}
protected function timeoutForAjaxRequest(ApplicationTester $I): void
protected function waitForPageTreeLoad(ApplicationTester $I): void
{
$I->wait(0.5);
$I->waitForElement('#typo3-pagetree-tree .nodes .node', 10);
$I->waitForElementNotVisible('#typo3-pagetree .svg-tree-loader', 10);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment