我正在尝试测试当前是否正在播放 Html 视频,但似乎无法弄清楚如何获取currentTime
. 我一直在尝试这样的事情:
async videoIsPlaying(indexOfVideo = 0) {
return ClientFunction(() => {
const video = document.getElementsByTagName('video')[indexOfVideo];
return video.currentTime > 0;
});
}
但我的期望:
await t.expect(await playerPage.videoIsPlaying()).eql(true);
正在返回:
AssertionError: expected [Function: __$$clientFunction$$] to deeply equal true
我究竟做错了什么?另外,我使用的.eql()
是因为.ok()
任何结果都返回真值。