As COVID-19 has brought this world to a standstill, we as humans are battling it out. Getting vaccinated is one of the key ways to fight this virus. All countries have started Vaccine Drives and they have their own way of implementing this nationwide task. In India, the government has created a single portal for the Vaccine Drive. All population residing there needs to check and schedule vaccines through this portal.
Being one of the heavily populated countries in the world, getting vaccinated and finding a slot for the vaccine is kind of a hassle. I was doing the same redundant task of logging into the portal and checking for the availability of vaccines and never got anywhere.
Then it hit me, wait a minute… I am an Automation Engineer, I should be able to figure something out, and after all, this is a repeated well-defined task. This is when I thought of automating vaccine availability 💪
Now comes the next part of the challenge – “How?” and “with What?”. At this time many tools are available in the market with which we can automate, but I wanted to complete this task with less effort and zero cost. This is also based on the fact that there are fewer parameters and no complex steps involved. I also wanted it to be done with minimal configuration.
Considering all these aspects, the first platform that came into mind was TestProject. The first time I had heard of TestProject was during the last Selenium Conference. Though I knew it had good capabilities and was built upon Selenium and Appium, I had not given it much try. I thought this time I should, and O boy, I am glad I did. Next thing I know I was running my first test on my mobile and tackling the problem at hand 🤯
The Scenario – Automating Vaccine Availability
The vaccination portal the government of India has created is called Co-WIN. We can access the portal from web as well as mobile. There are also open and protected APIs associated with the same. The web portal that I mentioned above can be used for checking the availability, however, for scheduling, it has to go through a CAPTCHA, which is kept specifically to avoid automation. API also faces a similar roadblock where an authorization token needs to be passed for scheduling.
Therefore, I am accomplishing the scenario using the government’s official mobile app called Arogya Setu.
Let me begin this attempt with few disclaimers since I do not want to mislead anyone in convincing them that this is a foolproof method.
- My primary intention was how to get this task done with minimal effort. This is the reason I thought of using TestProject and its powerful Addons.
- I created the job on an hourly basis as I did not want to overload the Portal. Be responsible! 🙏
- This entire implementation has been great learning for me and I was amazed by how easily this could be implemented using TestProject.
- I have added Android as my device here but the same can be achieved also through an iOS device.
- I did not go into detail about TestProject aspects like Agent installation and mobile connection etc., because it is already well documented in TestProject Docs and is pretty easy and straightforward.
Implementation – Let the TestProject Begin!
So let’s dive into it. There are two aspects to our scenario. One is the availability check and the other is the scheduling part. We can do the availability check without logging in. So we will be using two tests for the purpose of convenience. For both cases, I have created a mobile test and in record mode of TestProject 📱
Let’s first implement the schedule vaccine test. The steps that were used are as follows:
- Launch the Arogya Setu App, click on Co-WIN, click Proceed of Vaccine Login.
- Input the mobile number, Click on ‘Proceed to verify’.
- Capture the SMS received using the ‘Get latest SMS text‘ Addon.
- Use the ‘Get substring in range‘ function from the Addon ‘String Utils‘ to extract the OTP part.
- Capture the OTP in a parameter and use it as an input parameter, then successfully Login and click on Schedule Search.
- Enter Pin, Select hospital, and click on Schedule 📆
Now for the Vaccine Availability Automation check Test. The steps that were used are as follows:
- Launch the Arogya Setu App, click on Co-WIN, and click Proceed of Vaccine Availability.
- Enter Pin and check for the Vaccine slot. To verify whether slots are available click on Schedule (Verify whether the availability count is 0).
- If Step 2 fails (which means that here the slot is not zero) create a recovery step and run the Schedule Vaccine Test.
Create a job and add the test for Vaccine Availability alone and schedule it as per your need. The Schedule Vaccine Test runs only if the Vaccine Availability Test fails (here in this case when slot is available). I am triggering emails after the completion of the tasks. This is also easily configurable through TestProject.
I have shown you the general flow, but the above steps can be customized based on your needs.
There is also another option of combining API and Mobile testing together to achieve the end goal of making the test even faster. TestProject also supports the build of customized Addon using its open source SDK. Therefore, the possibilities are endless. Stressing on the point again, though TestProject holds great power, keep in mind to use it ethically and morally. As said in Spiderman, “With Great Power comes Great Responsibility!” 🙌
Try it out, customize the flow according to your needs, and get vaccinated! 💉