good morning - I'd like to use the Kvision maps mo...
# kvision
a
good morning - I'd like to use the Kvision maps module, but I think it needs some work and documentation. I'm keen to do this, and I'm getting started on writing some tests. I feel a bit limited by the plain kotlin-test lib though. Would introducing Kotest be acceptable? (for assertions - the test-engine only works on JS IR, not legacy)
r
Hi
Maps module is indeed just a skeleton with some basic functionality
It was contributed by @Jörg Rade and any other contributions are welcomed
👍 1
As for testing with kotest - KVision is build with
js(BOTH)
so you would have to somehow configure tests to be skipped when running legacy compiler.
I don't know how to do it or if it is even possible, but if you manage to do this Kotest is of course acceptable. IR-only tests are better then no tests at all 🙂
a
Cool, thanks, I'll see what I can do. I've been playing around a little and I think Kotest won't be that useful after all
What about taking screenshots for testing? I'm finding it a bit difficult to do comparisons by plain HTML content. I wonder if taking a live screenshot during a test and comparing it to a stored image might be nicer?
j
Hmm - how about comparing expected HTML to observed?
You could even query the DOM for a specific element.
Would you do the visual comparison by human eye or use a trained NN?
a
direct HTML comparison isn't very pretty in my opinion :)
I could compare each element, but that seems quite fiddly
and I'm not sure how I can use HTML-only assertions to make sure that the background tiles are loaded correctly
I've only got very limited experience with image-comparison testing, so I'm not sure what the best approach is. My guess is image-comparison would be good, but I don't know for sure.
r
I'm not sure it's even possible to make a screenshot
But I have no idea if it can be done with Kotlin/JS 🙂
In my opinion making tests too strict is not a good idea, both for html and image comparison. Some small changes in the external library (like Leafleat) will make such tests fail.
I would probably just check for html element(s) directly being tested (e.g. when testing function which adds a marker, I would search for correct marker element in the rendered html code)
You can check for both gui elements (markers, controls, tooltips) and for tile images with correct names.
a
yup, agreed, the tests should be as simple and maintainable as possible
I'll see what I can do but I can't think how to test it nicely by querying HTML elements, because none of the Leaflet HTML elements have IDs
👍 1
j
Maybe using a (X)HTML parser is an option?
a
maybe! Thanks, I'll take a look