Angular 角度e2e测试在从mapbox gl js传递带有集成贴图的页面时失败,超时-错误
我们的Angular应用程序包含不同的页面,其中一个页面显示与mapbox gl js集成的地图 由于我们集成了mapbox,我们的量角器e2e测试失败。 一旦测试到达显示映射的页面,下一次单击同一页面上的任何其他HTML元素就会导致以下错误:超时-在jasmine指定的超时内未调用异步回调。默认超时时间间隔。 在测试之前,一切正常 看起来,量角器在页面上找不到任何HTML元素进行验证。唯一可能的方法是单击页面上的另一个元素,但是页面会冻结,直到出现超时错误 例如:Angular 角度e2e测试在从mapbox gl js传递带有集成贴图的页面时失败,超时-错误,angular,protractor,mapbox-gl-js,angular-e2e,Angular,Protractor,Mapbox Gl Js,Angular E2e,我们的Angular应用程序包含不同的页面,其中一个页面显示与mapbox gl js集成的地图 由于我们集成了mapbox,我们的量角器e2e测试失败。 一旦测试到达显示映射的页面,下一次单击同一页面上的任何其他HTML元素就会导致以下错误:超时-在jasmine指定的超时内未调用异步回调。默认超时时间间隔。 在测试之前,一切正常 看起来,量角器在页面上找不到任何HTML元素进行验证。唯一可能的方法是单击页面上的另一个元素,但是页面会冻结,直到出现超时错误 例如: e2e测试到达地图 我可以点
// the map.component.html
<div class="container">
<div #map id="map" class="dt-map"></div>
</div>
// the dt-map.component.js
@Component({
selector: 'dt-map',
templateUrl: './dt-map.component.html',
styleUrls: ['./dt-map.component.scss'],
})
export class DtMapComponent implements AfterViewInit, OnDestroy {
public map: mapboxgl.Map;
@ViewChild('map')
public mapElement: ElementRef;
constructor(private dtMapService: DtMapService) {
}
public ngAfterViewInit(): void {
this.map = this.dtMapService.getDtMap();
}
}
// the working e2e test
expect(await page.isMapVisible()).toBe(true, `MapBox is not visible`);
public async isMapVisible(): Promise<boolean> {
const el = await element(by.css('.mapboxgl-map'));
await Expection.visibilityOf(el);
return await el.isDisplayed();
}
//map.component.html
//dt-map.component.js
@组成部分({
选择器:“dt映射”,
templateUrl:'./dt map.component.html',
样式URL:['./dt map.component.scss'],
})
导出类DtMapComponent实现AfterViewInit、OnDestroy{
公共地图:mapboxgl.map;
@ViewChild('映射')
公共mapElement:ElementRef;
构造函数(专用dtMapService:dtMapService){
}
public ngAfterViewInit():void{
this.map=this.dtMapService.getDtMap();
}
}
//工作e2e测试
expect(wait page.isMapVisible()).toBe(true,`MapBox不可见`);
公共异步isMapVisible():承诺{
const el=await元素(by.css('.mapboxgl-map');
等待期待(el)的可视性;
返回等待el.isDisplayed();
}
我也有同样的问题。发生超时错误。问题是,至少我认为是这样,在web驱动程序控制流中。我不知道这可能是您的项目的问题,但正如我所看到的,浏览器开发工具中的网络选项卡是非常动态的。若我按下映射组件,所有测试都会遇到相同的问题。发生超时错误。问题是,至少我认为是这样,在web驱动程序控制流中。我不知道这可能是您的项目的问题,但正如我所看到的,浏览器开发工具中的网络选项卡是非常动态的。如果我按下映射组件,则所有测试都通过