D.R*_*oij 3 javascript testing reactjs e2e-testing testcafe
我想做的是打印/使用Polyline属性的值。
<Polyline points="x,y x,y x,y x,y">
Run Code Online (Sandbox Code Playgroud)
我尝试用这些方法来获取它们:
这是一个实用函数
export const getPointAttribute = async () => {
const polyline = s.polyline;
const polylineData = ClientFunction(() => polyline().attributes, {
dependencies: { polyline }
});
return polylineData
}
Run Code Online (Sandbox Code Playgroud)
这是测试脚本里面的
test('', async (t) => {
console.log(u.getPointAttribute())
}
Run Code Online (Sandbox Code Playgroud)
或者
test('', async (t) => {
console.log(s.polyline.getAttribute('points'));
}
Run Code Online (Sandbox Code Playgroud)
我将我的选择器包括在外部
import * as s from '../utilities/selectors';
Run Code Online (Sandbox Code Playgroud)
但我得到的只是控制台日志中输出的承诺
承诺 { }
或者
ReExecutablePromise { _then: [], _fn: [函数], _taskPromise: null }
任何帮助表示赞赏!
您应该在 console.log 中等待调用:
test('', async (t) => {
console.log(await s.polyline.getAttribute('points'));
}
Run Code Online (Sandbox Code Playgroud)
或者
test('', async (t) => {
console.log(await s.polyline.getAttribute('points'));
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2911 次 |
| 最近记录: |