Home / Blog / Buying a bicycle using Playwright
cicd testing ·

Buying a bicycle using Playwright

There is a time in every cyclist's life when they decide to change their bike. This year I felt it was my turn to do so. That's why I used e2e testing, wrote Telegram bots, and set up GH Actions.

Buying a bicycle using Playwright

This year I decided I wanted a new bicycle. I still love my Giant Contend but decided to switch to Canyon Grizl. Sadly, buying it wasn’t that easy. On the other hand, I was just after JS World and wanted to try some stuff out. Good news - I did it thanks to e2e testing, GitHub Action, and a Telegram bot.

The problem

The problem was simple - availability. There is only a limited time frame to preorder those bikes. First, I just signed up for their official newsletter - it should ping me when the bicycle is in stock. Luckily a friend at the bike store warned me that it may not work and it will better to check it manually every day at 6AM.

I hate waking at 6AM, and I love automating stuff, which leads to…

The solution

e2e testing

Checking availability was relatively easy. I had to go to a specific URL and see if one button had a particular class.

As I mentioned, I just came back from the JS World. Debbie O’Brien showed how amazing Playwright is, so I tried it. In the end, the real test looked like this:

The URL and SIZE were stored in the .env file. Simple, right?

Executing this every hour

I usually would use Buddy for this, but I tried GitHub Actions.

The moment when the class was gone, I would get a notification on Telegram. And that is what happened on the 27th of February at 15:06 :) 5 minutes later, the bike was mine.

What’s interesting - I never got the official notification, and all the bikes were gone later that day.

It's so beautiful

The moral

Logical thinking and problem-solving can be crucial in many situations. I used a more developer approach but could do this without code tools. There is a bigger chance that I would have to pay something for them.

Newsletter
Enjoyed this post?
Get new posts straight to your inbox. No spam, ever.
Subscribe →

Share your thoughts