Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS: setFilesToUpload() gives "Uncaught RangeError: Maximum call stack size exceeded" #1731

Closed
jesperalmstrom opened this issue Aug 25, 2017 · 20 comments
Assignees
Labels
STATE: Auto-locked An issue has been automatically locked by the Lock bot. SYSTEM: hammerhead TYPE: bug The described behavior is considered as wrong (bug).
Milestone

Comments

@jesperalmstrom
Copy link

jesperalmstrom commented Aug 25, 2017

Are you requesting a feature or reporting a bug?

BUG

What is the current behavior?

When running the testcafe on MacOS:
Uncaught RangeError: Maximum call stack size exceeded

 1) Error on page "http://localhost:4200/":

      Uncaught RangeError: Maximum call stack size exceeded

      Browser: Chrome 60.0.3112 / Mac OS X 10.12.6

         22 |
         23 |            // upload file 
         24 |            await t
       > 25 |                .setFilesToUpload('#excelFileChooser',
      ['./xlsfiles/' + file + '.xls'])

Running on Windows is fine == no error.
Running same sequence manually works fine on Mac and Windows.

What is the expected behavior?

No error

How would you reproduce the current behavior (if this is a bug)?

Create a Angular 4 project with Angular-CLI.
Create a input for files:

<input #fileInput id="excelFileChooser" (change)="fileUpload(fileInput)" type="file" title="Select a Excel file ..." onclick="this.value = null" name="xls" accept=".xls, .xlsx">

A previous project that was built with vanilla JS worked with:

    <input id="fileChooser" class="handPointer" type="file" name="userfile">
    <img id="fileChooserButton" class="handPointer" src="./images/button.png" onclick="excelFileSelected()">

Provide the test code and the tested page URL (if applicable)

