You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Naik, Archana" <na...@lab126.com> on 2013/10/29 18:24:56 UTC

testcases timing out and report failures

Hi, Devs,

As part of fire-os porting, I updated mobile-spec to test the platform with all core plugins. We observed many failures on running the automated cordova-mobile-spec tests with the 3.1 branch of amazon fireos port. Almost all the failures seen are timeout issues. Upon debugging the issue we found that the success callbacks are always called but the Jasmine Framework is not notified about the call and reports that the test failed due to timeout. However, with our 3.0 branch all the tests passed with no timeout issues.

This is one of the tests where the above behavior is observed.

In filetransfer.spec.4, [File Transfer Automated Tests]

Code Snippet of test:

it("filetransfer.spec.4 should be able to download a file using http", function() {
           var fail = createDoNotCallSpy('downloadFail');
            var remoteFile = server + "/robots.txt"
            var localFileName = remoteFile.substring(remoteFile.lastIndexOf('/')+1);
            var lastProgressEvent = null;

            var downloadWin = jasmine.createSpy().andCallFake(function(entry) {
                expect(entry.name).toBe(localFileName);
                expect(lastProgressEvent.loaded).toBeGreaterThan(1);
            });

          // this.after(function() {
               // deleteFile(localFileName);
          //  });

           runs(function() {
                var ft = new FileTransfer();
                ft.onprogress = function(e) {
                    lastProgressEvent = e;
                };
                ft.download(remoteFile, root.fullPath + "/" + localFileName, downloadWin, fail);
            });
            waitsForAny(downloadWin, fail);
        });

We verified that the robots.txt file is actually downloaded [verified this by pulling the file from the device and checking that the contents exist]. [Note: We commented the deleteFile() functionality so that we don't delete the file after the test]. Additionally, we verified that the success callback is called and all the checks(expect stmts) pass by adding console.log statements to the downloadWin() function.

Any help would be appreciated.
Thanks
Archana