0.11.0
Released Released on September 12, 2015
Summary:
This release marks a major change in the underlying algorithms used to prevent testing flake. It is a major goal of Cypress to combat and prevent all test flake. These algorithm changes go a long way towards making this a reality, and have been months in the making.
Cypress can now predict upcoming assertions and modifies its behavior until the intended state has been reached.
Command options
exist/visible/lengthhave been deprecated, these were confusing and limiting, and the same result can now be achieved using normal assertions. The end result is much more robust and much easier to understand.
Features:
Commands which precede assertions will now look downstream at those assertions and not resolve until their subject's state passes all assertions. Previously this was sort of implemented using Command Options and the
eventuallyflag, but now this is the default behavior. Command Options only worked on DOM-based subjects, and now the new assertion verification works on everything else (including RL-based commands, etc). What this means is that Cypress can predict what you are requesting and automatically modifies its behavior until this state is reached. This prevents test brittleness / random test flake. Additionally this removes ever having to usecy.wait(Number)orcy.wait(Function)(though this is still a valid command). As a side effect, you will now see commands + their assertions in the spinning pending blue state. When assertions fail their associated command also fails at the same time. This visually represents the coupling between these two concepts. Another side effect is thattimeoutoptions do not need to be provided on the succeeding assertions, and can instead just be provided on the proceeding command. All of the coupled assertions will automatically be retried to the maximumtimeoutsetting. Fixes #43.Action commands will now insert an artificial delay after resolving to enable modern JavaScript frameworks time to flush their run loops. snapshots are delayed until after the action, resulting in more accurate snapshots because JavaScript frameworks would not process these DOM events until
Nmilliseconds after they occurred. This has the unfortunate side effect of decreasing performance by about 5-10% but the end result is that it is much easier to debug and Cypress is less prone to flake caused by modern JavaScript frameworks. This change comes after collecting many data points and this was one of the easiest changes that help reduce flake. For users that don't use the latest and greatest JavaScript frameworks, this action delay can be reduced throughcypress.jsonwhich may speed up large test suites.Aliasing custom commands now intelligently figures out where to apply the alias without being specified inside of the actual custom command.
The algorithm for replaying aliased commands is now much more accurate, handles stale element references better, and will not replay commands which have a side effect (like action commands). The end result is Cypress will now almost always find the desired element by determining the minimum number of re-queries and is not susceptible to stale element references. Additionally using assertions on aliased elements now works (where previously using a Command Option on an alias would just be ignored. This was very difficult to implement but should be 100% solid. Fixes #36.
Assertions which actually produced 2 assertions (under the hood) such as
should('have.attr', 'href', '/users/1')will now only log the 2nd assertion, unless the first fails.Previously using
eventually.have.lengthwas impossible (and this would throw an error), but now this works as you'd expect with the defaultshould('have.length').
Bugfixes:
Aliased commands now correctly output a command log again when they are replayed.
Assertions that involved an
{exp}property are no longer incorrectly substituted with the#{this}subject.Removed special logic for Angular which tapped into its digest cycle for queueing commands. This had unpredictable results when there was n
intervalset, and is now superseded by the new queueing system anyway (which is more performant).Sinon'sformatting of failedspyorstubcalls is horrendously non-performant and would sometimes choke the CPU for several seconds. This formatting has been completely removed and will be replaced by something less outrageous later on. At the moment you can still use the built in Cypress debugging (clicking on a command log, etc) to see what the actual values were. Fixes #18.
Misc:
The internal retry loop of Cypress now runs at
60fps, instead of20fps.Cypress overrides chai's default inspection function for DOM elements meaning instead of seeing
{ Object (0, length, ...) }you will now see the nicely formatted Cypress DOM element like:<button#primary.btn-large>.Cypress now overrides chai's
matchchainer and provides a specific error message when a nonregexvalue is provided. Fixes #58.Cypress now handles
lengthandexistassertion chainers in a very specific way, providing a detailed message on failure, and utomatically slices out any stale element references.The
containassertion chainer fromchai-jqueryhas been extended to match the same selector logic ascy.contains()- meaning it now checks thevalueofinput[type=submit].Tweaked the label for displaying the number of elements a command resolved with (now displays 0 differently than > 1).
Removed the
eventuallyflag in assertions as now this is the default behavior on normal assertions.Deprecated all Command Options. You will see a very nice and simple error message explaining how to convert these to assertions.
.within()can now be silenced with{log: false}.Many error messages have been rewritten to be much more fluent and easier to understand.
Other News:
Cypress is currently seeking to raise a Series A. This will enable us to grow the team and speed up development but seeking it has come at a cost for current development speed. If you have any VC connections please send them our way.