Test code

 await t
          .setFilesToUpload('#excelFileChooser', ['./xlsfiles/' + file + '.xls']

Specify your

  • operating system: Windows 10 and MacOS Sierra
  • browser: Chrome 60 (latest)
  • testcafe version: 17.1
  • node.js version: 8.2.1
@AlexanderMoskovkin AlexanderMoskovkin added the TYPE: bug The described behavior is considered as wrong (bug). label Aug 28, 2017
@AlexanderMoskovkin
Copy link
Contributor

@jesperalmstrom Thanks for the report!
@LavrovArtem please take a look at this

@LavrovArtem
Copy link
Contributor

@jesperalmstrom It can be related with DevExpress/testcafe-hammerhead#1283. Could you please provide us a call stack of error from the browser console?

@miherlosev
Copy link
Collaborator

Fixed in DevExpress/testcafe-hammerhead#1287
The fix will be included to the next release version. You can try it in the latest dev version (npm install [email protected] or npm install testcafe@dev)

Feel free to reopen the issue if the problem still occurs on your page

@jesperalmstrom
Copy link
Author

Thanks I will try the next release version.

@pittdewaard
Copy link

@AlexanderMoskovkin: Hi, first of all: testcafe is really cool stuff! helps me a lot to do my work ...

I have this issue on Windows 10 with Version 0.18.2 ... any Idea?

@AlexanderMoskovkin
Copy link
Contributor

Hi @pittdewaard,

Hi, first of all: testcafe is really cool stuff! helps me a lot to do my work ...

Glad to hear this!

I have this issue on Windows 10 with Version 0.18.2 ... any Idea?

Is your page/repository private or public? Could you share your page or a simple example with us so that we will reproduce the issue?
 
If it is private, please provide us with the full test report. Check whether the browser console contains errors. If yes, please provide us with a screenshot of them (or just copy them with their callstack). You can use the --debug-on-fail TestCafe option to pause a test at the moment it fails.
Do you use any js-frameworks in your application?

@pittdewaard
Copy link

Hi @AlexanderMoskovkin,

thx for the quik response...

I've just updated to 0.18.4, no change ...

Yes, we use angularjs, but until now without any problem...

here my test:

'use strict';

import { Selector, t} from 'testcafe';

export default class Z7 {

   constructor() {
        this.link = Selector('[ui-sref="z2.find"]');
        this.dtaLink = Selector('[ui-sref="z7.1"]')
        this.uploadItem = Selector('input[type="file"]');
        this.uploadBtn = Selector('div[class="btn btn-block upload-button"]');
        this.filepathname = './data/10008-1011-dta_fehlerfrei.dta';
        this.submitBtn = Selector('button[data-translate-once="z7-1_button_datei_senden"]');
    }

   async startAssistant() {
        const waittime = 100;
        await t
            .wait(30 * waittime)
            .click(this.link)
            .wait(20 * waittime)
            .click(this.dtaLink)
            .wait(5 * waittime);
        await (this.uploadItem).exists;
        await t
            .setFilesToUpload(this.uploadItem, [this.filepathname])
            .click(this.uploadBtn)
            .wait(2 * waittime)
            .click(this.submitBtn) //problem in hammerhead js?
            .debug()
    }
}

and the console error (Crome):

upload-error-filesize.txt

Info from Testafe output:

  • Chrome 62.0.3202 / Windows 10 0.0.0

... and: thank you!

@AlexanderMoskovkin
Copy link
Contributor

Thanks for the provided info. From the log we see a failed request:

POST http://10.11.32.149:50526/rkYXyK-lM/http://localhost:7029/ibf/10008-1011-20171121112548/root/web2/json/Z7_2_UploadDTA 951 (unknown)

Could you please provide us with the details of this request for the same file on the original page and on the page with TestCafe?

To do this open your page in Chrome and open a Network tab of the developer tools. Perform file uploading manually, find the related request and save it as HAR. Then do the same actions when TestCafe runs the test. It important to upload the same file in both cases.

@pittdewaard
Copy link

hope this is the correct one, pls delete after download ...

@DevExpress DevExpress deleted a comment from pittdewaard Nov 21, 2017
@AlexanderMoskovkin
Copy link
Contributor

I got it. Could you please do the same during TestCafe running?

@pittdewaard
Copy link

pittdewaard commented Nov 21, 2017

above was succcesfull, this one failed, it's a huge smaller??

@AlexanderMoskovkin
Copy link
Contributor

Thanks. That's what we need. We're investigating it right now

@pittdewaard
Copy link

so I can delete the zip's?

@AlexanderMoskovkin
Copy link
Contributor

yep

@miherlosev
Copy link
Collaborator

Hi @pittdewaard
We tried to reproduce the problem with the data you provided. But we did not succeed.
You problem seems to be an edge case.
To reproduce the problem, we need an example that we can run on our side.
Could you, please, provide one?

@pittdewaard
Copy link

Hi @miherlosev,

thx to take care about my issue...

unfortunately I can't give you a code-snippet to reproduce the error, talked with our development team, but no one came over with a clever idea ... we are using angular-file-upload (1x) and I run a test against http://nervgh.github.io/pages/angular-file-upload/examples/simple/... testcafe works fine! But there are several tests on the backend side due the upload, before coming back to you I have to check these. KR Pitt

@pittdewaard
Copy link

Hi @AlexanderMoskovkin and @miherlosev,

I can confirm that it seems to be an edge case... our error is not related to a 'size error'.

but I guess there must be a reason belonging to testcafe that my test fails,

At the backend side we have a servlet, which does some tests with the uploaded file, but this servlet fails with a Null Pointer Exception, what means it can't get a handler to the uploaded file...

Every Idea is welcome! Timing Problems?

Thanks for you help!

KR

Pitt

@miherlosev
Copy link
Collaborator

but this servlet fails with a Null Pointer Exception, what means it can't get a handler to the uploaded file...

As I understand, your backend is written in Java.
Your servlet contains a method that processes file upload. With TestCafe, this method returns the 951 HTTP status code.
The request from your logs:

POST http://10.11.32.149:50526/rkYXyK-lM/http://localhost:7029/ibf/10008-1011-20171121112548/root/web2/json/Z7_2_UploadDTA 951 (unknown)

I guess that NullPointerException is raised when some field or variable (from servlet state or HttpServletRequest request parameter) from target servlet's method equals null.

Could your, please, provide:

  • code of a method that processes file upload
  • stack trace of the raised NullPointerException
  • full data of the HttpServletRequest request parameter (with TestCafe and without it)

If the information I ask you to provide contains sensitive data, you can send it to me on [email protected] email.

@pittdewaard
Copy link

Hi @miherlosev,

thx again for investigating in this issue, i have to ask our teamleader for this, come back later...

@lock
Copy link

lock bot commented Mar 28, 2019

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow.

@lock lock bot added the STATE: Auto-locked An issue has been automatically locked by the Lock bot. label Mar 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Mar 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
STATE: Auto-locked An issue has been automatically locked by the Lock bot. SYSTEM: hammerhead TYPE: bug The described behavior is considered as wrong (bug).
Projects
None yet
Development

No branches or pull requests

5 participants