当从带有超时-错误的mapbox-gl-js中传递带有集成地图的页面时,角度e2e测试失败,错误>>

问题描述 投票:1回答:1

我们的Angular应用程序包含不同的页面,其中一个页面显示与mapbox-gl-js

集成的地图。

由于我们集成了mapbox,因此量角器e2e测试失败。一旦测试到达显示地图的页面,则在同一页面上任何其他HTML元素的下一次单击都会导致以下错误:Timeout-在jasmine.DEFAULT_TIMEOUT_INTERVAL指定的超时内未调用异步回调。] >

在测试工作正常之前。

似乎,量角器无法在页面上找到任何HTML元素进行验证。唯一可能的是单击页面上的另一个元素,但是页面只会冻结直到发生超时错误。

例如:

  1. e2e-test到达地图
  2. 我可以单击带有地图的页面上的按钮
  3. 超时错误
  4. 对此有任何帮助,将不胜感激。

    // 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();
    }
    
    

我们的Angular应用包含不同的页面,其中一个页面显示了与mapbox-gl-js集成的地图。由于我们集成了mapbox,因此量角器e2e测试失败。测试到达页面后,...

angular protractor mapbox-gl-js angular-e2e
1个回答
0
投票

我有同样的问题。发生超时错误。问题是,至少在我看来,是在Web驱动程序控制流程中。我不知道这可能是您的项目出现的问题,但是正如我看到的那样,浏览器开发人员工具中的“网络”标签非常动态。如果我拒绝地图组件,则所有测试都会通过

© www.soinside.com 2019 - 2024. All rights reserved.