2

We are building a series of tests using TestCafe. How do we test if a point or path in a leaflet control is rendered correctly? To be more specific we are trying to test the lat-lon data of a circle marker in the map. But, we do not have any leaflet map/marker object available in the scope of testcafe scripts.

References:

Unit testing leaflet maps

Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47
user 923227
  • 2,528
  • 4
  • 27
  • 46

1 Answers1

3

I created a simple example of an assertion for a path element in a leaflet control on the getting started demo page https://leafletjs.com/examples/quick-start/

import { Selector } from 'testcafe';

fixture `fixture`
    .page `https://leafletjs.com/examples/quick-start/`;

test('test', async t => {
    await t
        .switchToIframe('iframe')
        .expect(Selector('path').withAttribute('stroke', 'red').getAttribute('d')).eql('M141.20355555554852,171.94704600190744a42,42 0 1,0 84,0 a42,42 0 1,0 -84,0 ');
});

Please provide us with an example of your testing page so we will be able to offer you something more specific for your scenario.

Helen Dikareva
  • 1,026
  • 6
  • 7