You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The wrapped function inside javascript/node/selenium-webdriver/testing/index.js should correctly return arguments to the wrapped function for pending tests.
Actual Behavior -
In cases of pending tests, the first and only argument is a title string but the wrapper returns a new function with a function as the first argument instead. The title string is discarded entirely. The issue is not immediately apparent as the test run will continue without error. However, the Test object will not have all properties as expected which can cause issues for some advanced reporters.
Steps to reproduce -
Create a test
// test.jsvartest=require('selenium-webdriver/testing');test.it('Pending test should be written');
Run the test via CLI
mocha test.js
The wrapped function will be called with one argument, a string, "Pending test should be written". It will then call this function:
// selenium-webdriver/testing/index.jsfunctionmakeAsyncTestFn(fn){varasync=fn.length>0;// if test function expects a callback, its "async"varret=/** @type {function(this: mocha.Context)}*/(function(done){varrunnable=this.runnable();varmochaCallback=runnable.callback;runnable.callback=function(){flow.reset();returnmochaCallback.apply(this,arguments);};vartestFn=fn.bind(this);flow.execute(functioncontrolFlowExecute(){returnnewpromise.Promise(function(fulfill,reject){if(async){// If testFn is async (it expects a done callback), resolve the promise of this// test whenever that callback says to. Any promises returned from testFn are// ignored.testFn(functiontestFnDoneCallback(err){if(err){reject(err);}else{fulfill();}});}else{// Without a callback, testFn can return a promise, or it will// be assumed to have completed synchronouslyfulfill(testFn());}},flow);},runnable.fullTitle()).then(seal(done),done);});ret.toString=function(){returnfn.toString();};returnret;}
The return will be an object, ret with a runnable property that, if called, will fail due to var testFn = fn.bind(this). You cannot call .bind() on a string. There is no obvious error, however, because this all gets wrapped in a promise.
The text was updated successfully, but these errors were encountered:
Meta -
OS: OSX
Selenium Version: 2.53.2, Node.js
Expected Behavior -
The
wrapped
function insidejavascript/node/selenium-webdriver/testing/index.js
should correctly return arguments to the wrapped function for pending tests.Actual Behavior -
In cases of pending tests, the first and only argument is a title string but the wrapper returns a new function with a function as the first argument instead. The title string is discarded entirely. The issue is not immediately apparent as the test run will continue without error. However, the Test object will not have all properties as expected which can cause issues for some advanced reporters.
Steps to reproduce -
Create a test
Run the test via CLI
The
wrapped
function will be called with one argument, a string, "Pending test should be written". It will then call this function:The return will be an object,
ret
with arunnable
property that, if called, will fail due tovar testFn = fn.bind(this)
. You cannot call.bind()
on a string. There is no obvious error, however, because this all gets wrapped in a promise.The text was updated successfully, but these errors were encountered: