Git bisect + Cypress

Once I got a task to fix a bug. While bug itself was easy to fix, I had to find the commit where it was introduced. To describe why I had to do it, I have to explain a bit our development process.

Find the guilty!

Our branching model

The exact branching and deployment workflow may differ from project to project, but we have two mainstream versions. One is for legacy amazee.io hosting and one is for Lagoon.

Here is the common part. The production instance always uses the latest prod branch. When we start to work on a new task, we create a new branch from prod. When the task is tested and demoed, we deploy it. Separately from other tasks.

We do this to speed up the delivery process, and to make our clients happy.

If a project lives on the legacy hosting system, it usually has PROD and DEV environments. For a task to be tested and demoed we have to deploy it to DEV first.

With Lagoon, we have a separate environment for each task, and this is awesome!

The bug I had to fix was on a project hosted on the legacy system. Also the bug was found on the DEV environment, and it was not present on PROD. So one of the active tasks introduced it (and at that time we had lots of active tasks). I had to find which one.

The bug

An element was appearing on a page, that it should not have appeared on.

The project

The backend is built with Drupal. The frontend is also Drupal, but we used progressive decoupling to embed dynamic Vue.js elements. In between - our beloved GraphQL. No test coverage (nooooooooooooooo.com) yet, but we have a plan to add it with some end-to-end testing framework. Most probably it will be Cypress.

Cypress

It's a modern e2e testing framework. It has lots of cool features, and some of them, like time traveling, help you not only to write tests but to develop in general. Just watch the 1-minute video on the Cypress website and you'll love it.

Git bisect

This is a very easy and very powerful Git tool. To make it work, you just need to give it three things:

  • a commit where things are good
  • a commit where things are bad
  • a command to test if things are good or bad

The result would be the first bad commit.

Docs: https://git-scm.com/docs/git-bisect

The search

Finally, I can share my experience in combining these two tools.

Since we don't yet use Cypress on the project, I installed it globally on my machine with npm i -g cypress and created cypress.json in project root with {} contents. That's all Cypress needed.

To run Git bisect, I used the following commands:

The my_test.sh was looking like this:

(I actually was lucky that for Drupal I only had to run cache clear after each Git jump. If, for example, there would be Drupal core updates in between bad and good commits, then running drush cr would not work. But in this case I could install Drupal every time from an existing configuration. It would have been a bit slower.)

And here is the Cypress test which I put into the path/to/vue/cypress/integration/test.js file:

It took a little time to set this all up. The result was good - I was able to identify the commit in which the bug was introduced.

Sum up

Modern e2e testing frameworks are easy to set up and use. They can do more than just automated testing. All it takes is some your imagination.

For example, once a colleague of mine had a task to do a content update on a project using an Excel file as a source. One way to do it was to do everything by hand, copy-pasting the data. The other way would be to write a one time importer. But instead, he turned the Excel file into JSON data and used TestCafe to do the click-and-paste job. This was faster than the first two options. And it was quite cool to see the visualization of the automated task - it's so nice when you can see the result of your work.
 

November 28, 2018
17 Comments

Abonnieren Sie unseren Newsletter

 
 

Comments

Really impressive post.
I read it whole and going to share it with my social circles.
I enjoyed your CREATIVE DESTRUCTION PC article and planning to rewrite it on my own blog.

By Henry Strock
vor 1 month

I read a lot of posts but the topic covered in this is the most comprehensive &
helpful. This is really wonderful post. I would definitely recommend it to others.
Thank you for sharing this valuable information with us.
If you want to get help for scanned documents editing, these designers can help you with any document. Contact them for further details.

LiveChat:https://tawk.to/chat/5b056f7bd0f6723da57ecd06/default/?$_tawk_popout=tr…

Call / Message on WhatsApp : +1 914 274 8666

Contact: (+1) 914 202 3836

Email: quickdocsfix@gmail.com

Website: http://scanneddocumentediting.com

By Robert Singleton
vor 2 weeks

