Pavankumar Joshi created CB-6771:
------------------------------------

             Summary: Error in of Mobilespec340 filetransfer test cases
                 Key: CB-6771
                 URL: https://issues.apache.org/jira/browse/CB-6771
             Project: Apache Cordova
          Issue Type: Bug
          Components: mobile-spec
    Affects Versions: 3.4.0
         Environment: Mobilespec340 testing on Google Nexus 7 device , with 
Android version 4.4.2
            Reporter: Pavankumar Joshi
            Priority: Minor


Recently I observed an error in Mobilespec File transfer test cases. I checked 
and found that there are 3 test cases failing in Mobilespec project, they are
1) filetransfer.spec.18
2) filetransfer.spec.19
3) filetransfer.spec.29

The main cause of all test cases failure is due to the execution of this 
javascript statement in jasmine.
1) “expect(uploadResult.response).toMatch(/fields:\s*{\s*value1.*/);”
That is the response object from the server is checked to see if it contains 
the fields like value1 and test.
This fails because the actual JSON object in the uploadResult.response  object 
looks like "fields":{"value1":"test","value2":"param"} ….
The Failure is mainly because of the double quotes(“) present in the response 
object. The same test cases pass if it is modified like
2) “expect(uploadResult.response).toMatch(/”fields”:\s*{\s*”value1”.*/);” ( 
with double quotes in toMatch method for fileds and value1)

I checked mobilespec3.5.0 version filetransfer.tests.js and still the matching 
expression looks like 
(expect(uploadResult.response).toMatch(/fields:\s*{\s*value1.*/);)

I tested mobilespec290, and noticed that same file transfer test cases are 
failing now. I tested mobilespec290 on motorola xoom device with Android 4.1.0 
version

I think that the JSON response from server 
http://cordova-filetransfer.jitsu.com has changed to include double quotes. 

Then I checked that in the master branch of file transfer mobile spec test case 
https://github.com/apache/cordova-mobile-spec/blob/master/autotest/tests/filetransfer.tests.js
The code is modified to test the response in a different way 
               var obj = null;
                try {
                    obj = JSON.parse(uploadResult.response);
                    expect(obj.fields).toBeDefined();
                    expect(obj.fields.value1).toBe("test");
                                                     …….





--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to