[RPE] How to get an attached image (not attachment) from RQM's script step.
Morning,
Im trying to obtain and image inserted in a step text field in RQM 4.0.1 through RPE.
I can get attachments but not an image directly inserted in a text field using "Insert Image" button.
I can get attachments through tesscript data source schema cause it has Attachment field:
But, is there any way to get attached images, for example an image attached in expectedResult field ???
I can see that image attached in expectedResult field is in feed code:
<ns9:expectedResult xmlns:ns9="http://jazz.net/xmlns/alm/qm/v0.1/testscript/v0.1/"><div:div xmlns="http://www.w3.org/1999/xhtml" xmlns:div="http://www.w3.org/1999/xhtml"> Se accede correctamente<ns20:a xmlns="" xmlns:ns20="http://www.w3.org/1999/xhtml" href="https://myserver:9443/jazz/service/com.ibm.rqm.planning.service.internal.rest.IAttachmentRestService/_NrEm0SdgEeO3UKXOjinjcw" target="_blank"><ns20:img xmlns:ns20="http://www.w3.org/1999/xhtml" src="https://myserver:9443/jazz/service/com.ibm.rqm.planning.service.internal.rest.IAttachmentRestService/_NrEm0SdgEeO3UKXOjinjcw" alt="RQM_31.png" height="24" style="width: 24px; height: 24px;" width="24"></ns20:img></ns20:a>
</div:div></ns9:expectedResult>
But cant assign to an IMAGE component of RPE:
Thank you very much!
Accepted answer
Comments
tyvm
Does this mean that if the entire rich text content in the Description/Expected Result fields is published, the embedded image is published too?
The RQM Reportable REST API will expose the XHTML content from these sections. This XHTML content may contain embedded images, which are embedded via image links (not reportable) or a base64 string (reportable).
One other answer
Hola Alvaro
var ini = expectedResult.indexOf("<img");
if (ini == -1){var str1 = "<div>NA</div>";str1;}else {
var str1 = "<div><p style=\"text-align: center;\" dir=\"ltr\" >"var str2 = "</p></div>"var fin = expectedResult.indexOf("/>",ini);var img_str_0 = expectedResult.substring(ini,fin+2);var temp1 = img_str_0.indexOf("src=\"https");var img_sin_tilde = img_str_0.split("%E1").join("á");img_sin_tilde = img_sin_tilde.split("%C1").join("Á");img_sin_tilde = img_sin_tilde.split("%E9").join("é");img_sin_tilde = img_sin_tilde.split("%C9").join("É");img_sin_tilde = img_sin_tilde.split("%ED").join("í");img_sin_tilde = img_sin_tilde.split("%CD").join("Í");img_sin_tilde = img_sin_tilde.split("%F3").join("ó");img_sin_tilde = img_sin_tilde.split("%D3").join("Ó");img_sin_tilde = img_sin_tilde.split("%FA").join("ú");img_sin_tilde = img_sin_tilde.split("%DA").join("Ú");
var img_str_1 = img_sin_tilde;
if (temp1 == -1){var img_str=img_str_1.replace("src=\"","src=\"https://yourserverurl:9443");} else{var img_str=img_str_1;}str1.concat(img_str,str2);}