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

Frame agent override causes TypeError with an XHR request from Dropzone #7

Closed
mjgiarlo opened this issue Dec 12, 2024 · 2 comments · Fixed by #8
Closed

Frame agent override causes TypeError with an XHR request from Dropzone #7

mjgiarlo opened this issue Dec 12, 2024 · 2 comments · Fixed by #8
Assignees

Comments

@mjgiarlo
Copy link

My team's been enjoying Cyperful for ironing out kinks in our system specs, and recently we wrote a test of a file upload feature in our application and found that while the spec passes in RSpec, it fails when invoked via Cyperful. In the JavaScript console of Chrome, when we drop a file into the upload dropzone, we see Uncaught TypeError: Illegal invocation:

Screenshot from 2024-12-12 11-17-19

It appears to be the e.apply(this, n); call in the XHR override within the Cyperful frame agent:

return originalOpen.apply(this, args);
, just after DropzoneJS attempts to make an XHR request (here). It appears the reference to this is problematic here.

Is this XHR override in the frame agent required? When I comment out the XHR override locally, the tests all pass, for what it's worth. Maybe there's a way to rewrite the override so that the this reference doesn't bomb out? Happy to make changes on my side if you have suggestions.

@wyattades
Copy link
Contributor

Sorry for the delayed response @mjgiarlo, and I don't think we've actually tested the XMLHttpRequest wrapper before!

Seems like we made a mistake when using this here here when we should be using .prototype.open, something like https://gist.github.com/joelcardinal/955a41e5979c4134f5575e1d3f0ddf48.

Hopefully I can make a fix tomorrow

@mjgiarlo
Copy link
Author

mjgiarlo commented Jan 8, 2025

Works like a charm. Thank you, @wyattades !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants