@@ -16,23 +16,20 @@ class BrowserLogUtil
1616 const ERROR_TYPE_JAVASCRIPT = "javascript " ;
1717
1818 /**
19- * Loops through stepEvent for browser log entries
19+ * Loops throw errors in log and logs them to allure. Uses Module to set the error itself
2020 *
21- * @param \Magento\FunctionalTestingFramework\Module\MagentoWebDriver $module
22- * @param \Codeception\Event\StepEvent $stepEvent
21+ * @param array $log
22+ * @param \Codeception\Module\WebDriver $module
23+ * @param \Codeception\Event\StepEvent $stepEvent
2324 * @return void
2425 */
25- public static function logErrors ($ module , $ stepEvent )
26+ public static function logErrors ($ log , $ module , $ stepEvent )
2627 {
27- //Types available should be "server", "browser", "driver". Only care about browser at the moment.
28- if (in_array (self ::LOG_TYPE_BROWSER , $ module ->webDriver ->manage ()->getAvailableLogTypes ())) {
29- $ browserLogEntries = $ module ->webDriver ->manage ()->getLog (self ::LOG_TYPE_BROWSER );
30- $ jsErrors = self ::getLogsOfType ($ browserLogEntries , self ::ERROR_TYPE_JAVASCRIPT );
31- foreach ($ jsErrors as $ entry ) {
32- self ::logError (self ::ERROR_TYPE_JAVASCRIPT , $ stepEvent , $ entry );
33- //Set javascript error in MagentoWebDriver internal array
34- $ module ->setJsError ("ERROR( {$ entry ["level " ]}) - " . $ entry ["message " ]);
35- }
28+ $ jsErrors = self ::getLogsOfType ($ log , self ::ERROR_TYPE_JAVASCRIPT );
29+ foreach ($ jsErrors as $ entry ) {
30+ self ::logError (self ::ERROR_TYPE_JAVASCRIPT , $ stepEvent , $ entry );
31+ //Set javascript error in MagentoWebDriver internal array
32+ $ module ->setJsError ("ERROR( {$ entry ["level " ]}) - " . $ entry ["message " ]);
3633 }
3734 }
3835
0 commit comments