如何使用 testcafe 测试基于传单的地图?
How to test leaflet based maps using testcafe?
我们正在使用 TestCafe 构建一系列测试。我们如何测试传单控件中的点或路径是否正确呈现?更具体地说,我们正在尝试测试地图中圆形标记的经纬度数据。但是,我们在 testcafe 脚本的范围内没有任何可用的传单 map/marker 对象。
参考文献:
Unit testing leaflet maps
我在入门演示页面上为传单控件中的路径元素创建了一个简单的断言示例 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 ');
});
请向我们提供您的测试页示例,以便我们能够为您提供更适合您场景的内容。
我们正在使用 TestCafe 构建一系列测试。我们如何测试传单控件中的点或路径是否正确呈现?更具体地说,我们正在尝试测试地图中圆形标记的经纬度数据。但是,我们在 testcafe 脚本的范围内没有任何可用的传单 map/marker 对象。
参考文献:
Unit testing leaflet maps
我在入门演示页面上为传单控件中的路径元素创建了一个简单的断言示例 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 ');
});
请向我们提供您的测试页示例,以便我们能够为您提供更适合您场景的内容。