Stubbing date in cucumber client end to end testing


Hi everyone,
for my end to end test in the browser with Cucumber, i need to replace the Date Object with a fake Object which would allow it to report a stable Date.
However i don’t know how to execute client code in cucumber (and where i should put it for my fake Date to be available in all scopes where it’s needed).
Thank you.


in a step, you can access the browser’s execute / executeAsync:

var runInBrowser = function(done) {
  // here you have the browser context, so you can bend time
  // if using exexuteAsync below, be sure to call done() at the end

// in a step context



Thank you Sam, will try that.