I am using
cartodb.js to import one of our maps via
cartodb.createVis. I am working on adding custom functionality outside the scope of the web console's customizations (for example, custom search fields).
I want to write end-to end tests for cartodb's functionality. I want to select specific markers, trigger click events on them, and then expect DOM changes and map changes. I also want to be able to test for "markers" or map elements to appear or disappear
The problem is that I cannot use selectors to access individual markers or any of the functionality provided by the "visualization" outside of the search bar and layer selector. I have not been able to construct the appropriate CSS selectors, and selenium will not record click actions on map elements (except for double-clicks on map tiles, which cause a zoom, and aren't useful for me).
I can test for the existence of a tile by using a selector for its image. This doesn't work because:
a) any slight change to the visualization changes this link and breaks the test (I'm not sure the link is reliable even if we don't change the visualization)
b) I can't test for the existence of specific map elements (e.g., markers).
How can I write tests for our visualization?
Update: I tried using
layer.trigger('featureClick' . . . as described here and here but that is failing silently. I'm not sure if it matters, but unlike that Gist I have multiple layers and my coordinates are not quite as precise.
I am also trying to trigger marker clicks using Selenium's
clickAt method. For this I am using the example here I've tried:
This fails silently.
<td>601, 229 </td>
TypeError: _d is undefined cartodb.uncompressed.js:14231