【发布时间】:2019-02-27 04:22:12
【问题描述】:
我有一个 Angular 7 应用程序。我正在使用 cypress 来测试一些画布/地图组件。我需要在组件中调用一个函数来验证 geojson 是否显示在地图上。
在 chrome 中,我通过控制台调用 ng.probe($0).componentInstance.draw.getAll(),我的数据被记录到控制台,但是当我在 cypress 测试中进行相同的调用时:
cy.window().then((win) => {
const res = win.ng.probe($0).componentInstance.draw.getAll();
console.log(res);
})
我收到ReferenceError: $0 is not defined
我将如何在 cypress 中调用我的角度函数?
【问题讨论】:
标签: angular e2e-testing cypress