我们可以使用量角器测试视频播放,暂停和音频

Can we use protractor to test video play,pause and audio?

本文关键字:暂停 音频 播放 视频 可以使 量角器 测试 我们      更新时间:2023-09-26

我在页面上嵌入了一个视频。当我点击播放图标时,它在JW播放器上打开。可以用量角器测试视频的播放、暂停和音频功能吗?

有什么建议吗?

因为它是一个flash播放器,你不能在DOM元素上运行断言。但是,您可以为断言使用播放器API:

it('it should be possible to play video', function () {
  //play is initially at position 0
  expect(browser.executeScript('jwplayer().getPosition()')).toBe(0);
  $('video-container').click(); //clicks on the middle of the container div starts the diveo
  browser.sleep(2000);
  $('video-container').click(); //clicks on the middle of the container div stops the diveo
  //play has moved its position
  expect(browser.executeScript('jwplayer().getPosition()')).toBeGreaterThan(0);
});