I am cornholio and I need T.P. for my bunghole
Not the best first sentence to start a blogpost with, but people who know me well also know I really love Beavis and Butthead (yep, I’m from the nineties). Now I hear you think, “What the … has this to do with testautomation?” Well, I’m going to explain this in this post.
It all started on Friday the 15th of October. I had my usual daddy’s day, or also papa dag as we call it in the Netherlands, and I was doing some groceries with the kids when the client I worked for called me. The E2E test automation failed on Chrome on a specific scenario, but only on our cloud solution and not on the local machines. They asked if I knew or could take a guess what the problem could be. But when I stood there with peanut butter in my hand I really didn’t had a clue and told I would dive into when I was home. After a few hours I tried it at home and they were right. On my local machine everything worked fine, but on our cloud solution we had an error. I needed to let it go and start the investigation on Monday.
Because of my role as a collaborator on the Protractor github project I saw an issue coming in on Saturday that was almost equal to the issue we had with our testautomation. It was an issue with Chrome 61 and ChromeDriver 2.32 saying
“unknown error: Element is not clickable at point (x, y) when executing $(...).click() on element out of view”.
Basically it should scroll automatically before an element was clicked, like all Webdrivers do, but this browser + webdriver combination didn’t do that. Downgrading Chrome back to version 60 would be a temporary workaround until more will come clear from the ChromeDriver team.
A new bug
On Monday I downgraded Chrome, ran it on my own machine and everything worked fine. After a run on our cloud solution I saw that more then 50% of our tests failed, even on browser that were successful on Friday. It costed my colleagues and me a few hours but then we saw the problem. The problem was that we were using version
^4.3.6 on all Angular (dev) dependencies which gave us all latest Angular
4.4.1 (dev) dependencies. The latest
4.4.1 (dev) dependencies broke our implementation causing more then 50% of our tests to fail.
Why didn’t we saw it locally?
The reason why we didn’t saw this on our local machine was because we were using an old
npm install of our node modules. Each time we are running our tests on our cloud solution we do a fresh
npm install. This was resulting in newer versions and thus downloading the Angular
4.4.1 (dev) dependencies that broke our tests and build.
The question we asked ourself was “why did we get minor versions and not the only the patches (fixes)“. The answer lies in the usages of tilde (
~) and caret (
^) and can be found in the npm docs. It comes down to this
- The tilde matches the most recent minor version (the middle number).
~4.3.1will match all
4.3.xversions but will miss
- The caret, on the other hand, is more relaxed. It will update you to the most recent major version (the first number).
^4.3.1will match any
4.4.0, but will hold off on
I had seen this so many times but it didn’t got saved in my brain. To remind myself of this I needed to use a mnemonic, or also an ezelsbrug in Dutch (donkey bridge ;-)). Then I thought, “tilde stands for patch, caret for the rest”. That wasn’t a good mnemonic, so I tried to repeat it until teepee came out and then I got it!
“I am cornholio and I need teepee for my banghole”
.. there it is, the Tee (tilde) and the Pee (patch) and also the awesome link with Beavis and Butthead. Seems that I did learn something from them.
So if you now need to now the difference between the tilde and the caret, the great cornholio will help you out.
But now that I shared you my IT mnemonic, do you also have a great IT mnemonic for me?
By the way, we really need to reconsider our dependency management, but that’s a different mnemonic.