From 724e5f849f8a45f0dd58921dcf943ffe255cded2 Mon Sep 17 00:00:00 2001
From: Christian Kuhn <lolli@schwarzbu.ch>
Date: Sun, 30 Jul 2023 21:50:27 +0200
Subject: [PATCH] [TASK] Stabilize more Frontend/ ac tests

Similar to #101491, the other Application/Frontend
acceptance tests get same treatment to wait for the
"View webpage" icon being visible, before trying to
click it.

Resolves: #101492
Related: #101491
Releases: main, 12.4, 11.5
Change-Id: Ie8dd5338a6773baf8850fec0713dcd917699fbfc
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80254
Tested-by: core-ci <typo3@b13.com>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 .../Acceptance/Application/Frontend/ContentElementsCest.php      | 1 +
 .../Tests/Acceptance/Application/Frontend/FormFrameworkCest.php  | 1 +
 .../Tests/Acceptance/Application/Frontend/FrontendLoginCest.php  | 1 +
 .../Tests/Acceptance/Application/Frontend/SitemapXmlCest.php     | 1 +
 4 files changed, 4 insertions(+)

diff --git a/typo3/sysext/core/Tests/Acceptance/Application/Frontend/ContentElementsCest.php b/typo3/sysext/core/Tests/Acceptance/Application/Frontend/ContentElementsCest.php
index 5893a601fe5c..c9530f9278fa 100644
--- a/typo3/sysext/core/Tests/Acceptance/Application/Frontend/ContentElementsCest.php
+++ b/typo3/sysext/core/Tests/Acceptance/Application/Frontend/ContentElementsCest.php
@@ -35,6 +35,7 @@ class ContentElementsCest
         $I->waitForElement('#typo3-pagetree-tree .nodes .node', 5);
         $pageTree->openPath(['styleguide frontend demo']);
         $I->switchToContentFrame();
+        $I->waitForElementVisible('.t3js-module-docheader-bar a[title="View webpage"]');
         $I->click('.t3js-module-docheader-bar a[title="View webpage"]');
         $I->executeInSelenium(static function (RemoteWebDriver $webdriver) {
             $handles = $webdriver->getWindowHandles();
diff --git a/typo3/sysext/core/Tests/Acceptance/Application/Frontend/FormFrameworkCest.php b/typo3/sysext/core/Tests/Acceptance/Application/Frontend/FormFrameworkCest.php
index d0b68d8aa3b1..1d27b98102ee 100644
--- a/typo3/sysext/core/Tests/Acceptance/Application/Frontend/FormFrameworkCest.php
+++ b/typo3/sysext/core/Tests/Acceptance/Application/Frontend/FormFrameworkCest.php
@@ -38,6 +38,7 @@ class FormFrameworkCest
         $I->waitForElement('#typo3-pagetree-tree .nodes .node', 5);
         $pageTree->openPath(['styleguide frontend demo']);
         $I->switchToContentFrame();
+        $I->waitForElementVisible('.t3js-module-docheader-bar a[title="View webpage"]');
         $I->click('.t3js-module-docheader-bar a[title="View webpage"]');
         $I->executeInSelenium(static function (RemoteWebDriver $webdriver) {
             $handles = $webdriver->getWindowHandles();
diff --git a/typo3/sysext/core/Tests/Acceptance/Application/Frontend/FrontendLoginCest.php b/typo3/sysext/core/Tests/Acceptance/Application/Frontend/FrontendLoginCest.php
index 48c55a2d0044..d50e5f1114bd 100644
--- a/typo3/sysext/core/Tests/Acceptance/Application/Frontend/FrontendLoginCest.php
+++ b/typo3/sysext/core/Tests/Acceptance/Application/Frontend/FrontendLoginCest.php
@@ -36,6 +36,7 @@ class FrontendLoginCest
         $I->waitForElement('#typo3-pagetree-tree .nodes .node', 5);
         $pageTree->openPath(['styleguide frontend demo']);
         $I->switchToContentFrame();
+        $I->waitForElementVisible('.t3js-module-docheader-bar a[title="View webpage"]');
         $I->click('.t3js-module-docheader-bar a[title="View webpage"]');
         $I->executeInSelenium(static function (RemoteWebDriver $webdriver) {
             $handles = $webdriver->getWindowHandles();
diff --git a/typo3/sysext/core/Tests/Acceptance/Application/Frontend/SitemapXmlCest.php b/typo3/sysext/core/Tests/Acceptance/Application/Frontend/SitemapXmlCest.php
index fe7e7e9ae5b1..98d2a8bf372b 100644
--- a/typo3/sysext/core/Tests/Acceptance/Application/Frontend/SitemapXmlCest.php
+++ b/typo3/sysext/core/Tests/Acceptance/Application/Frontend/SitemapXmlCest.php
@@ -40,6 +40,7 @@ class SitemapXmlCest
         $I->waitForElement('#typo3-pagetree-tree .nodes .node', 5);
         $pageTree->openPath(['styleguide frontend demo']);
         $I->switchToContentFrame();
+        $I->waitForElementVisible('.t3js-module-docheader-bar a[title="View webpage"]');
         $I->click('.t3js-module-docheader-bar a[title="View webpage"]');
         $I->executeInSelenium(function (RemoteWebDriver $webdriver) {
             $handles = $webdriver->getWindowHandles();
-- 
GitLab