{"version":3,"sources":["Shared/Static/js/selenium-helper.js"],"names":["define","require","_history","_aoLogStack","clearLogs","log","topic","msg","data","x","t","push","searchLogs","fnFilter","bClear","bIgnoreErrors","result","i","length","getLogs","slice","call","exports","getFirstError","window"],"mappings":"AAAAA,OAAO,SAAUC,SAKb,IAAIC,EAAW,WAEX,IAAIC,KAWJ,SAASC,IACLD,KAoCJ,OAASE,IA9CT,SAAaC,EAAOC,EAAKC,GAGrB,IAAIC,GAAMC,EAAGJ,EAAOC,IAAKA,GACrBC,IAAQC,EAAED,KAAOA,GAErBL,EAAYQ,KAAKF,IAwCFL,UAAWA,EAAWQ,WAhCzC,SAAoBC,EAAUC,EAAQC,GAMlC,IAFA,IACIN,EADAO,EAAS,GAEJC,EAAI,EAAGA,EAAId,EAAYe,OAAQD,IAAK,CAGzC,GAAIJ,EAFJJ,EAAIN,EAAYc,IAEC,CACbD,EAAS,IACT,MAEC,GAAW,SAAPP,EAAEC,IAAiBK,EAAe,CACvCC,EAASP,EAAEF,IACX,OASR,OAJIO,GACAV,IAGGY,GAQsDG,QALjE,WAEI,OAAOhB,EAAYiB,WAKxBC,OAMCC,GAGAjB,IAAKH,EAASG,IACdD,UAAWF,EAASE,UACpBQ,WAAYV,EAASU,WACrBO,QAASjB,EAASiB,QAElBI,cAAe,SAAUT,GAErB,OAAOZ,EAASU,WAAW,SAAUH,GAAK,OAAO,GAAUK,KAYnE,OALKU,OAAkB,YAEnBA,OAAkB,UAAIF,GAGnBA","file":"selenium-helper.js","sourcesContent":["define(function (require)\r\n{\r\n //var isTesting = $mbww.qsParamValue('selenium') == '1';\r\n\r\n //history module : register messages from javascript that can be queried from selenium tests\r\n var _history = (function () {\r\n\r\n var _aoLogStack = [];\r\n\r\n function log(topic, msg, data) {\r\n //if (!isTesting) { return; }\r\n\r\n var x = { t: topic, msg: msg };\r\n if (data) { x.data = data; }\r\n\r\n _aoLogStack.push(x);\r\n }\r\n\r\n function clearLogs() {\r\n _aoLogStack = [];\r\n }\r\n\r\n //returns '': not found, 'y' : found, [error text] : error found \r\n function searchLogs(fnFilter, bClear, bIgnoreErrors) {\r\n\r\n //console.log('searchLogs ' + _aoLogStack.map(function (x) { return (x.t + '.' + (x.msg || '')); }).join(','), fnFilter);\r\n\r\n var result = '';\r\n var x;\r\n for (var i = 0; i < _aoLogStack.length; i++) {\r\n x = _aoLogStack[i];\r\n\r\n if (fnFilter(x)) {\r\n result = 'y';\r\n break;\r\n }\r\n else if (x.t == 'error' && !bIgnoreErrors) {\r\n result = x.msg;\r\n break;\r\n }\r\n\r\n }\r\n\r\n if (bClear) {\r\n clearLogs();\r\n }\r\n\r\n return result;\r\n }\r\n\r\n function getLogs()\r\n {\r\n return _aoLogStack.slice();\r\n }\r\n\r\n return { log: log, clearLogs: clearLogs, searchLogs: searchLogs, getLogs: getLogs };\r\n\r\n }).call();\r\n\r\n \r\n\r\n\r\n\r\n var exports = {\r\n\r\n //isTesting: isTesting,\r\n log: _history.log,\r\n clearLogs: _history.clearLogs,\r\n searchLogs: _history.searchLogs,\r\n getLogs: _history.getLogs,\r\n\r\n getFirstError: function (bClear) {\r\n //match no log and wait for the find to break on error;\r\n return _history.searchLogs(function (x) { return false; }, bClear);\r\n }\r\n\r\n };\r\n\r\n\r\n //expose an object in the global scope to manipulate it easily from selenium\r\n if (!window['QSelenium'])\r\n {\r\n window['QSelenium'] = exports;\r\n }\r\n\r\n return exports;\r\n\r\n\r\n\r\n});"]}