VerifyImages step improperly stores all images in webclient response
--------------------------------------------------------------------

         Key: WT-516
         URL: http://webtest-community.canoo.com/jira/browse/WT-516
     Project: WebTest
        Type: Bug

    Versions: 3.0    
    Reporter: Jared Stehler


I recently came across what I believe to be incorrect semantics regarding the 
VerifyImages extension step.  I was working with a form that had a file upload 
as an intermediate step, and wished to verify that the image I uploaded was 
present before proceeding.  The form uploads images to a hidden iFrame, which 
returns javascript to update the image's src on the screen.  My test case 
looked like:

                                <setFileField description="upload medium sized 
banner" xpath="//fo...@id='FileForm']/inp...@id='file']"
                                        
fileName="./resources/168x28-Medium-jpg.jpg" />
                                <clickButton description="click upload button" 
htmlId="submitBanner" />

                                <verifyText description="verify OK return code 
from upload response" text=".*uploadCompleted\('OK'.*" regex="true" />
                                <storeRegEx description="extract new image url, 
for verification" group="1" property="previewImgUrl"
                                        
text=".*uploadBannerCompleted\('OK',.*'(http.*\.jpg).*" />

                                <previousResponse />

                                <storeElementAttribute description="verify img 
preview src is changed" 
                                        property="previewImgSrc" 
htmlId="previewMEDIUM" attributeName="src" />
                                <verifyProperty name="previewImgSrc" 
value="#{previewImgUrl}" />

                                <verifyImages />

I found that the verifyImages step is actually calling webClient.getPage(url) 
(in VerifyImages::tryGetImage()), which updates the previous response.  The 
test would proceed normally, but when it came to clicking the next button, 
which invokes an ajax validator, a ClassCastException would be thrown (and 
swallowed) in the HtmlUnit XMLHttpRequest class, in jsxFunction_open(), here:

        containingPage_ = (HtmlPage) 
getWindow().getWebWindow().getEnclosedPage();

With no output to any log, I was unable to see what was causing nothing to 
happen when the button was clicked, save for running everything through a 
debugger.

I suggest using an alternative means of verifying images, or else pop them off 
the prior response stack when finished with the VerifyImages::checkImages() 
method.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://webtest-community.canoo.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to