0.18.8
Released 02/05/2017
Overview:
- We have officially implemented our Sinon.JS integration: adding cy.stub(), cy.spy(), cy.clock(), and cy.tick(). We've matched Sinon's API's and added
sinon-as-promisedandchai-sinon. In addition we've fixed Sinon performance issues, and improved the display of assertion passes and failures. - These new API's will work well in both
unittests andintegrationtests.
Features:
- You can now use cy.stub() and cy.spy() synchronously. These both match the Sinon API identically. We will display
stub/spycalls in the command log and provide the call count, arguments, context, and return values when you click on the log. Stubs are automatically reset between tests. Fixes #377. - We've added our own special aliasing flavor to cy.stub() and cy.spy(). You can use the .as() command and we will associate spy and stub invocations (the same way we do with XHR aliasing and route matching).
- We've added cy.clock() and cy.tick() which are both asynchronous methods to modify timers in your application under test. We automatically apply clock (even if you invoke it before your first cy.visit()) and will automatically reapply it after page load. cy.tick() will enable you to control the amount of time you want passed in your application. This is great for controlling throttled or debounced functions.
sinon-as-promisedis automatically applied under the hood which extends Sinon and provides the.resolves(...)and.rejects(...)API's which makes it easy to stub promise returning functions.- We support and display multiple sub spies when using Sinon's
.withArgs(...)function.
Misc:
- We've enhanced
chai-sinonby improving the output during passes or failures. Fixes #31. - We've ripped out Sinon's argument serialization in favor of our own.
- We no longer send Sinon to the remote application under test. In other words, you'll no longer see
sinon.jsbeing sent as a network request. - Deprecated the undocumented
cy.agentsfunction, but it will continue to work and will be officially removed later.