-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
cy.task() doesn't work as expected with Cypress version 12.16.0 #27200
Comments
@CarleneCannon-Conner I'm unable to reproduce this with Cypress 12.16.0. Here is what I used for the test code: it('issue #27200', () => {})
after(() => {
const arr0 = [{ x: 0, y: 1, z: 2 }]
const arr1 = (new Array(9999)).fill(0).map(() => ({ x: 0, y: 1, z: 2 }))
cy.task('example', { arr0, arr1 })
}) For me, this fails in 12.15.0 but passes in 12.16.0. This looks like a bug that was fixed in 12.16.0, so it would surprising for it still to be an issue. Would you mind double-checking that you're running 12.16.0 and that the test code above triggers the issue? If you still encounter the issue with 12.16.0, do you see any red error messages in the browser devtools console? The aforementioned bug was always accompanied by a |
Same here, we can still reproduce this issue on Cypress 12.16.0 (when it worked on Cypress 12.14.0) |
@estefafdez Are also you able to reproduce it on Cypress 12.17.0? If so, can you provide a minimal reproduction of the issue using cypress-test-tiny? |
@chrisbreiding there you go: cypress-io/cypress-test-tiny#83 check my PR. You can reproduce the issue in your repo when running the spec on the project. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Current behavior
I am attempting to migrate from cypress version 10.11.0 to version 12.16.0. When running existing tests it appears that
cy.tasks()
no longer works as it once did. It gives the errorcy.task() must only be invoked from the spec file or support file.
Upon further investigation, it looks as though it works fine if the array of objects passed to the function is less than 67 objects. As a quick fix in our codebase I intend to propose breaking up our large array into smaller chunks.
I also tested against versions 12.14.0 and 12.15.0. Only version 12.14.0 worked, so it is likely the breaking change was introduced in version 12.15.0 and has persisted to version 12.16.0.
Desired behavior
It would be nice if a fix could be implemented so that cy.tasks() works with large arrays as it used to in previous versions.
Test code to reproduce
In our codebase we are using in an after() to collate a couple of arrays, one of which contains very large array of objects.
Here is a simplified version of it. Note if I use less objects e.g. 50 it works as expected.
Cypress Version
12.16.0
Node version
v16.14.0
Operating System
macOS 13.4.1
Debug Logs
No response
Other
No response
The text was updated successfully, but these errors were encountered: