weixin_39947521
weixin_39947521
2020-12-08 20:37

KITE Dynamic Received Video Check?

Is possible with KITE to make Dynamic Received Video Check? We have a test case for monitoring videos, sometimes we need to monitor two feeds, sometimes three etc. Till now we can check videos by editing numberOfParticipants in config file. Is possible to write a script with KITE and check videos without editing the numberOfParticipants, knowing sometimes you have three feeds sometimes four feeds etc.

Our code looks like this: Config File: "numberOfParticipant": 2, ReceivedVideoCheck: `const {TestStep, KiteTestError, Status, TestUtils} = require('kite-common');

/* / class ReceivedVideoCheck extends TestStep { constructor(kiteBaseTest) { super(); this.driver = kiteBaseTest.driver; this.timeout = kiteBaseTest.timeout; this.numberOfParticipant = kiteBaseTest.payload.numberOfParticipant; this.page = kiteBaseTest.page; this.takeScreenshot = kiteBaseTest.takeScreenshot; this.testReporter = kiteBaseTest.reporter; }

  stepDescription() {
    return "Check videos are being received OK";
  }

  async step() {
    let result = "";
    let tmp;
    let error = false;
    try {
        for(let i = 0; i < this.numberOfParticipant; i++){
           // if( i != -1 )
           // {

            tmp = await this.page.videoCheck(this, i);
            result += tmp;
            if (i < this.numberOfParticipant) {
                result += ' | ';
            }
            if (tmp != 'video') {
                error = true;
            }
        }
        if (error) {
            this.testReporter.textAttachment(this.report, "Received videos", result, "plain");
            throw new KiteTestError(Status.FAILED, "Some videos are still or blank: " + result);
        }
    } 
//}
     catch (error) {
      console.log(error);
      if (error instanceof KiteTestError) {
        throw error;
      } else {
        throw new KiteTestError(Status.BROKEN, "Error looking for the video");
      }
    }
    if (this.takeScreenshot) {
      let screenshot = await TestUtils.takeScreenshot(this.driver);
      this.testReporter.screenshotAttachment(this.report, "Screenshot step", screenshot); 
    }
  }
}

module.exports = ReceivedVideoCheck; MainPage: async videoCheck(stepInfo, index) { let checked; let i; let timeout = stepInfo.timeout; await TestUtils.waitForVideos(stepInfo, videos); checked = await verifyVideoDisplayByIndex(stepInfo.driver, index); while(checked.result === 'blank' && i < timeout) { checked = await verifyVideoDisplayByIndex(stepInfo.driver, index); i++; await waitAround(1000); } return checked.result; }

async getVideos() { return videos; }`

该提问来源于开源项目:webrtc/KITE

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

4条回答

  • weixin_39860849 weixin_39860849 5月前

    Hello,

    For this, I think you should try something along the line of checking the number of video elements on the page. I'm not sure about this syntax, I haven't use the Js API in a while:

    let numberOfVideo = webdriver.findElements(By.tagName('video')).lenght();

    and then use this numberOfVideo instead of your numberOfParticipant.

    Let me know if it works 😄

    点赞 评论 复制链接分享
  • weixin_39947521 weixin_39947521 5月前

    No it doesn't work!

    点赞 评论 复制链接分享
  • weixin_39860849 weixin_39860849 5月前

    It doesn't work because you could get the number of video element on the page?

    Did you get any error?

    Is there any way to get the number of video feed you have? You can put a text displaying that on the page and get that by element.getText().

    Is there an API on your web app that allow getting this number of participants by executing Js on the browser console? You can execute that with the webdriver's API to retrieve this value.

    What else have you tried?

    It is possible to write a script to check it dynamically, but I can't write the script for you. I can suggest some ideas, but if your only feed back is "it doesn't work" then I can't further develop these ideas.

    点赞 评论 复制链接分享
  • weixin_39860849 weixin_39860849 5月前

    closed till more info

    点赞 评论 复制链接分享

相关推荐