85744[TASK] Stabilize FileClipboardCest by checking for content-iframe reload
Commit message
Review
-
Code review CR +2 Done
- Stefan Bürk +2
- Garvin Hicking +1
- Christian Kuhn +1
-
Verified V +2 Done
- Stefan Bürk +2
- Garvin Hicking +1
- Christian Kuhn +1
- core-ci +1 CI
Issues 3
Files 1
Review log 1419
-
Ayke Halder uploaded patch set 1 08/23/24, 09:21
-
core-ci voted on patch set 1 V +1 08/23/24, 09:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64056
-
Ayke Halder updated the commit message in patch set 2
V +108/23/24, 09:38 -
core-ci voted on patch set 2 V -1 08/23/24, 09:47 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64058
-
Ayke Halder rebased onto patch set 3
V -108/23/24, 10:03 -
core-ci voted on patch set 3 V +1 08/23/24, 10:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64061
-
Andreas Kienast commented on patch set 3 08/23/24, 11:10
-
Ayke Halder commented on patch set 3 08/23/24, 13:04
FileClipboardCest.php:80ReplyI'm not sure if `waitForElementNotVisible()` really checks continously or only checks periodically. https://github.com/Codeception/module-webdriver/blob/ef0ea8044eb01dc1e830df27fe431e71440a462f/src/Codeception/Module/WebDriver.php#L2624-L2641 ```php public function waitForElementNotVisible($element, int $timeout = 10): void { $condition = WebDriverExpectedCondition::invisibilityOfElementLocated($this->getLocator($element)); $this->webDriver->wait($timeout)->until($condition); } ``` The time window to get the non-visible element is really small: after http-response with new html code is received, the browser trashes the old html-document and displays the newly received document. The actual change of url/document is triggered by: https://github.com/TYPO3/typo3/blob/82eb6bcb0709a8bf94a098e03ea72f9b2f984bbd/Build/Sources/TypeScript/backend/clipboard-panel.ts#L227-L234 ```js private reloadModule (): void { if (this.returnUrl) { this.ownerDocument.location.href = this.returnUrl; } else { this.ownerDocument.location.reload(); } } } ``` ---- Nevertheless let's try our luck here and go for `waitForElementNotVisible()`. -
Ayke Halder commented on patch set 3 08/23/24, 13:22
IMO it only works with hard-coded `wait()` here.FileClipboardCest.php:80ReplyThis fails: ```php $I->amGoingTo('add multiple elements to clipboard'); $I->wait(1); $I->waitForElementVisible('.t3js-multi-record-selection-check-actions-toggle'); $I->click('Clipboard #1 (multi-selection mode)'); // Click reloads iframe: wait for iframe to be reloaded before going on. $I->waitForElementNotVisible('.t3js-multi-record-selection-check-actions-toggle'); $I->waitForElementVisible('.t3js-multi-record-selection-check-actions-toggle'); $I->click('.t3js-multi-record-selection-check-actions-toggle'); ``` ``` There was 1 error: 1) FileClipboardCest: See add remove multiple records Test Acceptance/Application/FileList/FileClipboardCest.php:seeAddRemoveMultipleRecords [Facebook\WebDriver\Exception\TimeoutException] Scenario Steps: 14. $I->waitForElementNotVisible(".t3js-multi-record-selection-check-actions-toggle") at Acceptance/Application/FileList/FileClipboardCest.php:82 13. $I->click("Clipboard #1 (multi-selection mode)") at Acceptance/Application/FileList/FileClipboardCest.php:80 12. $I->waitForElementVisible(".t3js-multi-record-selection-check-actions-toggle") at Acceptance/Application/FileList/FileClipboardCest.php:79 11. $I->wait(1) at Acceptance/Application/FileList/FileClipboardCest.php:77 10. // I am going to add multiple elements to clipboard ``` So the element is already non-visible in my local environment. **Conclusion:** IMO it only works with hard-coded `wait()` here. -
Ayke Halder uploaded patch set 4
V +108/23/24, 15:56 -
core-ci voted on patch set 4 V +1 08/23/24, 16:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64089
-
Ayke Halder commented on patch set 4 08/23/24, 16:13
Make this work without a hard-coded `wait()`.FileClipboardCest.php:80ReplyI might have found a hacky way to make this work without a hard-coded `wait()`. ```php // Flag current iframe content as old. $I->waitForJS('return document.cestIsOldPage = true;'); // Click reloads iframe. $I->click('Clipboard #1 (multi-selection mode)'); // Check that the iframe does not have the old content anymore. $I->waitForJS('return !("cestIsOldPage" in document);'); // Wait for 'Clipboard #1' as it is one of the last activated elements on page. $I->waitForText('Clipboard #1 (multi-selection mode)'); ``` -
core-ci commented on patch set 4 08/23/24, 19:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64101
-
Christian Kuhn voted on patch set 4 CR +1 V +1 09/09/24, 14:11
-
Stefan Bürk voted on patch set 4 CR +1 V +1 09/09/24, 14:53
-
Garvin Hicking commented on patch set 4 CR +1 V +1 09/12/24, 16:27
what could possibl -
Stefan Bürk commented on patch set 4 09/15/24, 00:33
Reply
...e go wrong ? -
Stefan Bürk voted on patch set 4 CR +2 V +2 09/15/24, 03:20
-
Stefan Bürk merged patch set 5 09/15/24, 03:20
FileClipboardCest.php:80