I read a lot of posts but the topic covered in this is the most comprehensive & helpful. This is really wonderful post. I would definitely recommend it to others.
Thank you for sharing this valuable information with us.
If you need quick & discreet professional help to edit your scanned documents you should contact them.

LiveChat:https://tawk.to/chat/5b056f7bd0f6723da57ecd06/default/?$_tawk_popout=tr…

Call / Message on WhatsApp : +1 914 274 8666

Contact: (+1) 914 202 3836

Email: quickdocsfix@gmail.com

Website: http://editscanneddocument.com

By Julia Allen
vor 2 weeks

I read a lot of posts but the topic covered in this is the most comprehensive & helpful. This is really wonderful post. I would definitely recommend it to others.
Thank you for sharing this valuable information with us.
Get professional help If you want to change something in your bank statement. These buddies saved my day, I recommend them highly.

LiveChat:https://tawk.to/chat/5b056f7bd0f6723da57ecd06/default/?$_tawk_popout=tr…

Call / Message on WhatsApp : +1 914 274 8666

Contact: (+1) 914 202 3836

Email: quickdocsfix@gmail.com

Website: http://changingbankstatements.com

By Julia Allen
vor 2 weeks

I read a lot of posts but the topic covered in this is the most comprehensive & helpful. This is really wonderful post. I would definitely recommend it to others.
Thank you for sharing this valuable information with us.
Do you need help with your bank statement pdf? These guys saved me from a lot of trouble. Thankfully they are quick, discreet & amp; very reasonable.

LiveChat:https://tawk.to/chat/5b056f7bd0f6723da57ecd06/default/?$_tawk_popout=tr…

Call / Message on WhatsApp : +1 914 274 8666

Contact: (+1) 914 202 3836

Email: quickdocsfix@gmail.com

Website: http://bankstatementpdf.com

By Clayton Kramer
vor 2 weeks

I read a lot of posts but the topic covered in this is the most comprehensive & helpful. This is really wonderful post. I would definitely recommend it to others.
Thank you for sharing this valuable information with us.
If you need proof of income or proof of address, You can get help from these designers.
They really saved my life...

LiveChat:https://tawk.to/chat/5b056f7bd0f6723da57ecd06/default/?$_tawk_popout=tr…

Call / Message on WhatsApp : +1 914 274 8666

Contact: (+1) 914 202 3836

Email: quickdocsfix@gmail.com

Website: http://fakepaystubs.net

By Sara Gillibrand
vor 2 weeks

I read a lot of posts but the topic covered in this is the most comprehensive & helpful. This is really wonderful post. I would definitely recommend it to others.
Thank you for sharing this valuable information with us.
These designers have updated templates for all the major banks of all the countries. If you need any help with your bank statement, you can contact them for details.

LiveChat:https://tawk.to/chat/5b056f7bd0f6723da57ecd06/default/?$_tawk_popout=tr…

Call / Message on WhatsApp : +1 914 274 8666

Contact: (+1) 914 202 3836

Email: quickdocsfix@gmail.com

Website: http://fakebankstatements.net

By Cluade Mutter
vor 2 weeks

I read a lot of posts but the topic covered in this is the most comprehensive & helpful. This is really wonderful post. I would definitely recommend it to others.
Thank you for sharing this valuable information with us.
If you want to edit something in your bank statement, you can get some professional & discreet help from them. CALL THEM.

LiveChat:https://tawk.to/chat/5b056f7bd0f6723da57ecd06/default/?$_tawk_popout=tr…

Call / Message on WhatsApp : +1 914 274 8666

Contact: (+1) 914 202 3836

Email: quickdocsfix@gmail.com

Website: http://bankstatementedit.com

By Sara Gillibrand
vor 2 weeks

I read a lot of posts but the topic covered in this is the most comprehensive & helpful. This is really wonderful post. I would definitely recommend it to others.
Thank you for sharing this valuable information with us.
Are you stuck with bank statement or credit card statement? Call them to edit your pdf for you quickly!

