@suitest/translate
Advanced tools
Comparing version 4.4.3 to 4.4.4
@@ -1,1 +0,1 @@ | ||
"use strict";var __read=this&&this.__read||function(t,e){var s="function"==typeof Symbol&&t[Symbol.iterator];if(!s)return t;var n,r,l=s.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(n=l.next()).done;)i.push(n.value)}catch(t){r={error:t}}finally{try{n&&!n.done&&(s=l.return)&&s.call(l)}finally{if(r)throw r.error}}return i};Object.defineProperty(exports,"__esModule",{value:!0}),exports.translateTestLine=void 0;var smst_1=require("@suitest/smst"),comparator_1=require("./comparator"),condition_1=require("./condition"),utils_1=require("./utils"),getConditionInfo=function(t,e){var s=t,n=s.condition,r=s.count,l=s.negateCondition,i=s.delay,a=function(t){return void 0!==t?smst_1.jsx("fragment",null," every ",utils_1.formatTimeout(t,null==e?void 0:e.configVariables)):""};return!n&&r&&("string"==typeof r||r>1)?smst_1.jsx("fragment",null," exactly ",utils_1.formatCount(r,null==e?void 0:e.configVariables),a(i)):n&&l?smst_1.jsx("text",null," only if condition is met"):n&&!l?smst_1.jsx("fragment",null," until condition is met max ",utils_1.formatCount(null!=r?r:1,null==e?void 0:e.configVariables),a(i)):void 0},assertAssertThen=function(t){throw new Error('Unknown "then" in assert: '+t)},translateAssertThen=function(t){switch(t){case"success":return"continue";case"exit":return"stop test";case"fail":return"fail";case"warning":return"warn";default:return assertAssertThen(t)}},translateAssertTestLine=function(t,e,s,n){var r=condition_1.translateCondition(t.condition,!(!t.then||"success"===(null==t?void 0:t.then)),e,s,n),l=t.excluded?"excluded":null==n?void 0:n.result;return smst_1.jsx("test-line",{title:smst_1.jsx("fragment",null,"Assert: ",r.title,t.timeout?smst_1.jsx("fragment",null," timeout ",utils_1.formatTimeout(t.timeout,null==e?void 0:e.configVariables)):void 0,t.then&&"success"!==t.then?smst_1.jsx("fragment",null," then ",translateAssertThen(t.then)):void 0),status:l},r.children)},translateTakeScreenshotTestLine=function(t,e){var s="";return"raw"===t.dataFormat?s="Take screenshot (raw)":"base64"===t.dataFormat?s="Take screenshot (base64)":t.fileName&&(s='Save screenshot ("'+t.fileName+'")'),smst_1.jsx("test-line",{title:smst_1.jsx("text",null,s),status:null==e?void 0:e.result})},translateClearAppDataTestLine=function(t,e){return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Clear application data"),status:t.excluded?"excluded":null==e?void 0:e.result})},stringifySelector=function(t){return Array.isArray(t)?t.map((function(t){return"|"+stringifySelector(t)+"|"})).join(" -> "):t.video||t.psVideo?"video element":t.active?"active element":t.handle?'element by handle "'+t.handle+'"':"string"==typeof t.linkText?'link with "'+t.linkText+'" text':"string"==typeof t.partialLinkText?'link containing "'+t.partialLinkText+'" text':'"'+Object.values(t).filter(Boolean)[0]+'" element'},translateQueryTestLine=function(t,e){var s="";switch(t.subject.type){case"cookie":s='Retrieve value for "'+t.subject.cookieName+'" cookie';break;case"execute":s='Retrieve value of execution "'+t.subject.execute+'"';break;case"location":s="Retrieve value of current location";break;case"elementProps":s="Retrieve info of "+stringifySelector(t.subject.selector);break;case"elementCssProps":var n=t.subject,r=n.elementCssProps,l=n.selector;s+="Getting ["+r.join(", ")+"] css properties of "+stringifySelector(l);break;case"elementHandle":s+="Getting handle"+(t.subject.multiple?"s":"")+" of "+stringifySelector(t.subject.selector);break;case"elementAttributes":var i=t.subject.attributes;s+="Getting "+(i.length?"["+i.join(", ")+"] attribute"+(i.length>1?"s":""):"all attributes")+" of "+stringifySelector(t.subject.selector);break;default:var a=t.subject;console.warn('Unknown subject "'+JSON.stringify(a)+'" of query line.')}var o="error"===(null==e?void 0:e.result)?"fail":null==e?void 0:e.result;return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,s),status:o})},translateExecuteCommandTestLine=function(t,e,s){return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Execute JavaScript expression"),status:t.excluded?"excluded":null==s?void 0:s.result},smst_1.jsx("props",null,utils_1.translateCodeProp(smst_1.jsx("text",null,"JavaScript expression"),t.val,e,"",utils_1.mapStatus(null==s?void 0:s.result))))},translateOpenApp=function(t,e,s){var n,r=t.excluded?"excluded":null==s?void 0:s.result;if(t.launchMode){var l=null!==(n={resume:"Resume background application",restart:"Restart application"}[t.launchMode])&&void 0!==n?n:"Open application";return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,l),status:r})}if(!t.relativeUrl)return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Open application"),status:r});var i=utils_1.formatVariables(t.relativeUrl,null==e?void 0:e.configVariables);return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Open application at relative URL"),status:r},smst_1.jsx("props",null,smst_1.jsx("prop",{name:smst_1.jsx("text",null,"relative path"),comparator:comparator_1.translateComparator("="),expectedValue:i})))},translateCloseAppTestLine=function(t,e){var s=t.excluded?"excluded":null==e?void 0:e.result;return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Close application"),status:s})},translateSuspendAppTestLine=function(t,e){var s=t.excluded?"excluded":null==e?void 0:e.result;return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Suspend application"),status:s})},translateOpenUrl=function(t,e,s){var n=utils_1.formatVariables(t.url,null==e?void 0:e.configVariables),r=t.excluded?"excluded":null==s?void 0:s.result;return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Open URL"),status:r},smst_1.jsx("props",null,smst_1.jsx("prop",{name:smst_1.jsx("text",null,"URL"),comparator:comparator_1.translateComparator("="),expectedValue:n})))},translateSleepTestLine=function(t,e,s){var n=t.excluded?"excluded":null==s?void 0:s.result,r=smst_1.jsx("fragment",null,"Sleep ",utils_1.formatTimeout(t.timeout,null==e?void 0:e.configVariables));return smst_1.jsx("test-line",{title:r,status:n})},translatePollUrlTestLine=function(t,e,s){var n=utils_1.formatVariables(t.response,null==e?void 0:e.configVariables),r=utils_1.formatVariables(t.url,null==e?void 0:e.configVariables),l=t.excluded?"excluded":null==s?void 0:s.result;return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Poll URL every 0.5s"),status:l},smst_1.jsx("props",null,smst_1.jsx("prop",{name:smst_1.jsx("text",null,"poll URL"),comparator:comparator_1.translateComparator("="),expectedValue:r,status:utils_1.mapStatus(null==s?void 0:s.result)}),smst_1.jsx("prop",{name:smst_1.jsx("text",null,"until receive"),comparator:comparator_1.translateComparator("="),expectedValue:n,status:utils_1.mapStatus(null==s?void 0:s.result)})))},translatePressButtonTestLine=function(t,e,s,n){var r=t.ids.map((function(e,s){return smst_1.jsx("fragment",null,smst_1.jsx("input",null,e),s!==t.ids.length-1?", ":"")})),l=getConditionInfo(t,e),i=t.excluded?"excluded":null==n?void 0:n.result;return smst_1.jsx("test-line",{title:smst_1.jsx("fragment",null,"Press button ",r,l),status:i},t.condition?condition_1.translateCondition(t.condition,!1,e,s,n):void 0)},translateTestName=function(t,e){return e&&e[t]?smst_1.jsx("subject",null,e[t].name):smst_1.jsx("fragment",null,"(",smst_1.jsx("code",null,t.slice(0,4)+"..."+t.slice(-4)),")")},translateRunTestTestLine=function(t,e,s,n,r){var l=translateTestName(t.val,n),i=getConditionInfo(t,e),a=t.excluded?"excluded":null==r?void 0:r.result;return smst_1.jsx("test-line",{title:smst_1.jsx("fragment",null,"Run test ",l,i),status:a},t.condition?condition_1.translateCondition(t.condition,!1,e,s,r):void 0)},assertUnknownTarget=function(t){throw new Error("Unknown target: "+JSON.stringify(t))},translateTarget=function(t){switch(t.type){case"element":return"val"in t&&t.val.active?smst_1.jsx("subject",null,"active element"):smst_1.jsx("subject",null,"element");case"window":return smst_1.jsx("subject",null,"coordinates"in t?t.relative?"relative position":"position":"window");case"screen":return smst_1.jsx("subject",null,"coordinates"in t?"position":"screen");default:return assertUnknownTarget(t)}},translateSendTextTestLine=function(t,e,s,n){var r=utils_1.formatVariables(t.val,null==e?void 0:e.configVariables),l=t.excluded?"excluded":null==n?void 0:n.result,i=getConditionInfo(t,e),a=smst_1.jsx("fragment",null,"Send text ",r," to ",translateTarget(t.target),i);return smst_1.jsx("test-line",{title:a,status:l},t.condition?condition_1.translateCondition(t.condition,!1,e,s,n):void 0)},translateSetTextTestLine=function(t,e,s,n){var r=utils_1.formatVariables(t.val,null==e?void 0:e.configVariables),l=getConditionInfo(t,e),i=t.excluded?"excluded":null==n?void 0:n.result,a=smst_1.jsx("fragment",null,"Set text ",r," to ",translateTarget(t.target),l);return smst_1.jsx("test-line",{title:a,status:i},t.condition?condition_1.translateCondition(t.condition,!1,e,s,n):void 0)},assertUnknownBrowserCommand=function(t){throw new Error("Unknown browser command: "+JSON.stringify(t))},assertUnknownDeviceSetting=function(t){throw new Error("Unknown device setting: "+JSON.stringify(t))},translateBrowserCommandTestLine=function(t,e,s,n){var r=t.excluded?"excluded":null==n?void 0:n.result,l=t.condition?condition_1.translateCondition(t.condition,!1,e,s,n):void 0;switch(t.browserCommand.type){case"goBack":return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Go back"),status:r},l);case"goForward":return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Go forward"),status:r},l);case"refresh":return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Refresh"),status:r},l);case"setWindowSize":return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Resize window"),status:r},smst_1.jsx("props",null,smst_1.jsx("prop",{name:smst_1.jsx("text",null,"size"),comparator:comparator_1.translateComparator("="),expectedValue:smst_1.jsx("text",null,String(t.browserCommand.params.width),"x",String(t.browserCommand.params.height))})),l);case"dismissAlertMessage":return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Dismiss modal dialog"),status:r},l);case"acceptAlertMessage":return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Accept modal dialog"),status:r},l);case"acceptPromptMessage":return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Accept modal dialog with message"),status:r},smst_1.jsx("props",null,smst_1.jsx("prop",{name:smst_1.jsx("text",null,"message"),comparator:comparator_1.translateComparator("="),expectedValue:smst_1.jsx("text",null,t.browserCommand.params.text)})),l);default:return assertUnknownBrowserCommand(t.browserCommand)}},translateDeviceSettingsTestLine=function(t,e,s,n){var r=t.excluded?"excluded":null==n?void 0:n.result,l=t.condition?condition_1.translateCondition(t.condition,!1,e,s,n):void 0;switch(t.deviceSettings.type){case"setOrientation":var i=utils_1.deviceOrientationsMap[t.deviceSettings.params.orientation];return smst_1.jsx("test-line",{title:smst_1.jsx("fragment",null,"Set screen orientation to ",smst_1.jsx("input",null,i)),status:r},l);default:return assertUnknownDeviceSetting(t.deviceSettings.type)}},translateClickTestLine=function(t,e,s,n){var r=getConditionInfo(t,e),l=smst_1.jsx("fragment",null,"Click on ",translateTarget(t.target),r),i=t.excluded?"excluded":null==n?void 0:n.result;return smst_1.jsx("test-line",{title:l,status:i},t.condition?condition_1.translateCondition(t.condition,!1,e,s,n):void 0)},translateTapTestLine=function(t,e,s,n){var r=getConditionInfo(t,e),l=__read(t.taps,1)[0],i=l.type,a=l.duration,o=i.charAt(0).toUpperCase()+i.slice(1),u=smst_1.jsx("fragment",null,o," tap on ",translateTarget(t.target),void 0!==a?smst_1.jsx("fragment",null," for ",utils_1.formatTimeout(a,null==e?void 0:e.configVariables)):void 0,r),c=t.excluded?"excluded":null==n?void 0:n.result;return smst_1.jsx("test-line",{title:u,status:c},t.condition?condition_1.translateCondition(t.condition,!1,e,s,n):void 0)},translateScrollTestLine=function(t,e,s,n){var r=getConditionInfo(t,e),l=t.scroll[0].direction,i=t.scroll[0].distance,a=smst_1.jsx("fragment",null,"Scroll from ",translateTarget(t.target),r," ",l,["string","number"].includes(typeof i)?" by "+i+"px":""),o=t.excluded?"excluded":null==n?void 0:n.result;return smst_1.jsx("test-line",{title:a,status:o},t.condition?condition_1.translateCondition(t.condition,!1,e,s,n):void 0)},translateSwipeTestLine=function(t,e,s,n){var r=getConditionInfo(t,e),l=t.swipe[0].direction,i=t.swipe[0].distance,a=t.swipe[0].duration,o=smst_1.jsx("fragment",null,"Swipe/Flick from ",translateTarget(t.target),r," ",l," by ",i,"px in ",a,"ms"),u=t.excluded?"excluded":null==n?void 0:n.result;return smst_1.jsx("test-line",{title:o,status:u},t.condition?condition_1.translateCondition(t.condition,!1,e,s,n):void 0)},translateMoveToTestLine=function(t,e,s,n){var r=getConditionInfo(t,e),l=smst_1.jsx("fragment",null,"Move pointer to ",translateTarget(t.target),r),i=t.excluded?"excluded":null==n?void 0:n.result;return smst_1.jsx("test-line",{title:l,status:i},t.condition?condition_1.translateCondition(t.condition,!1,e,s,n):void 0)},translateCommentTestLine=function(t){return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,t.val.split("\n").map((function(t){return!!t.trim()&&"# "+t})).filter(Boolean).join("\n"))})},assertUnknownLineType=function(t){throw new Error("Unknown line type: "+JSON.stringify(t))};exports.translateTestLine=function(t){var e=t.testLine,s=t.appConfig,n=t.elements,r=t.snippets,l=t.lineResult;switch(e.type){case"query":return translateQueryTestLine(e,l);case"assert":case"wait":return translateAssertTestLine(e,s,n,l);case"takeScreenshot":return translateTakeScreenshotTestLine(e,l);case"clearAppData":return translateClearAppDataTestLine(e,l);case"execCmd":return translateExecuteCommandTestLine(e,s,l);case"openApp":return translateOpenApp(e,s,l);case"openUrl":return translateOpenUrl(e,s,l);case"sleep":return translateSleepTestLine(e,s,l);case"pollUrl":return translatePollUrlTestLine(e,s,l);case"button":return translatePressButtonTestLine(e,s,n,l);case"runSnippet":return translateRunTestTestLine(e,s,n,r,l);case"sendText":return translateSendTextTestLine(e,s,n,l);case"setText":return translateSetTextTestLine(e,s,n,l);case"browserCommand":return translateBrowserCommandTestLine(e,s,n,l);case"deviceSettings":return translateDeviceSettingsTestLine(e,s,n,l);case"click":return translateClickTestLine(e,s,n,l);case"tap":return translateTapTestLine(e,s,n,l);case"scroll":return translateScrollTestLine(e,s,n,l);case"swipe":return translateSwipeTestLine(e,s,n,l);case"moveTo":return translateMoveToTestLine(e,s,n,l);case"closeApp":return translateCloseAppTestLine(e,l);case"suspendApp":return translateSuspendAppTestLine(e,l);case"comment":return translateCommentTestLine(e);default:return assertUnknownLineType(e)}}; | ||
"use strict";var __read=this&&this.__read||function(t,e){var s="function"==typeof Symbol&&t[Symbol.iterator];if(!s)return t;var n,r,l=s.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=l.next()).done;)a.push(n.value)}catch(t){r={error:t}}finally{try{n&&!n.done&&(s=l.return)&&s.call(l)}finally{if(r)throw r.error}}return a};Object.defineProperty(exports,"__esModule",{value:!0}),exports.translateTestLine=void 0;var smst_1=require("@suitest/smst"),comparator_1=require("./comparator"),condition_1=require("./condition"),utils_1=require("./utils"),getConditionInfo=function(t,e){var s=t,n=s.condition,r=s.count,l=s.negateCondition,a=s.delay,i=function(t){return void 0!==t?smst_1.jsx("fragment",null," every ",utils_1.formatTimeout(t,null==e?void 0:e.configVariables)):""};return!n&&r&&("string"==typeof r||r>1)?smst_1.jsx("fragment",null," exactly ",utils_1.formatCount(r,null==e?void 0:e.configVariables),i(a)):n&&l?smst_1.jsx("text",null," only if condition is met"):n&&!l?smst_1.jsx("fragment",null," until condition is met max ",utils_1.formatCount(null!=r?r:1,null==e?void 0:e.configVariables),i(a)):void 0},assertAssertThen=function(t){throw new Error('Unknown "then" in assert: '+t)},translateAssertThen=function(t){switch(t){case"success":return"continue";case"exit":return"stop test";case"fail":return"fail";case"warning":return"warn";default:return assertAssertThen(t)}},translateAssertTestLine=function(t,e,s,n){var r=condition_1.translateCondition(t.condition,!(!t.then||"success"===(null==t?void 0:t.then)),e,s,n),l=t.excluded?"excluded":null==n?void 0:n.result;return smst_1.jsx("test-line",{title:smst_1.jsx("fragment",null,"Assert: ",r.title,t.timeout?smst_1.jsx("fragment",null," timeout ",utils_1.formatTimeout(t.timeout,null==e?void 0:e.configVariables)):void 0,t.then&&"success"!==t.then?smst_1.jsx("fragment",null," then ",translateAssertThen(t.then)):void 0),status:l},r.children)},translateTakeScreenshotTestLine=function(t,e){var s="";return"raw"===t.dataFormat?s="Take screenshot (raw)":"base64"===t.dataFormat?s="Take screenshot (base64)":t.fileName&&(s='Save screenshot ("'+t.fileName+'")'),smst_1.jsx("test-line",{title:smst_1.jsx("text",null,s),status:null==e?void 0:e.result})},translateClearAppDataTestLine=function(t,e){return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Clear application data"),status:t.excluded?"excluded":null==e?void 0:e.result})},stringifySelector=function(t){return Array.isArray(t)?t.map((function(t){return"|"+stringifySelector(t)+"|"})).join(" -> "):t.video||t.psVideo?"video element":t.active?"active element":t.handle?'element by handle "'+t.handle+'"':"string"==typeof t.linkText?'link with "'+t.linkText+'" text':"string"==typeof t.partialLinkText?'link containing "'+t.partialLinkText+'" text':'"'+Object.values(t).filter(Boolean)[0]+'" element'},translateQueryTestLine=function(t,e){var s="";switch(t.subject.type){case"cookie":s='Retrieve value for "'+t.subject.cookieName+'" cookie';break;case"execute":s='Retrieve value of execution "'+t.subject.execute+'"';break;case"location":s="Retrieve value of current location";break;case"elementProps":s="Retrieve info of "+stringifySelector(t.subject.selector);break;case"elementCssProps":var n=t.subject,r=n.elementCssProps,l=n.selector;s+="Getting ["+r.join(", ")+"] css properties of "+stringifySelector(l);break;case"elementHandle":s+="Getting handle"+(t.subject.multiple?"s":"")+" of "+stringifySelector(t.subject.selector);break;case"elementAttributes":var a=t.subject.attributes;s+="Getting "+(a.length?"["+a.join(", ")+"] attribute"+(a.length>1?"s":""):"all attributes")+" of "+stringifySelector(t.subject.selector);break;default:var i=t.subject;console.warn('Unknown subject "'+JSON.stringify(i)+'" of query line.')}var o="error"===(null==e?void 0:e.result)?"fail":null==e?void 0:e.result;return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,s),status:o})},translateExecuteCommandTestLine=function(t,e,s){return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Execute JavaScript expression"),status:t.excluded?"excluded":null==s?void 0:s.result},smst_1.jsx("props",null,utils_1.translateCodeProp(smst_1.jsx("text",null,"JavaScript expression"),t.val,e,"",utils_1.mapStatus(null==s?void 0:s.result))))},translateOpenApp=function(t,e,s){var n,r=t.excluded?"excluded":null==s?void 0:s.result;if(t.launchMode){var l=null!==(n={resume:"Resume background application",restart:"Restart application"}[t.launchMode])&&void 0!==n?n:"Open application";return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,l),status:r})}if(!t.relativeUrl)return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Open application"),status:r});var a=utils_1.formatVariables(t.relativeUrl,null==e?void 0:e.configVariables);return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Open application at relative URL"),status:r},smst_1.jsx("props",null,smst_1.jsx("prop",{name:smst_1.jsx("text",null,"relative path"),comparator:comparator_1.translateComparator("="),expectedValue:a})))},translateCloseAppTestLine=function(t,e){var s=t.excluded?"excluded":null==e?void 0:e.result;return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Close application"),status:s})},translateSuspendAppTestLine=function(t,e){var s=t.excluded?"excluded":null==e?void 0:e.result;return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Suspend application"),status:s})},translateOpenUrl=function(t,e,s){var n=utils_1.formatVariables(t.url,null==e?void 0:e.configVariables),r=t.excluded?"excluded":null==s?void 0:s.result;return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Open URL"),status:r},smst_1.jsx("props",null,smst_1.jsx("prop",{name:smst_1.jsx("text",null,"URL"),comparator:comparator_1.translateComparator("="),expectedValue:n})))},translateSleepTestLine=function(t,e,s){var n=t.excluded?"excluded":null==s?void 0:s.result,r=smst_1.jsx("fragment",null,"Sleep ",utils_1.formatTimeout(t.timeout,null==e?void 0:e.configVariables));return smst_1.jsx("test-line",{title:r,status:n})},translatePollUrlTestLine=function(t,e,s){var n=utils_1.formatVariables(t.response,null==e?void 0:e.configVariables),r=utils_1.formatVariables(t.url,null==e?void 0:e.configVariables),l=t.excluded?"excluded":null==s?void 0:s.result;return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Poll URL every 0.5s"),status:l},smst_1.jsx("props",null,smst_1.jsx("prop",{name:smst_1.jsx("text",null,"poll URL"),comparator:comparator_1.translateComparator("="),expectedValue:r,status:utils_1.mapStatus(null==s?void 0:s.result)}),smst_1.jsx("prop",{name:smst_1.jsx("text",null,"until receive"),comparator:comparator_1.translateComparator("="),expectedValue:n,status:utils_1.mapStatus(null==s?void 0:s.result)})))},translatePressButtonTestLine=function(t,e,s,n){var r=t.ids.map((function(e,s){return smst_1.jsx("fragment",null,smst_1.jsx("input",null,e),s!==t.ids.length-1?", ":"")})),l=getConditionInfo(t,e),a=t.excluded?"excluded":null==n?void 0:n.result,i=t.longPressMs?smst_1.jsx("fragment",null,"Press long ",r," for ",t.longPressMs,"ms ",l):smst_1.jsx("fragment",null,"Press ",r,l);return smst_1.jsx("test-line",{title:i,status:a},t.condition?condition_1.translateCondition(t.condition,!1,e,s,n):void 0)},translateTestName=function(t,e){return e&&e[t]?smst_1.jsx("subject",null,e[t].name):smst_1.jsx("fragment",null,"(",smst_1.jsx("code",null,t.slice(0,4)+"..."+t.slice(-4)),")")},translateRunTestTestLine=function(t,e,s,n,r){var l=translateTestName(t.val,n),a=getConditionInfo(t,e),i=t.excluded?"excluded":null==r?void 0:r.result;return smst_1.jsx("test-line",{title:smst_1.jsx("fragment",null,"Run test ",l,a),status:i},t.condition?condition_1.translateCondition(t.condition,!1,e,s,r):void 0)},assertUnknownTarget=function(t){throw new Error("Unknown target: "+JSON.stringify(t))},translateTarget=function(t){switch(t.type){case"element":return"val"in t&&t.val.active?smst_1.jsx("subject",null,"active element"):smst_1.jsx("subject",null,"element");case"window":return smst_1.jsx("subject",null,"coordinates"in t?t.relative?"relative position":"position":"window");case"screen":return smst_1.jsx("subject",null,"coordinates"in t?"position":"screen");default:return assertUnknownTarget(t)}},translateSendTextTestLine=function(t,e,s,n){var r=utils_1.formatVariables(t.val,null==e?void 0:e.configVariables),l=t.excluded?"excluded":null==n?void 0:n.result,a=getConditionInfo(t,e),i=smst_1.jsx("fragment",null,"Send text ",r," to ",translateTarget(t.target),a);return smst_1.jsx("test-line",{title:i,status:l},t.condition?condition_1.translateCondition(t.condition,!1,e,s,n):void 0)},translateSetTextTestLine=function(t,e,s,n){var r=utils_1.formatVariables(t.val,null==e?void 0:e.configVariables),l=getConditionInfo(t,e),a=t.excluded?"excluded":null==n?void 0:n.result,i=smst_1.jsx("fragment",null,"Set text ",r," to ",translateTarget(t.target),l);return smst_1.jsx("test-line",{title:i,status:a},t.condition?condition_1.translateCondition(t.condition,!1,e,s,n):void 0)},assertUnknownBrowserCommand=function(t){throw new Error("Unknown browser command: "+JSON.stringify(t))},assertUnknownDeviceSetting=function(t){throw new Error("Unknown device setting: "+JSON.stringify(t))},translateBrowserCommandTestLine=function(t,e,s,n){var r=t.excluded?"excluded":null==n?void 0:n.result,l=t.condition?condition_1.translateCondition(t.condition,!1,e,s,n):void 0;switch(t.browserCommand.type){case"goBack":return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Go back"),status:r},l);case"goForward":return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Go forward"),status:r},l);case"refresh":return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Refresh"),status:r},l);case"setWindowSize":return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Resize window"),status:r},smst_1.jsx("props",null,smst_1.jsx("prop",{name:smst_1.jsx("text",null,"size"),comparator:comparator_1.translateComparator("="),expectedValue:smst_1.jsx("text",null,String(t.browserCommand.params.width),"x",String(t.browserCommand.params.height))})),l);case"dismissAlertMessage":return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Dismiss modal dialog"),status:r},l);case"acceptAlertMessage":return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Accept modal dialog"),status:r},l);case"acceptPromptMessage":return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,"Accept modal dialog with message"),status:r},smst_1.jsx("props",null,smst_1.jsx("prop",{name:smst_1.jsx("text",null,"message"),comparator:comparator_1.translateComparator("="),expectedValue:smst_1.jsx("text",null,t.browserCommand.params.text)})),l);default:return assertUnknownBrowserCommand(t.browserCommand)}},translateDeviceSettingsTestLine=function(t,e,s,n){var r=t.excluded?"excluded":null==n?void 0:n.result,l=t.condition?condition_1.translateCondition(t.condition,!1,e,s,n):void 0;switch(t.deviceSettings.type){case"setOrientation":var a=utils_1.deviceOrientationsMap[t.deviceSettings.params.orientation];return smst_1.jsx("test-line",{title:smst_1.jsx("fragment",null,"Set screen orientation to ",smst_1.jsx("input",null,a)),status:r},l);default:return assertUnknownDeviceSetting(t.deviceSettings.type)}},translateClickTestLine=function(t,e,s,n){var r=getConditionInfo(t,e),l=smst_1.jsx("fragment",null,"Click on ",translateTarget(t.target),r),a=t.excluded?"excluded":null==n?void 0:n.result;return smst_1.jsx("test-line",{title:l,status:a},t.condition?condition_1.translateCondition(t.condition,!1,e,s,n):void 0)},translateTapTestLine=function(t,e,s,n){var r=getConditionInfo(t,e),l=__read(t.taps,1)[0],a=l.type,i=l.duration,o=a.charAt(0).toUpperCase()+a.slice(1),u=smst_1.jsx("fragment",null,o," tap on ",translateTarget(t.target),void 0!==i?smst_1.jsx("fragment",null," for ",utils_1.formatTimeout(i,null==e?void 0:e.configVariables)):void 0,r),c=t.excluded?"excluded":null==n?void 0:n.result;return smst_1.jsx("test-line",{title:u,status:c},t.condition?condition_1.translateCondition(t.condition,!1,e,s,n):void 0)},translateScrollTestLine=function(t,e,s,n){var r=getConditionInfo(t,e),l=t.scroll[0].direction,a=t.scroll[0].distance,i=smst_1.jsx("fragment",null,"Scroll from ",translateTarget(t.target),r," ",l,["string","number"].includes(typeof a)?" by "+a+"px":""),o=t.excluded?"excluded":null==n?void 0:n.result;return smst_1.jsx("test-line",{title:i,status:o},t.condition?condition_1.translateCondition(t.condition,!1,e,s,n):void 0)},translateSwipeTestLine=function(t,e,s,n){var r=getConditionInfo(t,e),l=t.swipe[0].direction,a=t.swipe[0].distance,i=t.swipe[0].duration,o=smst_1.jsx("fragment",null,"Swipe/Flick from ",translateTarget(t.target),r," ",l," by ",a,"px in ",i,"ms"),u=t.excluded?"excluded":null==n?void 0:n.result;return smst_1.jsx("test-line",{title:o,status:u},t.condition?condition_1.translateCondition(t.condition,!1,e,s,n):void 0)},translateMoveToTestLine=function(t,e,s,n){var r=getConditionInfo(t,e),l=smst_1.jsx("fragment",null,"Move pointer to ",translateTarget(t.target),r),a=t.excluded?"excluded":null==n?void 0:n.result;return smst_1.jsx("test-line",{title:l,status:a},t.condition?condition_1.translateCondition(t.condition,!1,e,s,n):void 0)},translateCommentTestLine=function(t){return smst_1.jsx("test-line",{title:smst_1.jsx("text",null,t.val.split("\n").map((function(t){return!!t.trim()&&"# "+t})).filter(Boolean).join("\n"))})},assertUnknownLineType=function(t){throw new Error("Unknown line type: "+JSON.stringify(t))};exports.translateTestLine=function(t){var e=t.testLine,s=t.appConfig,n=t.elements,r=t.snippets,l=t.lineResult;switch(e.type){case"query":return translateQueryTestLine(e,l);case"assert":case"wait":return translateAssertTestLine(e,s,n,l);case"takeScreenshot":return translateTakeScreenshotTestLine(e,l);case"clearAppData":return translateClearAppDataTestLine(e,l);case"execCmd":return translateExecuteCommandTestLine(e,s,l);case"openApp":return translateOpenApp(e,s,l);case"openUrl":return translateOpenUrl(e,s,l);case"sleep":return translateSleepTestLine(e,s,l);case"pollUrl":return translatePollUrlTestLine(e,s,l);case"button":return translatePressButtonTestLine(e,s,n,l);case"runSnippet":return translateRunTestTestLine(e,s,n,r,l);case"sendText":return translateSendTextTestLine(e,s,n,l);case"setText":return translateSetTextTestLine(e,s,n,l);case"browserCommand":return translateBrowserCommandTestLine(e,s,n,l);case"deviceSettings":return translateDeviceSettingsTestLine(e,s,n,l);case"click":return translateClickTestLine(e,s,n,l);case"tap":return translateTapTestLine(e,s,n,l);case"scroll":return translateScrollTestLine(e,s,n,l);case"swipe":return translateSwipeTestLine(e,s,n,l);case"moveTo":return translateMoveToTestLine(e,s,n,l);case"closeApp":return translateCloseAppTestLine(e,l);case"suspendApp":return translateSuspendAppTestLine(e,l);case"comment":return translateCommentTestLine(e);default:return assertUnknownLineType(e)}}; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.translateTestLineResult=exports.translateResultErrorMessage=void 0;var smst_1=require("@suitest/smst"),testLine_1=require("./testLine"),condition_1=require("./condition"),utils_1=require("./utils"),baseScreenshotPath="https://the.suite.st",conditionWasMetMessage=smst_1.jsx("text",null,"Condition was met"),conditionWasNotMetMessage=smst_1.jsx("text",null,"Condition was not met"),simpleErrorMap={failedStart:smst_1.jsx("text",null,"Failed to open application"),appRunning:smst_1.jsx("text",null,"App is still running"),appNotRunning:smst_1.jsx("text",null,"App is not running"),missingApp:smst_1.jsx("text",null,"Application is not installed on the device"),initPlatformFailed:smst_1.jsx("text",null,"Failed to bootstrap platform on this device"),packageNotFound:smst_1.jsx("text",null,"Selected configuration does not contain an app package. Upload a package on your app`s configuration page before continuing"),missingPackage:smst_1.jsx("text",null,"Application package was not found on the target device"),internalError:smst_1.jsx("text",null,"Internal error occurred"),serverError:smst_1.jsx("text",null,"Internal error occurred"),ILInternalError:smst_1.jsx("text",null,"Internal error occurred"),invalidCredentials:smst_1.jsx("text",null,"Credentials for this device were changed"),ActionNotAvailable:smst_1.jsx("text",null,"This test command is not supported by the current app configuration"),conditionNotSatisfied:smst_1.jsx("text",null,"Maximum amount of key presses reached. Condition was not satisfied"),wrongApp:smst_1.jsx("text",null,"Wrong app ID detected"),driverException:smst_1.jsx("text",null,"Unexpected exception occurred on connected device. Please, contact support@suite.st if you see this often"),noHasLines:smst_1.jsx("text",null,"No assertion properties defined"),appCrashed:smst_1.jsx("text",null,"App seems to have crashed"),timeLimitExceeded:smst_1.jsx("text",null,"Test execution limit exceeded (based on your subscription)"),notResponding:smst_1.jsx("text",null,"Device stopped responding"),suitestifyError:smst_1.jsx("text",null,"Suitestify failed to start. Check your Suitestify settings"),suitestifyRequired:smst_1.jsx("text",null,"This assertion only works with Suitestify. You can configure your app to use Suitestify in the app settings. Please note that Suitestify is not available for all platforms"),bootstrapPageNotDetected:smst_1.jsx("text",null,"App seems to have exited correctly but something went wrong when loading the Suitest channel autostart application"),wrongAppDetected:smst_1.jsx("text",null,"App seems to have exited correctly, however another app has been opened"),notExpectedResponse:smst_1.jsx("text",null,"Unexpected response received while polling URL"),noConnection:smst_1.jsx("text",null,"Could not connect to server while polling URL"),lateManualLaunch:smst_1.jsx("text",null,'In this configuration the "open app" commands inside the test are not supported. You may however start the test with "open app" command'),launchExpired:smst_1.jsx("text",null,"Identical scheduling aborted"),deviceIsBusy:smst_1.jsx("text",null,"Identical scheduling aborted"),notActiveDeveloperMode:smst_1.jsx("text",null,'Failed to launch application. Is "developer mode" turned on? https://suite.st/docs/devices/lg-webos/#enable-developer-mode-on-the-device'),invalidUrl:smst_1.jsx("text",null,"Application could not be launched. Please verify you have provided URL for this configuration"),invalidOpenAppOverrideReference:smst_1.jsx("text",null,"Could not start execution, please check open app override setting. https://suite.st/docs/application/more-configuration-options/#open-app-override-test"),Success:smst_1.jsx("text",null,"Command executed successfully"),NoSuchElement:smst_1.jsx("text",null,"Element was not found"),NoSuchFrame:smst_1.jsx("text",null,"Cannot switch to frame"),UnknownCommand:smst_1.jsx("text",null,"The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource"),StaleElementReference:smst_1.jsx("text",null,"Element is no longer inside DOM"),ElementNotVisible:smst_1.jsx("text",null,"Element is not currently visible"),InvalidElementState:smst_1.jsx("text",null,"Cannot perform operation with element because this element is in an invalid state (e.g. attempting to click a disabled element)"),ElementIsNotSelectable:smst_1.jsx("text",null,"Element is not selectable"),UnknownError:smst_1.jsx("text",null,"An unknown server-side error occurred while processing the command"),XPathLookupError:smst_1.jsx("text",null,"An error occurred while searching for an element by XPath"),Timeout:smst_1.jsx("text",null,"This command takes too long to execute"),NoSuchWindow:smst_1.jsx("text",null,"A request to switch to a different window could not be satisfied because the window could not be found"),InvalidCookieDomain:smst_1.jsx("text",null,"Cannot set a cookie on a domain different from the current page"),UnableToSetCookie:smst_1.jsx("text",null,"Cannot set the specified cookie value"),UnexpectedAlertOpen:smst_1.jsx("text",null,"A modal dialog was open, blocking this operation"),NoAlertOpenError:smst_1.jsx("text",null,"There was no modal dialog on page"),ScriptTimeout:smst_1.jsx("text",null,"A script takes too long to execute"),InvalidElementCoordinates:smst_1.jsx("text",null,"The coordinates provided to an interactions operation are invalid"),IMENotAvailable:smst_1.jsx("text",null,"IME was not available"),IMEEngineActivationFailed:smst_1.jsx("text",null,"An IME engine could not be started"),InvalidSelector:smst_1.jsx("text",null,"Element selector is malformed"),ElementNotInteractable:smst_1.jsx("text",null,"Element is not currently interactable and may not be manipulated"),JavaScriptError:smst_1.jsx("text",null,"An error occurred while executing user supplied JavaScript"),unknownWebDriverKey:smst_1.jsx("text",null,"This key is not supported on the target device"),unfocusableElement:smst_1.jsx("text",null,"Element can't receive focus to enter text"),unclickableElement:smst_1.jsx("text",null,"Element click is obstructed by different element"),deviceConnectionError:smst_1.jsx("text",null,"Failed to initialize device control"),controllerNotConnected:smst_1.jsx("text",null,"Please check that all corresponding control units are working."),appOnBackgroundError:smst_1.jsx("text",null,"Cannot process line, application is not active"),testIsNotStarted:smst_1.jsx("text",null,"Cannot continue with the current test anymore because of previous errors or bad initialization"),signInRequired:smst_1.jsx("text",null,"Account needs to be signed in on target device"),connectionNotAuthorized:smst_1.jsx("text",null,"Connection not authorized. Debug mode is not allowed on the device, please make sure it is enabled"),higherOSVersionRequired:smst_1.jsx("text",null,"The app package requires higher OS version"),appleError65:smst_1.jsx("text",null,"Failed to launch app: Apple ID account error. https://suite.st/docs/devices/apple-tv/#apple-id-account-error"),appleError70:smst_1.jsx("text",null,"Failed to launch app: Xcode error. https://suite.st/docs/devices/apple-tv/#xcode-error"),appleAppSignError:smst_1.jsx("text",null,"Failed to launch app: App code sign error. https://suite.st/docs/devices/apple-tv/#app-code-sign-error"),missingPSSDK:smst_1.jsx("text",null,"Please make sure that you have the PlayStation SDK installed"),packageInstallationFailed:smst_1.jsx("text",null,"Application installation on the device failed"),targetManagerBusy:smst_1.jsx("text",null,"Device is busy, please try again later. Open Neighborhood (PS4) or Target Manager (PS5) app for more details"),missingDotNet:smst_1.jsx("text",null,"Please make sure you have the .NET Framework installed. https://suite.st/docs/troubleshooting/playstation/#net-framework-not-installed"),bootstrapAppNotDetected:smst_1.jsx("text",null,"The Suitest bootstrap application was not detected"),activationExpired:smst_1.jsx("text",null,"Could not open the app because the DevKit/TestKit expired"),missingCpp:smst_1.jsx("text",null,"Make sure you have Microsoft Visual C++ Redistributable installed. https://suite.st/docs/devices/playstation"),outOfMemory:smst_1.jsx("text",null,"Failed to open the app. Device is out of memory, please restart the device"),networkError:smst_1.jsx("text",null,"Network request matching given conditions was not made. https://suite.st/docs/faq/surprises/#network-request-condition-never-matches"),instrumentationFailed:smst_1.jsx("text",null,"Suitest was unable to automatically insert the instrumentation library"),packageCorrupted:smst_1.jsx("text",null,"Failed to open the app. Please make sure that your app is working correctly"),unknownElementProperty:smst_1.jsx("text",null,"Unknown element property"),configuratorError:smst_1.jsx("text",null,"Make sure that Apple Configurator 2 and Automation Tools are installed. https://suite.st/docs/devices/apple-tv/#installing-apple-configurator-2"),appleNetworkLogsError:smst_1.jsx("text",null,"SuitestDrive can't launch NetworkLog service on Mac"),appStoreBuild:smst_1.jsx("text",null,"Can’t install App Store distribution build"),outdatedLibraryWarning:smst_1.jsx("text",null,"We have detected that your instrumentation library is outdated, the package can still be opened. Consider updating"),cyclicReference:smst_1.jsx("text",null,"Cyclic reference detected"),ioError:smst_1.jsx("fragment",null,"Problem with storing data. Please check that there is enough disk space and that permissions are not limited. Contact ",smst_1.jsx("link",{href:"mailto:support@suite.st"},"support")," if problem persists"),netError:smst_1.jsx("fragment",null,"Downloading of the driver failed, please check your internet connection and try again later. Contact ",smst_1.jsx("link",{href:"mailto:support@suite.st"},"support")," if problem persists"),sdComponentFailed:smst_1.jsx("fragment",null,"Downloading of the driver failed, please try again later. Contact ",smst_1.jsx("link",{href:"mailto:support@suite.st"},"support")," if problem persists"),MoveTargetOutOfBounds:smst_1.jsx("text",null,"Move target is outside of the visible area of the screen"),ElementClickIntercepted:smst_1.jsx("text",null,"Click on the element was intercepted by another element"),unsupportedOSVersion:smst_1.jsx("fragment",null,"Unsupported OS version, please see our ",smst_1.jsx("link",{href:"https://suite.st/docs/devices/playstation/#sdk-650-or-system-software-701-or-lower"},"docs")),targetManagerUnsupportedVersion:smst_1.jsx("fragment",null,"Unsupported Target Manager Server, please see our ",smst_1.jsx("link",{href:"https://suite.st/docs/devices/playstation/#sdk-650-or-system-software-701-or-lower"},"docs")),systemOutdated:smst_1.jsx("text",null,"System software version mismatch. New version of system software is required"),noSpaceLeftOnDevice:smst_1.jsx("text",null,"App installation failed. No space left on the device."),invalidDeveloperIP:smst_1.jsx("fragment",null,"Host PC IP does not match control unit IP, please see our ",smst_1.jsx("link",{href:"https://suite.st/docs/devices/samsung-tizen/#set-up-developer-ip-on-the-target-device"},"docs"),"."),instrumentationFailedPrivilege:smst_1.jsx("text",null,"Auto-instrumentation works for app packages with public or partner privileges only. Please use manual instrumentation instead"),releaseMode:smst_1.jsx("text",null,"Device is in the Release Mode, please switch it to the Assist Mode (Debug Settings / Boot Parameters / Release Check Mode)"),unsupportedPatchPackage:smst_1.jsx("text",null,"Patch package is not supported. You need to use a fully standalone application package"),deviceLabException:smst_1.jsx("text",null,"Suitest device lab - you do not have permission for this action under the current circumstances")},translateQueryFailedResults=function(e){switch(e.message.code){case"invalidApp":return smst_1.jsx("text",null,"Wrong app ID detected");case"applicationError":return smst_1.jsx("text",null,"Application thrown unexpected error while executing command");case"missingSubject":return smst_1.jsx("text",null,"Subject does not exist");case"existingSubject":return smst_1.jsx("text",null,"Subject exists");case"orderErr":return smst_1.jsx("text",null,"Suitest instrumentation library should be placed as the first script in your HTML file. Loading the instrumentation library dynamically or after other scripts have loaded may cause many unusual errors");case"updateAlert":return smst_1.jsx("text",null,"Suitest instrumentation library is outdated. Please download and install the newest version");case"wrongExpression":return smst_1.jsx("text",null,"Wrong expression");case"notFunction":return smst_1.jsx("text",null,"Specified code is not a function");case"psImplicitVideo":return smst_1.jsx("text",null,'The "video" subject on the PlayStation platform is inconsistent, we recommend using the "native video" or "element" subject instead');case"exprException":return smst_1.jsx("text",null,'Exception was thrown: "',e.message.info.exception,'"');case"invalidUrl":var t=e;return smst_1.jsx("text",null,"App loaded ",t.actualValue," instead of the expected ",t.expectedValue,". Consider updating the app URL in settings");default:var s=e.message;console.warn("queryFailed message was not handled",JSON.stringify(s))}return conditionWasNotMetMessage},translateInvalidInputError=function(e){var t=smst_1.jsx("text",null,"Test command received invalid input"),s="message"in e?e.message:void 0;if(!s)return t;switch(s.code){case"lineTypeNotSupported":return smst_1.jsx("text",null,"This test command is not supported by the current app configuration");case"elementNotSupported":return smst_1.jsx("text",null,"This test command is unsupported by this element");case"wrongExpression":return t;case"wrongDirection":return smst_1.jsx("fragment",null,"Invalid direction. See ",smst_1.jsx("link",{href:"https://suite.st/docs/suitest-api/test-operations/#scroll"},"our docs")," for more information");default:var n=s.code;console.warn("invalidInput code was not handled",JSON.stringify(n))}return t},translateSyntaxError=function(e){var t,s=smst_1.jsx("text",null,"Test command received invalid input");if(!(null===(t=e.message)||void 0===t?void 0:t.code))return s;switch(e.message.code){case"wrongBody":return smst_1.jsx("text",null,"Body field value is exceeding 4KB limit");case"WrongDelay":return smst_1.jsx("text",null,"Test command received invalid input. Delay value is invalid");case"wrongUrl":return smst_1.jsx("text",null,"This does not look like a valid URL");default:var n=e.message.code;console.warn("syntaxError message was not handled",JSON.stringify(n))}return s},translateQueryTimeoutError=function(e){var t=smst_1.jsx("text",null,"Application did not respond for 60 seconds");if(!e.message)return t;switch(e.message.code){case"missingIlResponse":var s=e.message.info.timeout/1e3;return smst_1.jsx("text",null,"The wait time exceeded ",String(s)," ",1===s?"second":"seconds");default:var n=e.message.code;console.warn("queryTimeout message was not handled",JSON.stringify(n))}return t},translateDeviceError=function(e){var t=e.message;return"unsupportedSelector"===t.code&&"xpathNotSupported"===t.info.reason?smst_1.jsx("text",null,"Element cannot be found, because this device does not support XPath lookups"):"deviceFailure"===t.code&&"cssSelectorInvalid"===t.info.reason?smst_1.jsx("text",null,"CSS selector is invalid"):"deviceFailure"===t.code&&"xpathNotValid"===t.info.reason?smst_1.jsx("text",null,"XPath selector is invalid"):["videoAdapterInvalidOutput","videoAdapterNotFunction","videoAdapterThrownError"].includes(t.code)?smst_1.jsx("text",null,"Video adapter error: ",t.info.reason):simpleErrorMap.internalError},translateUnsupportedButtonError=function(e){var t,s=null===(t=e.message)||void 0===t?void 0:t.info.buttonIds;return s?smst_1.jsx("text",null,"Specified buttons are not supported on this device: [",s.join(", "),"]"):smst_1.jsx("text",null,"Specified buttons are not supported on this device")},translateAbortedError=function(e){var t;return"manualActionRequired"===(null===(t=e.message)||void 0===t?void 0:t.info.reason)?smst_1.jsx("text",null,"Manual actions are not supported"):smst_1.jsx("text",null,"Test execution was aborted")},translateInvalidVariableError=function(e){var t,s,n=null!==(s=null===(t=e.args)||void 0===t?void 0:t.variables)&&void 0!==s?s:[];if(0===n.length)return smst_1.jsx("text",null,"Variable is not defined in the app configuration");var r=n.join(", ");return smst_1.jsx("text",null,1===n.length?"Variable "+r+" is":"Variables "+r+" are"," not defined in the app configuration")},translateInvalidValueError=function(e){var t;return(null===(t=e.args)||void 0===t?void 0:t.propertyName)?smst_1.jsx("text",null,"Invalid value provided for ",e.args.propertyName):smst_1.jsx("text",null,"Invalid value provided")},translateInvalidResultError=function(e){var t,s=smst_1.jsx("text",null,"Unexpected response received");if(!(null===(t=e.message)||void 0===t?void 0:t.code))return s;switch(e.message.code){case"resultTooLong":return smst_1.jsx("text",null,"Response exceeded the size limit of 4KB");default:var n=e.message.code;console.warn("invalidResult code was not handled",JSON.stringify(n))}return s},translateOpenAppOverrideFailedError=function(){return smst_1.jsx("text",null,"Open app override failed")},translateInvalidReferenceError=function(e){var t="Could not start execution because";return"snippetLineNumber"in e?smst_1.jsx("text",null,t,' "Run Test" command refers to non-existing test or referred test has it\'s own references to non-existing tests'):smst_1.jsx("text",null,t,' test definition contains "Run Test" lines that refer to non-existing test')},translateADBError=function(e){return e.message&&"code"in e.message&&"certificateError"===e.message.code?smst_1.jsx("text",null,e.message.code):e.message&&"code"in e.message&&"installationRestricted"===e.message.code?smst_1.jsx("fragment",null,"Application installation is forbidden. See ",smst_1.jsx("link",{href:"https://suite.st/docs/troubleshooting/android/#application-installation-is-forbidden-on-xiaomi"},"our docs")," for more information"):e.message&&"info"in e.message?smst_1.jsx("text",null,e.message.info.reason):smst_1.jsx("text",null,"ADB communication with the device has failed. Make sure your device is set up correctly and it can be connected to using ADB")},translateInvalidPackageError=function(e){var t,s=smst_1.jsx("text",null,"Package cannot be launched on simulator device");if(!(null===(t=e.message)||void 0===t?void 0:t.code))return s;switch(e.message.code){case"appleTvDevicePackageOnSim":return smst_1.jsx("text",null,"An Apple TV app package cannot be launched on simulator device");case"appleTvSimPackageOnDevice":return smst_1.jsx("text",null,"An Apple TV app simulator package cannot be launched on real device");default:var n=e.message.code;return console.warn("invalidPackage code was not handled",JSON.stringify(n)),s}},translateOutdatedLibraryError=function(e){var t=smst_1.jsx("text",null,"We have detected that your instrumentation library is outdated");switch(e.message.code){case"major":return smst_1.jsx("text",null,"We have detected that your instrumentation library is outdated and the package cannot be opened. Update required");case"minor":return smst_1.jsx("text",null,"We have detected that your instrumentation library is outdated, the package can still be opened. Consider updating")}return t},translateInvalidRepositoryReference=function(e){var t="Element was not found in the repository";if(e.message)switch(e.message.code){case"notExistingElement":break;case"notExistingPlatform":t="Element is not defined for the selected platform";break;case"unknownProperty":t="Element does not support property "+condition_1.translateElementProperty(e.message.property);break;default:var s=e.message;console.warn("invalidRepositoryReference unknown message: ",JSON.stringify(s))}return smst_1.jsx("text",null,t)},translateNotAllowedPrivileges=function(e){return smst_1.jsx("fragment",null,"Application requires privileges not allowed on Suitest lab devices (",e.message.notAllowedPrivileges.join(", "),"). Read more in our ",smst_1.jsx("link",{href:"https://suite.st/docs/devices/device-lab"},"docs"),".")},isSimpleErrorResult=function(e){return e.errorType in simpleErrorMap},unknownErrorMessage=function(e){return console.warn("Error message not implemented for: "+JSON.stringify(e)+". Make sure you are using the latest version of the @suitest/translate library."),smst_1.jsx("text",null,"Unknown error occurred")};exports.translateResultErrorMessage=function(e){if(isSimpleErrorResult(e))return simpleErrorMap[e.errorType];switch(e.errorType){case"queryFailed":return"message"in e?translateQueryFailedResults(e):conditionWasNotMetMessage;case"invalidInput":return translateInvalidInputError(e);case"syntaxError":return translateSyntaxError(e);case"queryTimeout":return translateQueryTimeoutError(e);case"deviceError":return translateDeviceError(e);case"unsupportedButton":case"illegalButton":return translateUnsupportedButtonError(e);case"aborted":return translateAbortedError(e);case"invalidVariable":return translateInvalidVariableError(e);case"invalidValue":return translateInvalidValueError(e);case"invalidResult":return translateInvalidResultError(e);case"openAppOverrideFailed":return translateOpenAppOverrideFailedError();case"invalidReference":return translateInvalidReferenceError(e);case"adbError":return translateADBError(e);case"invalidPackage":return translateInvalidPackageError(e);case"outdatedLibrary":case"outdatedLibraryConnected":return translateOutdatedLibraryError(e);case"invalidRepositoryReference":return translateInvalidRepositoryReference(e);case"notAllowedPrivileges":return translateNotAllowedPrivileges(e);default:return unknownErrorMessage(e)}};var getScreenshotUrl=function(e){return e?baseScreenshotPath+e:void 0},getInvertedResultMessage=function(e,t){if(!(!t||"assert"!==e.type&&"wait"!==e.type||!("then"in e)||"success"===e.then||t.errorType&&"queryFailed"!==t.errorType&&"appRunning"!==t.errorType))return t.result===e.then?conditionWasMetMessage:conditionWasNotMetMessage},getQueryLineError=function(e,t){var s="";if("notExistingElement"===t.error)s="Element was not found in the repository";else if(!1===t.elementExists)s="Element was not found";else if(t.cookieExists)s="Cookie was not found";else if(t.executeThrowException)s='Execution thrown exception "'+t.executeExceptionMessage+'}"';else if(t.errorMessage)s=t.errorMessage;else switch(s="Error occurred while ",e.subject.type){case"execute":s+="executing script on device";break;case"cookie":s+="retrieving cookie";break;case"elementProps":s+="retrieving element";break;case"location":s+="retrieving current location"}return smst_1.jsx("text",null,s)},getLineResultMessage=function(e,t){var s;if("query"===(null===(s=t)||void 0===s?void 0:s.contentType))return getQueryLineError(e,t);var n=getInvertedResultMessage(e,t);if(n)return n;if(t&&"success"!==t.result){if("excluded"===t.result)return smst_1.jsx("text",null,"Line was not executed");if("aborted"===t.result)return smst_1.jsx("text",null,"Execution was aborted.");if("runSnippet"!==e.type||t.errorType)return exports.translateResultErrorMessage(t)}};exports.translateTestLineResult=function(e){var t,s,n,r=e.lineResult,o=e.testLine,i=utils_1.getDocsLink(o);return r&&"contentType"in r&&"query"===r.contentType?smst_1.jsx("test-line-result",{status:"fail",message:getLineResultMessage(e.testLine,r),docs:i},testLine_1.translateTestLine(e)):smst_1.jsx("test-line-result",{status:null!==(s=null===(t=r)||void 0===t?void 0:t.result)&&void 0!==s?s:"success",message:getLineResultMessage(e.testLine,r),screenshot:getScreenshotUrl(null===(n=r)||void 0===n?void 0:n.screenshot),docs:i},testLine_1.translateTestLine(e))}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.translateTestLineResult=exports.translateResultErrorMessage=void 0;var smst_1=require("@suitest/smst"),testLine_1=require("./testLine"),condition_1=require("./condition"),utils_1=require("./utils"),baseScreenshotPath="https://the.suite.st",conditionWasMetMessage=smst_1.jsx("text",null,"Condition was met"),conditionWasNotMetMessage=smst_1.jsx("text",null,"Condition was not met"),simpleErrorMap={failedStart:smst_1.jsx("text",null,"Failed to open application"),appRunning:smst_1.jsx("text",null,"App is still running"),appNotRunning:smst_1.jsx("text",null,"App is not running"),missingApp:smst_1.jsx("text",null,"Application is not installed on the device"),initPlatformFailed:smst_1.jsx("text",null,"Failed to bootstrap platform on this device"),packageNotFound:smst_1.jsx("text",null,"Selected configuration does not contain an app package. Upload a package on your app`s configuration page before continuing"),missingPackage:smst_1.jsx("text",null,"Application package was not found on the target device"),internalError:smst_1.jsx("text",null,"Internal error occurred"),serverError:smst_1.jsx("text",null,"Internal error occurred"),ILInternalError:smst_1.jsx("text",null,"Internal error occurred"),invalidCredentials:smst_1.jsx("text",null,"Credentials for this device were changed"),ActionNotAvailable:smst_1.jsx("text",null,"This test command is not supported by the current app configuration"),conditionNotSatisfied:smst_1.jsx("text",null,"Maximum amount of key presses reached. Condition was not satisfied"),wrongApp:smst_1.jsx("text",null,"Wrong app ID detected"),driverException:smst_1.jsx("text",null,"Unexpected exception occurred on connected device. Please, contact support@suite.st if you see this often"),noHasLines:smst_1.jsx("text",null,"No assertion properties defined"),appCrashed:smst_1.jsx("text",null,"App seems to have crashed"),timeLimitExceeded:smst_1.jsx("text",null,"Test execution limit exceeded (based on your subscription)"),notResponding:smst_1.jsx("text",null,"Device stopped responding"),suitestifyError:smst_1.jsx("text",null,"Suitestify failed to start. Check your Suitestify settings"),suitestifyRequired:smst_1.jsx("text",null,"This assertion only works with Suitestify. You can configure your app to use Suitestify in the app settings. Please note that Suitestify is not available for all platforms"),bootstrapPageNotDetected:smst_1.jsx("text",null,"App seems to have exited correctly but something went wrong when loading the Suitest channel autostart application"),wrongAppDetected:smst_1.jsx("text",null,"App seems to have exited correctly, however another app has been opened"),notExpectedResponse:smst_1.jsx("text",null,"Unexpected response received while polling URL"),noConnection:smst_1.jsx("text",null,"Could not connect to server while polling URL"),lateManualLaunch:smst_1.jsx("text",null,'In this configuration the "open app" commands inside the test are not supported. You may however start the test with "open app" command'),launchExpired:smst_1.jsx("text",null,"Identical scheduling aborted"),deviceIsBusy:smst_1.jsx("text",null,"Identical scheduling aborted"),notActiveDeveloperMode:smst_1.jsx("text",null,'Failed to launch application. Is "developer mode" turned on? https://suite.st/docs/devices/lg-webos/#enable-developer-mode-on-the-device'),invalidUrl:smst_1.jsx("text",null,"Application could not be launched. Please verify you have provided URL for this configuration"),invalidOpenAppOverrideReference:smst_1.jsx("text",null,"Could not start execution, please check open app override setting. https://suite.st/docs/application/more-configuration-options/#open-app-override-test"),Success:smst_1.jsx("text",null,"Command executed successfully"),NoSuchElement:smst_1.jsx("text",null,"Element was not found"),NoSuchFrame:smst_1.jsx("text",null,"Cannot switch to frame"),UnknownCommand:smst_1.jsx("text",null,"The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource"),StaleElementReference:smst_1.jsx("text",null,"Element is no longer inside DOM"),ElementNotVisible:smst_1.jsx("text",null,"Element is not currently visible"),InvalidElementState:smst_1.jsx("text",null,"Cannot perform operation with element because this element is in an invalid state (e.g. attempting to click a disabled element)"),ElementIsNotSelectable:smst_1.jsx("text",null,"Element is not selectable"),UnknownError:smst_1.jsx("text",null,"An unknown server-side error occurred while processing the command"),XPathLookupError:smst_1.jsx("text",null,"An error occurred while searching for an element by XPath"),Timeout:smst_1.jsx("text",null,"This command takes too long to execute"),NoSuchWindow:smst_1.jsx("text",null,"A request to switch to a different window could not be satisfied because the window could not be found"),InvalidCookieDomain:smst_1.jsx("text",null,"Cannot set a cookie on a domain different from the current page"),UnableToSetCookie:smst_1.jsx("text",null,"Cannot set the specified cookie value"),UnexpectedAlertOpen:smst_1.jsx("text",null,"A modal dialog was open, blocking this operation"),NoAlertOpenError:smst_1.jsx("text",null,"There was no modal dialog on page"),ScriptTimeout:smst_1.jsx("text",null,"A script takes too long to execute"),InvalidElementCoordinates:smst_1.jsx("text",null,"The coordinates provided to an interactions operation are invalid"),IMENotAvailable:smst_1.jsx("text",null,"IME was not available"),IMEEngineActivationFailed:smst_1.jsx("text",null,"An IME engine could not be started"),InvalidSelector:smst_1.jsx("text",null,"Element selector is malformed"),ElementNotInteractable:smst_1.jsx("text",null,"Element is not currently interactable and may not be manipulated"),JavaScriptError:smst_1.jsx("text",null,"An error occurred while executing user supplied JavaScript"),unknownWebDriverKey:smst_1.jsx("text",null,"This key is not supported on the target device"),unfocusableElement:smst_1.jsx("text",null,"Element can't receive focus to enter text"),unclickableElement:smst_1.jsx("text",null,"Element click is obstructed by different element"),deviceConnectionError:smst_1.jsx("text",null,"Failed to initialize device control"),controllerNotConnected:smst_1.jsx("text",null,"Please check that all corresponding control units are working."),appOnBackgroundError:smst_1.jsx("text",null,"Cannot process line, application is not active"),testIsNotStarted:smst_1.jsx("text",null,"Cannot continue with the current test anymore because of previous errors or bad initialization"),signInRequired:smst_1.jsx("text",null,"Account needs to be signed in on target device"),connectionNotAuthorized:smst_1.jsx("text",null,"Connection not authorized. Debug mode is not allowed on the device, please make sure it is enabled"),higherOSVersionRequired:smst_1.jsx("text",null,"The app package requires higher OS version"),appleError65:smst_1.jsx("text",null,"Failed to launch app: Apple ID account error. https://suite.st/docs/devices/apple-tv/#apple-id-account-error"),appleError70:smst_1.jsx("text",null,"Failed to launch app: Xcode error. https://suite.st/docs/devices/apple-tv/#xcode-error"),appleAppSignError:smst_1.jsx("text",null,"Failed to launch app: App code sign error. https://suite.st/docs/devices/apple-tv/#app-code-sign-error"),missingPSSDK:smst_1.jsx("text",null,"Please make sure that you have the PlayStation SDK installed"),packageInstallationFailed:smst_1.jsx("text",null,"Application installation on the device failed"),targetManagerBusy:smst_1.jsx("text",null,"Device is busy, please try again later. Open Neighborhood (PS4) or Target Manager (PS5) app for more details"),missingDotNet:smst_1.jsx("text",null,"Please make sure you have the .NET Framework installed. https://suite.st/docs/troubleshooting/playstation/#net-framework-not-installed"),bootstrapAppNotDetected:smst_1.jsx("text",null,"The Suitest bootstrap application was not detected"),activationExpired:smst_1.jsx("text",null,"Could not open the app because the DevKit/TestKit expired"),missingCpp:smst_1.jsx("text",null,"Make sure you have Microsoft Visual C++ Redistributable installed. https://suite.st/docs/devices/playstation"),outOfMemory:smst_1.jsx("text",null,"Failed to open the app. Device is out of memory, please restart the device"),networkError:smst_1.jsx("text",null,"Network request matching given conditions was not made. https://suite.st/docs/faq/surprises/#network-request-condition-never-matches"),instrumentationFailed:smst_1.jsx("text",null,"Suitest was unable to automatically insert the instrumentation library"),packageCorrupted:smst_1.jsx("text",null,"Failed to open the app. Please make sure that your app is working correctly"),unknownElementProperty:smst_1.jsx("text",null,"Unknown element property"),configuratorError:smst_1.jsx("text",null,"Make sure that Apple Configurator 2 and Automation Tools are installed. https://suite.st/docs/devices/apple-tv/#installing-apple-configurator-2"),appleNetworkLogsError:smst_1.jsx("text",null,"SuitestDrive can't launch NetworkLog service on Mac"),appStoreBuild:smst_1.jsx("text",null,"Can’t install App Store distribution build"),outdatedLibraryWarning:smst_1.jsx("text",null,"We have detected that your instrumentation library is outdated, the package can still be opened. Consider updating"),cyclicReference:smst_1.jsx("text",null,"Cyclic reference detected"),ioError:smst_1.jsx("fragment",null,"Problem with storing data. Please check that there is enough disk space and that permissions are not limited. Contact ",smst_1.jsx("link",{href:"mailto:support@suite.st"},"support")," if problem persists"),netError:smst_1.jsx("fragment",null,"Downloading of the driver failed, please check your internet connection and try again later. Contact ",smst_1.jsx("link",{href:"mailto:support@suite.st"},"support")," if problem persists"),sdComponentFailed:smst_1.jsx("fragment",null,"Downloading of the driver failed, please try again later. Contact ",smst_1.jsx("link",{href:"mailto:support@suite.st"},"support")," if problem persists"),MoveTargetOutOfBounds:smst_1.jsx("text",null,"Move target is outside of the visible area of the screen"),ElementClickIntercepted:smst_1.jsx("text",null,"Click on the element was intercepted by another element"),unsupportedOSVersion:smst_1.jsx("fragment",null,"Unsupported OS version, please see our ",smst_1.jsx("link",{href:"https://suite.st/docs/devices/playstation/#sdk-650-or-system-software-701-or-lower"},"docs")),targetManagerUnsupportedVersion:smst_1.jsx("fragment",null,"Unsupported Target Manager Server, please see our ",smst_1.jsx("link",{href:"https://suite.st/docs/devices/playstation/#sdk-650-or-system-software-701-or-lower"},"docs")),systemOutdated:smst_1.jsx("text",null,"System software version mismatch. New version of system software is required"),noSpaceLeftOnDevice:smst_1.jsx("text",null,"App installation failed. No space left on the device."),invalidDeveloperIP:smst_1.jsx("fragment",null,"Host PC IP does not match control unit IP, please see our ",smst_1.jsx("link",{href:"https://suite.st/docs/devices/samsung-tizen/#set-up-developer-ip-on-the-target-device"},"docs"),"."),instrumentationFailedPrivilege:smst_1.jsx("text",null,"Auto-instrumentation works for app packages with public or partner privileges only. Please use manual instrumentation instead"),releaseMode:smst_1.jsx("text",null,"Device is in the Release Mode, please switch it to the Assist Mode (Debug Settings / Boot Parameters / Release Check Mode)"),unsupportedPatchPackage:smst_1.jsx("text",null,"Patch package is not supported. You need to use a fully standalone application package"),deviceLabException:smst_1.jsx("text",null,"Suitest device lab - you do not have permission for this action under the current circumstances"),longPressNotSupported:smst_1.jsx("text",null,"This device does not support long-press feature")},translateQueryFailedResults=function(e){switch(e.message.code){case"invalidApp":return smst_1.jsx("text",null,"Wrong app ID detected");case"applicationError":return smst_1.jsx("text",null,"Application thrown unexpected error while executing command");case"missingSubject":return smst_1.jsx("text",null,"Subject does not exist");case"existingSubject":return smst_1.jsx("text",null,"Subject exists");case"orderErr":return smst_1.jsx("text",null,"Suitest instrumentation library should be placed as the first script in your HTML file. Loading the instrumentation library dynamically or after other scripts have loaded may cause many unusual errors");case"updateAlert":return smst_1.jsx("text",null,"Suitest instrumentation library is outdated. Please download and install the newest version");case"wrongExpression":return smst_1.jsx("text",null,"Wrong expression");case"notFunction":return smst_1.jsx("text",null,"Specified code is not a function");case"psImplicitVideo":return smst_1.jsx("text",null,'The "video" subject on the PlayStation platform is inconsistent, we recommend using the "native video" or "element" subject instead');case"exprException":return smst_1.jsx("text",null,'Exception was thrown: "',e.message.info.exception,'"');case"invalidUrl":var t=e;return smst_1.jsx("text",null,"App loaded ",t.actualValue," instead of the expected ",t.expectedValue,". Consider updating the app URL in settings");default:var s=e.message;console.warn("queryFailed message was not handled",JSON.stringify(s))}return conditionWasNotMetMessage},translateInvalidInputError=function(e){var t=smst_1.jsx("text",null,"Test command received invalid input"),s="message"in e?e.message:void 0;if(!s)return t;switch(s.code){case"lineTypeNotSupported":return smst_1.jsx("text",null,"This test command is not supported by the current app configuration");case"elementNotSupported":return smst_1.jsx("text",null,"This test command is unsupported by this element");case"wrongExpression":return t;case"wrongDirection":return smst_1.jsx("fragment",null,"Invalid direction. See ",smst_1.jsx("link",{href:"https://suite.st/docs/suitest-api/test-operations/#scroll"},"our docs")," for more information");default:var n=s.code;console.warn("invalidInput code was not handled",JSON.stringify(n))}return t},translateSyntaxError=function(e){var t,s=smst_1.jsx("text",null,"Test command received invalid input");if(!(null===(t=e.message)||void 0===t?void 0:t.code))return s;switch(e.message.code){case"wrongBody":return smst_1.jsx("text",null,"Body field value is exceeding 4KB limit");case"WrongDelay":return smst_1.jsx("text",null,"Test command received invalid input. Delay value is invalid");case"wrongUrl":return smst_1.jsx("text",null,"This does not look like a valid URL");default:var n=e.message.code;console.warn("syntaxError message was not handled",JSON.stringify(n))}return s},translateQueryTimeoutError=function(e){var t=smst_1.jsx("text",null,"Application did not respond for 60 seconds");if(!e.message)return t;switch(e.message.code){case"missingIlResponse":var s=e.message.info.timeout/1e3;return smst_1.jsx("text",null,"The wait time exceeded ",String(s)," ",1===s?"second":"seconds");default:var n=e.message.code;console.warn("queryTimeout message was not handled",JSON.stringify(n))}return t},translateDeviceError=function(e){var t=e.message;return"unsupportedSelector"===t.code&&"xpathNotSupported"===t.info.reason?smst_1.jsx("text",null,"Element cannot be found, because this device does not support XPath lookups"):"deviceFailure"===t.code&&"cssSelectorInvalid"===t.info.reason?smst_1.jsx("text",null,"CSS selector is invalid"):"deviceFailure"===t.code&&"xpathNotValid"===t.info.reason?smst_1.jsx("text",null,"XPath selector is invalid"):["videoAdapterInvalidOutput","videoAdapterNotFunction","videoAdapterThrownError"].includes(t.code)?smst_1.jsx("text",null,"Video adapter error: ",t.info.reason):simpleErrorMap.internalError},translateUnsupportedButtonError=function(e){var t,s=null===(t=e.message)||void 0===t?void 0:t.info.buttonIds;return s?smst_1.jsx("text",null,"Specified buttons are not supported on this device: [",s.join(", "),"]"):smst_1.jsx("text",null,"Specified buttons are not supported on this device")},translateAbortedError=function(e){var t;return"manualActionRequired"===(null===(t=e.message)||void 0===t?void 0:t.info.reason)?smst_1.jsx("text",null,"Manual actions are not supported"):smst_1.jsx("text",null,"Test execution was aborted")},translateInvalidVariableError=function(e){var t,s,n=null!==(s=null===(t=e.args)||void 0===t?void 0:t.variables)&&void 0!==s?s:[];if(0===n.length)return smst_1.jsx("text",null,"Variable is not defined in the app configuration");var r=n.join(", ");return smst_1.jsx("text",null,1===n.length?"Variable "+r+" is":"Variables "+r+" are"," not defined in the app configuration")},translateInvalidValueError=function(e){var t;return(null===(t=e.args)||void 0===t?void 0:t.propertyName)?smst_1.jsx("text",null,"Invalid value provided for ",e.args.propertyName):smst_1.jsx("text",null,"Invalid value provided")},translateInvalidResultError=function(e){var t,s=smst_1.jsx("text",null,"Unexpected response received");if(!(null===(t=e.message)||void 0===t?void 0:t.code))return s;switch(e.message.code){case"resultTooLong":return smst_1.jsx("text",null,"Response exceeded the size limit of 4KB");default:var n=e.message.code;console.warn("invalidResult code was not handled",JSON.stringify(n))}return s},translateOpenAppOverrideFailedError=function(){return smst_1.jsx("text",null,"Open app override failed")},translateInvalidReferenceError=function(e){var t="Could not start execution because";return"snippetLineNumber"in e?smst_1.jsx("text",null,t,' "Run Test" command refers to non-existing test or referred test has it\'s own references to non-existing tests'):smst_1.jsx("text",null,t,' test definition contains "Run Test" lines that refer to non-existing test')},translateADBError=function(e){return e.message&&"code"in e.message&&"certificateError"===e.message.code?smst_1.jsx("text",null,e.message.code):e.message&&"code"in e.message&&"installationRestricted"===e.message.code?smst_1.jsx("fragment",null,"Application installation is forbidden. See ",smst_1.jsx("link",{href:"https://suite.st/docs/troubleshooting/android/#application-installation-is-forbidden-on-xiaomi"},"our docs")," for more information"):e.message&&"info"in e.message?smst_1.jsx("text",null,e.message.info.reason):smst_1.jsx("text",null,"ADB communication with the device has failed. Make sure your device is set up correctly and it can be connected to using ADB")},translateInvalidPackageError=function(e){var t,s=smst_1.jsx("text",null,"Package cannot be launched on simulator device");if(!(null===(t=e.message)||void 0===t?void 0:t.code))return s;switch(e.message.code){case"appleTvDevicePackageOnSim":return smst_1.jsx("text",null,"An Apple TV app package cannot be launched on simulator device");case"appleTvSimPackageOnDevice":return smst_1.jsx("text",null,"An Apple TV app simulator package cannot be launched on real device");default:var n=e.message.code;return console.warn("invalidPackage code was not handled",JSON.stringify(n)),s}},translateOutdatedLibraryError=function(e){var t=smst_1.jsx("text",null,"We have detected that your instrumentation library is outdated");switch(e.message.code){case"major":return smst_1.jsx("text",null,"We have detected that your instrumentation library is outdated and the package cannot be opened. Update required");case"minor":return smst_1.jsx("text",null,"We have detected that your instrumentation library is outdated, the package can still be opened. Consider updating")}return t},translateInvalidRepositoryReference=function(e){var t="Element was not found in the repository";if(e.message)switch(e.message.code){case"notExistingElement":break;case"notExistingPlatform":t="Element is not defined for the selected platform";break;case"unknownProperty":t="Element does not support property "+condition_1.translateElementProperty(e.message.property);break;default:var s=e.message;console.warn("invalidRepositoryReference unknown message: ",JSON.stringify(s))}return smst_1.jsx("text",null,t)},translateNotAllowedPrivileges=function(e){return smst_1.jsx("fragment",null,"Application requires privileges not allowed on Suitest lab devices (",e.message.notAllowedPrivileges.join(", "),"). Read more in our ",smst_1.jsx("link",{href:"https://suite.st/docs/devices/device-lab"},"docs"),".")},isSimpleErrorResult=function(e){return e.errorType in simpleErrorMap},unknownErrorMessage=function(e){return console.warn("Error message not implemented for: "+JSON.stringify(e)+". Make sure you are using the latest version of the @suitest/translate library."),smst_1.jsx("text",null,"Unknown error occurred")};exports.translateResultErrorMessage=function(e){if(isSimpleErrorResult(e))return simpleErrorMap[e.errorType];switch(e.errorType){case"queryFailed":return"message"in e?translateQueryFailedResults(e):conditionWasNotMetMessage;case"invalidInput":return translateInvalidInputError(e);case"syntaxError":return translateSyntaxError(e);case"queryTimeout":return translateQueryTimeoutError(e);case"deviceError":return translateDeviceError(e);case"unsupportedButton":case"illegalButton":return translateUnsupportedButtonError(e);case"aborted":return translateAbortedError(e);case"invalidVariable":return translateInvalidVariableError(e);case"invalidValue":return translateInvalidValueError(e);case"invalidResult":return translateInvalidResultError(e);case"openAppOverrideFailed":return translateOpenAppOverrideFailedError();case"invalidReference":return translateInvalidReferenceError(e);case"adbError":return translateADBError(e);case"invalidPackage":return translateInvalidPackageError(e);case"outdatedLibrary":case"outdatedLibraryConnected":return translateOutdatedLibraryError(e);case"invalidRepositoryReference":return translateInvalidRepositoryReference(e);case"notAllowedPrivileges":return translateNotAllowedPrivileges(e);default:return unknownErrorMessage(e)}};var getScreenshotUrl=function(e){return e?baseScreenshotPath+e:void 0},getInvertedResultMessage=function(e,t){if(!(!t||"assert"!==e.type&&"wait"!==e.type||!("then"in e)||"success"===e.then||t.errorType&&"queryFailed"!==t.errorType&&"appRunning"!==t.errorType))return t.result===e.then?conditionWasMetMessage:conditionWasNotMetMessage},getQueryLineError=function(e,t){var s="";if("notExistingElement"===t.error)s="Element was not found in the repository";else if(!1===t.elementExists)s="Element was not found";else if(t.cookieExists)s="Cookie was not found";else if(t.executeThrowException)s='Execution thrown exception "'+t.executeExceptionMessage+'}"';else if(t.errorMessage)s=t.errorMessage;else switch(s="Error occurred while ",e.subject.type){case"execute":s+="executing script on device";break;case"cookie":s+="retrieving cookie";break;case"elementProps":s+="retrieving element";break;case"location":s+="retrieving current location"}return smst_1.jsx("text",null,s)},getLineResultMessage=function(e,t){var s;if("query"===(null===(s=t)||void 0===s?void 0:s.contentType))return getQueryLineError(e,t);var n=getInvertedResultMessage(e,t);if(n)return n;if(t&&"success"!==t.result){if("excluded"===t.result)return smst_1.jsx("text",null,"Line was not executed");if("aborted"===t.result)return smst_1.jsx("text",null,"Execution was aborted.");if("runSnippet"!==e.type||t.errorType)return exports.translateResultErrorMessage(t)}};exports.translateTestLineResult=function(e){var t,s,n,r=e.lineResult,o=e.testLine,i=utils_1.getDocsLink(o);return r&&"contentType"in r&&"query"===r.contentType?smst_1.jsx("test-line-result",{status:"fail",message:getLineResultMessage(e.testLine,r),docs:i},testLine_1.translateTestLine(e)):smst_1.jsx("test-line-result",{status:null!==(s=null===(t=r)||void 0===t?void 0:t.result)&&void 0!==s?s:"success",message:getLineResultMessage(e.testLine,r),screenshot:getScreenshotUrl(null===(n=r)||void 0===n?void 0:n.screenshot),docs:i},testLine_1.translateTestLine(e))}; |
{ | ||
"name": "@suitest/translate", | ||
"version": "4.4.3", | ||
"version": "4.4.4", | ||
"description": "A module that translate Suitest server messages to human readable strings", | ||
@@ -32,3 +32,3 @@ "homepage": "https://suite.st/", | ||
"@suitest/smst": "^4.4.3", | ||
"@suitest/types": "^4.4.3" | ||
"@suitest/types": "^4.4.4" | ||
}, | ||
@@ -39,3 +39,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "75ec0512ed410119093b33a98464beeba9792dd8" | ||
"gitHead": "2d6d966f42716c4d33c00f5497bafa8e70ce4960" | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
89764
Updated@suitest/types@^4.4.4