Schrödinger and the quantum mechanics of test automation
This issue is similar to what is known as the measurement problem in quantum mechanics. Putting it simply, measuring the outcome of an event at the quantum level can change the outcome of the event. Imagine testing the temperature of cold water with a warm thermometer. Over time, the measuring equipment warms the cold water slightly and the equipment itself cools from the cold water. Thus, readings over time become inconclusive.
In this case, sending details to the console window puts a little more overhead on the system. The speed of execution of the statements changes slightly, and so does the completion order, giving different results each time. This has a lot to do with the prioritization of statement execution in the JavaScript event Loop, as shown next:
Figure 4.1 – A visualization of the execution order of promises and callbacks in the JavaScript Event loop
JavaScript has an...