-
-
Notifications
You must be signed in to change notification settings - Fork 689
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
Maplibre source.updateData error on Cypress tests (source.setData works OK) #4588
Comments
Can you reproduce this error without Cypress? |
@HarelM I'll try to create an iframe for the map and check for errors without Cypress tests. The demo implements the only command basically, so I don't think it could be related to something else. |
I would suggest to write the data in the test file to see if it passes, loading data from files in Cypress might cause issues (although setData works...) IDK... |
@HarelM Just checked, this fails the same way with "Error: can't serialize object of unregistered class Object" source.updateData({
add: {
id: 1,
type: 'Feature',
properties: {},
geometry: {
type: 'Point',
coordinates: [
-7.064208984375142,
54.908263583510376,
],
},
},
}); upd: it should be |
This is where the data is begin sent: maplibre-gl-js/src/source/geojson_source.ts Line 338 in 76a01c1
This is where the error is thrown:
It seems that this should by |
Just checked how The source has been updated and I see valid geojson in source.getData().then((data) => {
console.log('Source data', data);
}); So it seems it's something cypress specific. |
Maplibre raises error when tests are running in Cypress.
Error occurs when you're trying to call
source.updateData({ add: features })
.It seems it's related to iframes which Cypress uses, I see similar issues in mapbox github, but it seems it's fixed already at least for setData (or no one used updateData yet).
Error looks like this and the source isn't updated after the error:
Basically, in Cypress tests:
maplibre-gl: 4.5.2
browser: latest chrome
I've implemented github repository to demonstrate:
https://github.com/zxwild/maplibre-cypress
Expected behavior: ability to use
source.updateData()
in Cypress tests without errors.The text was updated successfully, but these errors were encountered: