MacOS: setFilesToUpload() gives "Uncaught RangeError: Maximum call stack size exceeded"
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
@jesperalmstrom Thanks for the report! @LavrovArtem please take a look at this
@jesperalmstrom It can be related with https://github.com/DevExpress/testcafe-hammerhead/issues/1283. Could you please provide us a call stack of error from the browser console?
Fixed in https://github.com/DevExpress/testcafe-hammerhead/pull/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
Thanks I will try the next release version.
@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?
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?
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):
Info from Testafe output:
- Chrome 62.0.3202 / Windows 10 0.0.0
... and: thank you!
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.
hope this is the correct one, pls delete after download ...
I got it. Could you please do the same during TestCafe running?
above was succcesfull, this one failed, it's a huge smaller??
Thanks. That's what we need. We're investigating it right now
so I can delete the zip's?
yep
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?
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
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
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 requestparameter (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.
Hi @miherlosev,
thx again for investigating in this issue, i have to ask our teamleader for this, come back later...
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.