This project is for automating my monthly pass renewal from the AT HOP website.
-
It’s a pain to do, have to login and click all the right buttons, it isn’t obvious
-
There’s no way to automate it like the auto top up feature
-
I can automate it using Selenium WebDriver
Since it’s an expensive operation ($140/month), I’ll want to be notified of any successful or failed purchases.
I’ll also need to store my AT HOP credentials in the database. This is also risky, encryption is necessary.
Records of any purchase should be kept, and any failures should be made apparent with enough time left on the monthly pass to prevent it from lapsing
An AT HOP account has the data needed to access the AT HOP website.
-
email
-
password
-
run_on_day - the day of the month it should renew its monthly pass
A purchase record is associated with an account, it should record what happened when we tried to buy something. Any kind of data related to the purchase should be stored here in case something goes wrong.
-
state - queued, success, failure
-
simulated - just a test of the account and the webdriver flow
-
log - webdriver events that occurred during the purchase
-
url - the starting url?
Renewing a monthly pass goes like this
-
Navigate to at.govt.nz/athop
-
Click login button (dodge the session storage crap)
-
Submit login form
-
Click Top up my card button
-
Click Buy a pass link
-
Select HOP Monthly
-
(optional) choose start and end zone (default Zone A for both)
-
Click Apply button
-
If card details are saved, it will be filled out automatically and you can click purchase
-
(optional) Click Pending transactions link
-
(optional) Verify that the table contains a transaction with transaction type “Buy travel pass”
-
Introduce Sidekiq and Redis for complete automation
-
deploy to Heroku
-
Check time remaining on current monthly pass
-
Verify the pending transaction before and after purchasing