@@ -16,23 +16,20 @@ class BrowserLogUtil
16
16
const ERROR_TYPE_JAVASCRIPT = "javascript " ;
17
17
18
18
/**
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
20
20
*
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
23
24
* @return void
24
25
*/
25
- public static function logErrors ($ module , $ stepEvent )
26
+ public static function logErrors ($ log , $ module , $ stepEvent )
26
27
{
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 " ]);
36
33
}
37
34
}
38
35
0 commit comments