From d26a1c181c18c1b278d5f77fe9df17b7b1bca9ad Mon Sep 17 00:00:00 2001 From: Grigoruta Cristian Date: Mon, 2 Apr 2018 18:54:37 +0300 Subject: [PATCH 1/4] Added the 'waitForPageLoad' action after every 'amOnPage' action --- .../Util/TestGenerator.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php index 07f069c10..446a07905 100644 --- a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php +++ b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php @@ -1866,4 +1866,18 @@ private function printRuleErrorToConsole($key, $tagName, $attributes) $message .= '" can be use for action "' . $tagName . "\".\n"; print $message; } + + /** + * Go to a page and wait for ajax requests to finish + * + * @param string $page + * @throws \Exception + */ + public function amOnPage($page) + { + $url = Uri::appendPath($this->config['url'], $page); + $this->debugSection('GET', $url); + $this->webDriver->get($url); + $this->waitForPageLoad(); + } } From c5624e2c670634977926f2c10ab2fe5ecef01bc4 Mon Sep 17 00:00:00 2001 From: Grigoruta Cristian Date: Mon, 2 Apr 2018 19:59:34 +0300 Subject: [PATCH 2/4] Cleaned up some code --- src/Magento/FunctionalTestingFramework/Util/TestGenerator.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php index 446a07905..ea599b3ee 100644 --- a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php +++ b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php @@ -1872,6 +1872,7 @@ private function printRuleErrorToConsole($key, $tagName, $attributes) * * @param string $page * @throws \Exception + * @return void */ public function amOnPage($page) { From f52a4082c78ea8668687f11c3f38a98a4ac6a207 Mon Sep 17 00:00:00 2001 From: Grigoruta Cristian Date: Sun, 29 Apr 2018 22:03:51 +0300 Subject: [PATCH 3/4] Changed the location of the rewrite --- .../Module/MagentoWebDriver.php | 13 +++++++++++++ .../Util/TestGenerator.php | 15 --------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php index 606437cd6..9ba822db7 100644 --- a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php +++ b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php @@ -554,4 +554,17 @@ public function saveScreenshot() $this->_saveScreenshot($this->pngReport = $outputDir . mb_strcut($filename, 0, 245, 'utf-8') . '.fail.png'); $this->_savePageSource($this->htmlReport = $outputDir . mb_strcut($filename, 0, 244, 'utf-8') . '.fail.html'); } + + /** + * Go to a page and wait for ajax requests to finish + * + * @param string $page + * @throws \Exception + * @return void + */ + public function amOnPage($page) + { + parent::amOnPage($page) + $this->waitForPageLoad(); + } } diff --git a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php index ea599b3ee..07f069c10 100644 --- a/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php +++ b/src/Magento/FunctionalTestingFramework/Util/TestGenerator.php @@ -1866,19 +1866,4 @@ private function printRuleErrorToConsole($key, $tagName, $attributes) $message .= '" can be use for action "' . $tagName . "\".\n"; print $message; } - - /** - * Go to a page and wait for ajax requests to finish - * - * @param string $page - * @throws \Exception - * @return void - */ - public function amOnPage($page) - { - $url = Uri::appendPath($this->config['url'], $page); - $this->debugSection('GET', $url); - $this->webDriver->get($url); - $this->waitForPageLoad(); - } } From b3cff790967f3870a6319707793ff9ea4048d8c2 Mon Sep 17 00:00:00 2001 From: Grigoruta Cristian Date: Mon, 30 Apr 2018 03:08:12 +0300 Subject: [PATCH 4/4] Fixed error --- .../FunctionalTestingFramework/Module/MagentoWebDriver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php index b6d350dcd..a1815aa70 100644 --- a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php +++ b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php @@ -609,7 +609,7 @@ public function saveScreenshot() */ public function amOnPage($page) { - parent::amOnPage($page) + parent::amOnPage($page); $this->waitForPageLoad(); } }