Okay, so Laravel dusk is pretty amazing. The other day I was making my utility payment online which I encountered my monthly frustration of "Why don't these fools have an autopayment option." If only I could emulate my steps to making the payment. Then it dawned on me—I could use Laravel Dusk!
It took me about 15 minutes to write the browser test that submits the payment (see UtilityPayment.php).
The next step was to setup my Mac to run php artisan dusk
. To do this we will use Automator which comes with all Macs
Step #1: Open Automator, Select "Application"
Step #2: Select "Run Apple Script"
Step #3: Enter the following code, then save the application. I called mine "Pay."
on run {input, parameters}
tell application "Terminal"
activate
do script with command "cd ~/Code/Projects/dusk && php artisan dusk"
end tell
end run
Step #4: Create calendar alarm
Step #5: Select "Launch Application"
Step #6: Select the the Pay application we created.
Step #7: Go into your calendar and adjust your calendar event to match.
That's it!.