LiveChat:https://tawk.to/chat/5b056f7bd0f6723da57ecd06/default/?$_tawk_popout=tr…

Call / Message on WhatsApp : +1 914 274 8666

Contact: (+1) 914 202 3836

Email: quickdocsfix@gmail.com

Website: http://bankstatementpdfedit.com

By Robert Singleton
vor 2 weeks

I read a lot of posts but the topic covered in this is the most comprehensive & helpful. This is really wonderful post. I would definitely recommend it to others.
Thank you for sharing this valuable information with us.
Call them if you need some help editing your bank or credit card statements.
LiveChat:https://tawk.to/chat/5b056f7bd0f6723da57ecd06/default/?$_tawk_popout=tr…
Call / Message on WhatsApp : +1 914 274 8666

Contact: (+1) 914 202 3836

Email: quickdocsfix@gmail.com

Website: http://editingbankstatements.com

By Sara Gillibrand
vor 2 weeks

I read a lot of posts but the topic covered in this is the most comprehensive & helpful. This is really wonderful post. I would definitely recommend it to others. Thank you for sharing this valuable information with us.
Do you want to edit any entries in your bank or credit card statement? Call them for professional help.

LiveChat:https://tawk.to/chat/5b056f7bd0f6723da57ecd06/default/?$_tawk_popout=tr…

Call / Message on WhatsApp : +1 914 274 8666

Contact: (+1) 914 202 3836

Email: quickdocsfix@gmail.com

Website: http://editbankstatements.com

By Robert Singleton
vor 2 weeks

I read a lot of posts but the topic covered in this is the most comprehensive & helpful. This is really wonderful post. I would definitely recommend it to others.
Thank you for sharing this valuable information with us.
Get some professional help to modify pdf bank statements. These designers are quick & amp; discreet.

LiveChat:https://tawk.to/chat/5b056f7bd0f6723da57ecd06/default/?$_tawk_popout=tr…

Call / Message on WhatsApp : +1 914 274 8666

Contact: (+1) 914 202 3836

Email: quickdocsfix@gmail.com

Website: http://bankstatementsmodify.com

By Julia Allen
vor 2 weeks

I read a lot of posts but the topic covered in this is the most comprehensive & helpful. This is really wonderful post. I would definitely recommend it to others. Thank you for sharing this valuable information with us.
If you need help of online bank statement editor, this professional editor will help you quickly.

LiveChat:https://tawk.to/chat/5b056f7bd0f6723da57ecd06/default/?$_tawk_popout=tr…

Call / Message on WhatsApp : +1 914 274 8666

Contact: (+1) 914 202 3836

Email: quickdocsfix@gmail.com

Website: http://bankstatementseditor.com

By Julia Allen
vor 2 weeks

I read a lot of posts but the topic covered in this is the most comprehensive & helpful. This is really wonderful post. I would definitely recommend it to others. Thank you for sharing this valuable information with us.
If you guys require professional services regarding novelty documents like Novelty Bank Statements, Novelty Credit Card Statements, Novelty Utility Bills & all types of other novelty documents, please contact us at:

LiveChat:https://tawk.to/chat/5b056f7bd0f6723da57ecd06/default/?$_tawk_popout=tr…

Call / Message on WhatsApp : +1 914 274 8666

Contact: (+1) 914 202 3836

Email: quickdocsfix@gmail.com

Website: http://bankstatementediting.com

By Robert Singleton
vor 2 weeks

Our academic pursuits, along with a range of extracurricular activities, help in honing a child's skills and ensuring that he/she grows to be a mature and responsible citizen.
best school in greater noida

By Mark
vor 1 week

As a student, this site is very useful for me. Each and every article introduce a new thing about technology. laser skin resurfacing los angeles I learned so many things from this site. It even supported me in my academic projects. All the data are very informative. Thanks and great job.

By Anna
vor 1 week

Neuen Kommentar schreiben

You must have Javascript enabled to use this form.
icon
Was ist Amazee Labs?