You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Snapshot (approval) testing is useful for easy refactoring, and well supported by Jest. It's not quite trivial to set up for us because the map view renders asynchronously, and so waiting on "Nothing to show" doesn't seem to be enough for deterministic behaviour. The following diff illustrates different states that both satisfy expect(..).toContain("Nothing to show"):
Maybe we can find a UI element to wait on that only appears when the map is fully loaded.
install jest-image-snapshot
import toMatchImageSnapshot from jest-image-snapshot and extend Jest’s expect API
condition that over-approximates map being fully loaded
waitUntil: "networkidle0" -- probably not very reliable
revisit snapshot tests in tgvejs (maybe no longer needed)
set visibility of map and loader component to hidden (to avoid problem with async map content)
change Puppeteer viewport size to include more of the side desk
OK having played with many options on puppeteer, a solution which also contributes to overall tgvejs functionality is to generate the image snapshots without "basemap"s. This can be achieved by exporting another API called mapStyle and setting it to "No map". The results would be like. Please let me know @rolyp if you like me to send the commit (small one) to tgve/tgvejs.
Leave it here, got enough about puppeteer and how we are trying to use it. Great work btw.
Snapshot (approval) testing is useful for easy refactoring, and well supported by Jest. It's not quite trivial to set up for us because the map view renders asynchronously, and so waiting on "Nothing to show" doesn't seem to be enough for deterministic behaviour. The following diff illustrates different states that both satisfy
expect(..).toContain("Nothing to show")
:Maybe we can find a UI element to wait on that only appears when the map is fully loaded.
jest-image-snapshot
toMatchImageSnapshot
fromjest-image-snapshot
and extend Jest’sexpect
APIcondition that over-approximates map being fully loaded-- probably not very reliablewaitUntil: "networkidle0"
revisit snapshot tests intgvejs
(maybe no longer needed)hidden
(to avoid problem with async map content)__snapshort
folder as build artifactSee:
The text was updated successfully, but these errors were encountered: