-
Waiting for a page to load in Selenium::Remote::Driver with Selenium::Waiter
One of the first problems we come up against when trying to use Webdriver to automate a web application is handling the asynchronicity of loading a web page. For the test to be useful at all, it needs to be as fast and reliable as possible, or else there's a very real risk that devs and QA engineers will give up running the tests. The problem is that making the test run faster can sacrifice reliability if the async javascript isn't properly handled.
Instead of trying to figure out when a page loads, we should take a hint from what an actual user does. Users don't care when a page is done loading - they just wait for the exact element they want to interact with, and then start clicking/inputting right away. We can mimic that behavior with
wait_until, a utility function exported by Selenium::Waiter. -
Selenium::Remote::Driver@0.25: now with slightly less JRE
We've just released version 0.25 of Selenium::Remote::Driver to the various CPANs. The big push this time around was to get around our hard dependency on the JRE. Previously, the Perl bindings demanded a standalone selenium server be operating on the browser's machine. So, if you wanted to run tests on your own box, you'd need the Java Runtime Environment installed, as the selenium-standalone-server is a
.jarand needs the JRE to execute. However, as akafred pointed out, this is a prohibitive constraint (perhaps especially so for Perl programmers?).When I first started out working with Webdriver years ago, I only used the standalone server and for a while I thought there was no other way to run the tests. Eventually, when various webdrivers began replacing Selenium RC, I found out that it was possible to "talk" directly to them with the same exact API as the standalone server, but I never connected that with the ability to avoid needing the standalone server and the JRE!
Anyway, thanks to some long-awaited prodding, Perl can now run Firefox, Chrome, and PhantomJS without the JRE! What follows are some implementation details, and simple usage examples. :)
-
Imitating live reload in Emacs for Perl (or any) project :)
One of my favorite parts about my frontend JS workflow is using Live Reload with Grunt/Gulp. Saving a few keystrokes a couple times a minute is pretty great, especially if I can stay on the home keys. Grunt and Gulp have a task that watches the files in your project and then you kick can off certain tasks when they change, like refreshing your display and re-running all the unit tests. In Scala, you can get a similar thing by invoking your
sbtcommand prefixed with a~, but I didn't have anything for my Perl projects (not to mention a general solution!). -
Running perl's Test::More tests in parallel on OS X
Integration tests and e2e tests are very useful when developing apps, but unlike unit tests it's harder to keep them fast and snappy. In my case, I have to spin up multiple webdriver instances to test my webdriver automation framework as part of the e2e process. Although webdriver is now significantly faster than it used to be, running twenty tests in parallel is an order of magnitude quicker than running them all in series. I've started using Test::ParallelSubtest to achieve this speedup, due to trouble installing Test::Parallel on OS X.
-
Using Emacs for daily reminders to write in my ~/diary

I worked remotely for a year or so and I took it upon myself to figure out ways to improve my communication with HQ. One of the useful things I found was sending a weekly email summary to my manager, as a touch point for them to be able to see my week to week progress[1]. I soon realized that I had no memory at all for recalling what I did the previous day, much less for a whole week, so I began looking into what options Emacs offered for daily diary note-keeping kind of things[2].