如何使用testcafe测试基于传单的地图? [英] How to test leaflet based maps using testcafe?
本文介绍了如何使用testcafe测试基于传单的地图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们正在使用TestCafe构建一系列测试.我们如何测试传单控件中的点或路径是否正确呈现?更具体地说,我们正在尝试测试地图中圆形标记的经纬度数据.但是,在testcafe脚本范围内,我们没有任何可用的传单地图/标记对象.
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.
参考文献:
推荐答案
我在入门演示页 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.
这篇关于如何使用testcafe测试基于传单的地图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文