How to create and manipulate promises in Protractor?

后端 未结 2 1070
北荒
北荒 2020-12-09 07:48

I want to use the Node Http module to call my server directly in order to set up my Protractor tests. Http is callback based and I want to turn that into promises.

F

2条回答
  •  半阙折子戏
    2020-12-09 08:17

    Protractor uses WebDriver's promises and exposes that API globally on 'protractor'. So you should be able to do

    var deferred = protractor.promise.defer();
    return deferred.promise;
    

    For the full WebDriverJS Promise API, see the code at https://code.google.com/p/selenium/source/browse/javascript/webdriver/promise.js

提交回复
热议问题