tests: add waitForPromise method and test for it

This commit is contained in:
webzwo0i 2020-10-09 20:50:47 +02:00 committed by John McLear
parent 86c0648ede
commit a3f062af96
2 changed files with 58 additions and 0 deletions

View file

@ -197,6 +197,17 @@ var helper = {};
return deferred;
};
/**
* Same as `waitFor` but using Promises
*
*/
helper.waitForPromise = async function(...args) {
// Note: waitFor() has a strange API: On timeout it rejects, but it also throws an uncatchable
// exception unless .fail() has been called. That uncatchable exception is disabled here by
// passing a no-op function to .fail().
return await this.waitFor(...args).fail(() => {});
};
helper.selectLines = function($startLine, $endLine, startOffset, endOffset){
// if no offset is provided, use beginning of start line and end of end line
startOffset = startOffset || 0;