Prototype JS-Framework behaves strange during webtest
-----------------------------------------------------

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

 Environment: Prototype JavaScript framework, version 1.6.0.2
Webtest R_1724
    Reporter: Christoph Kemp


In Webtest there is a wrong behaviour of some prototype-Methods. If they work 
or if they don´t work seems to depend on if you had previous usages of 
prototype methods. Here is an example:

This isn´t working when called during a webtest:
$$('.buttonClass') 
$$('.buttonClass') .first() //result is null

If you delete the first row, it works during a webtest:
$$('.buttonClass') .first() //result is the first element


The example in more detail and a failing webtest showing the problem:


<html>
<head>
<script type="text/javascript" src="prototype.js"></script>

<script type="text/javascript">

//double using $$ --> second call returns null (only in webtest)
function usePrototypeWithDoubleAccess()
{
        $$('.buttonClass') 
        usePrototype()
}

//works fine in webtest
function usePrototype()
{
        var myElements = $$('.buttonClass')
        showMessage(myElements.first() != null)
}

function showMessage(message)
{
        document.getElementById('messages').innerHTML = message;
}
</script>
</head>

<body>
        In my browser (IE&FF) clicks on both buttons are doing the same (true 
is shown). In Webtest the case with double use of '$$' fails. The Element in 
JavaScript is null (false is shown).
        <br>
        <br>
        <input id="buttonIdNotWorking" type="button" class="buttonClass" 
onclick="usePrototypeWithDoubleAccess()" value="element not found in webtest">
        <input id="buttonIdWorking" type="button" class="buttonClass" 
onclick="usePrototype()" value="element found in webtest">
        <br>
        Element found via Prototype? <span id="messages"></span>
</body>

</html> 




<?xml version="1.0"?>

<!DOCTYPE project SYSTEM "../dtd/Project.dtd">

<project default="test">
        <target name="test">
                <webtest name="Doesn´t work'">
                        <invoke url="<PATH_TO_TEST-HTML" description="Go to 
Testpage"/>
                        <verifyElementText
                              htmlId="messages"
                              text="" />
        
                        <clickButton htmlId="buttonIdNotWorking"/>
                        
                        <verifyElementText
                              description="Element found"
                              htmlId="messages"
                              text="true" />
                </webtest>
                <webtest name="This works">
                        <invoke 
url="file:///c:/temp/prototypeproblem/test.html" description="Go to Testpage"/>
                        <verifyElementText
                              htmlId="messages"
                              text="" />
        
                        <clickButton htmlId="buttonIdWorking"/>
                        
                        <verifyElementText
                              description="Element found"
                              htmlId="messages"
                              text="true" />
                </webtest>
        </target>
</project>

-- 
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