获取量角器测试中自定义状态更新的运行状态

时间:2018-11-16 03:41:29

标签: protractor

我正在尝试获取测试执行状态为通过,而对于量角器测试通常会失败。这样我就可以发送该状态来更新跨浏览器集成工具。我找不到找到状态的更好方法。帮助非常感谢。我的功能与此类似。想要在通过或失败时通过“状态”

      onComplete: function() {
        //set the score as passing
        browser.call(setScore, null, 'pass').then(function(result){
        console.log('set score to pass')
        });


      //Call API to set the score
      function setScore(score) {

       //webdriver has built-in promise to use
      var deferred = protractor.promise.defer();
      var result = { error: false, message: null }

      if (sessionId){

      request({
      method: 'PUT',
      uri: 'https://crossbrowsertesting.com/api/v3/selenium/' + sessionId,
      body: {'action': 'set_score', 'score': score },
      json: true
         },).auth("tester1.code@gmail.com", "Password1!");
      }else{
      result.error = true;
      result.message = 'Session Id was not defined';
      deferred.fulfill(result);
       }
  return deferred.promise;
   }
},

0 个答案:

没有答案