Simon Tasker

Games, apps, and the occasional detour.

App Dev · · 2 min read

NetLay: Keeping the pictures honest

A manual made of screenshots goes stale the day a feature lands, so the robot ran again, and once again the act of taking the pictures found the bugs.

The bill for automated screenshots#

Post twenty one made a virtue of the guide's pictures being taken by a script rather than a person. Here is the bill for that: when a feature lands, you have to run it again, and the demo data has to contain the new thing.

DHCP tracking and duplicate addresses needed data the demo office had never had. A device whose lease has moved it. A reservation being ignored. Two devices fighting over one address.

So the demo grew five more devices on the warehouse switch, in a row of their own: a hot desking laptop whose lease has moved it, a door controller with a reservation that is not being honoured, a kiosk with no MAC recorded that gets one from the lease file, and two PCs sharing an address.

The tracker itself is switched off while the pictures are taken, so there is no sweep, no SNMP and no waiting. The lease file is imported through the API with made up MAC addresses, the whole thing runs once, and the shots come out.

Seven new pictures, six of which went into the guide.

What running it again caught.#

Exactly as last time, the pictures found problems the tests never would.

Nearly every device in the demo had been given the address 127.0.0.1, because that reliably answers a ping and makes the status dots green. That was harmless right up until the duplicate address check existed, at which point the entire demo office would have lit up with warnings about thirty devices sharing one address. The demo now hands every device its own loopback address, which is the sort of fix that takes two minutes and would have taken an afternoon of confusion if a stranger had seen it first.

The picture of the recent changes table came out identical to the picture of the tracking window, because the script scrolled an element that does not scroll. The second attempt cut the table off at the window edge. The fix in the end was to give the browser a very tall window, lift the height caps and crop between two known headings, which is inelegant and works.

And the five new demo devices initially landed on top of existing ones, because I had not given them positions and the defaults put them somewhere already occupied.

The other use for the same pictures#

There is one more thing the script now feeds, which is this blog.

The same files get copied into my notes as the illustrations for these posts, with the stand-ins marked as stand-ins so I know which ones are the closest available picture rather than the exact thing the text describes.

Which means the pictures in the guide, the pictures in the help, and the pictures in whatever I write about it all come from one run of one script against a known demo site. They cannot drift apart from each other, and none of them contain anything real, which matters because the actual map this tool was built for is a description of somebody's network and does not belong on the internet.

Next time, writing the code down for whoever opens it next.