testcafe-hammerhead: upload file multiple time failed on (chrome) x (linux, win10) via selenium grid
What is your Test Scenario?
Call upload file multiple time.
What is the Current behavior?
It’s OK using testcafe 1.1.0, but after we upgrade testcafe to 1.3.2, it’s success to upload first file, but nothing is triggered when uploading second file.
It only happen on (chrome) x (linux, win10), but it works well on mac.
What is the Expected behavior?
Second file should also upload successfully.
What is your web application and your TestCafe test code?
Your website URL (or attach your complete example): Internal app
Your complete test code (or attach your test files):
await t.setFilesToUpload(uploadFileInput, filesPath);
Your complete configuration file (if any):
Your complete test report:
Screenshots:
Steps to Reproduce:
- Go to my website …
- Execute this command…
- See the error…
Your Environment details:
- testcafe version: 1.3.2
- node.js version: 10.9.0
- command-line arguments: testcafe selenium:chrome *.js
- browser name and version: Chrome 74, 75
- platform and version: win10, linux(docker)
- other:
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18 (16 by maintainers)
I think I have already find the root cause:
https://github.com/DevExpress/testcafe-hammerhead/blob/75a3b5878bef3659ae9d6b2bf9713ba0cfb83fd4/src/client/sandbox/upload/index.ts#L106-L132
If I make
_shouldRaiseChangeEvent
always return true, the bug is gone. I guess the conditionfile.name === currentFile.name
is incorrect. As the first file we upload is1.txt
, and the second file isupload/1.txt
, in this case the change event should be thrown.What our case test is upload different files with same name, so this bug will be triggered. But since you guys have exclude mac, that’s why we only found this happen on windows and linux.
I think you should double check this fix https://github.com/DevExpress/testcafe/issues/1844 as it introduce a new bug. It’s impossible for hammerhead to read the full path, so I think you should add a new argument to
setFilesToUpload
to allow user to decide whether a change event should be fired when they call it.