I'm doing JavaScript e2e test with nightwatch.js, and I want to mock the clock with sinon.js's fake timer http://sinonjs.org/docs/#clock
But test stops before finish it, I got the log like below, and doesn't progress anymore.
[some test] Test Suite
===============================
✔ Element <body> was visible after 5000 milliseconds.
My test code is like below. How can I solve the problem? Thank you.
module.exports = {
before: function(browser) {
clock = sinon.useFakeTimers(new Date(2015, 7, 20).getTime());
},
after: function(browser) {
clock.restore();
browser.end();
},
'some test': function(browser) {
const browserName = this.client.options.desiredCapabilities.browserName;
browser
.url('some/path/')
.waitForElementVisible('body', 5000)
.pause(5000); // I need to use pause here
clock.tick(5001);
browser
.expect.element('.someElement').to.be.enabled;
},
};