Minesweepers Anonymous

Once upon a time there lived a couple who loved playing massively multiplayer online role-playing video games with each other (World of Warcraft or Destiny or something). The thing about these games is that they’re a bit like exercise/fitness where you need to keep playing them to keep your score high, and if you don’t you play them (or exercise) enough your score (or fitness) starts dropping which makes it much less fun overall.

So playing these games all went well for the couple, for a while.

You see, one day the lady had a baby, and for those of you who have had babies or been around babies would know, babies are very resource intensive. So this meant the lady couldn’t play the game anywhere near as much as she would have liked, and it meant that her husband’s enjoyment of the game dropped also since his wife’s character, who he played with online, kept dropping in score.

So he did the most rational thing you can do in this situation and he started paying someone in Ukraine to play his wife’s character which kept her character’s score high enough for him to enjoy the game again.

And this all went well, for a while.

But you see, those of you who have fathered a child, or know someone who has fathered a child, may know that as the child gets a bit older the ‘father-child’ bond strengthens and it becomes more resource intensive for the father to be more involved in raising his child. So the husband found himself not having anywhere near enough time to play the game as he would have liked, and the person playing his wife’s character was continually out scoring him in the game.

So he did the most rational thing you can do in this situation and he started paying someone else in Ukraine to play his own character to keep his score high.

And this all went well, for a while… until he suddenly realised he could just stop, paying, both, people, to play the game anymore.

***

So imagine you really like playing Minesweeper but you too have resource/time constraints which stop you playing as much Minesweeper as you would like to. Minesweeper isn’t a massively multiplayer online role-playing video game, so you can’t really pay someone in Ukraine to play Minesweeper for you since there’s no online character or progress or such a thing to see this.

So the most rational thing you can do is build a robot to play Minesweeper for you, so you can open up a browser tab, visit minesweeper.github.io and click play instead of actually having to play yourself.

Once you do this enough you suddenly realise that you can just close your Minesweeper browser and go outside and play instead.

minesweepers-anon

***

When we wrote the original Minesweeper robot four years ago we used WebDriver to both test the game, the robot and for the robot implementation. This time around we used JavaScript exclusively to write both the game in Node, the UI in React, and the robot in Node that plays the game automatically in the browser using event listeners (nothing else required). This was the first project where I didn’t feel the need to use Selenium/WebDriver whatsoever whilst still maintaining confidence in our codebase. I foresee this happening a lot more as UI unit testing tools remove the dependency on having heavyweight WebDriver tests at all.

High thanks to my friend Mark Ryall for working on this with me: it was a load of fun. Now it’s time to go and spend some time outside.

Author: Alister Scott

Alister is an Excellence Wrangler for Automattic.

5 thoughts on “Minesweepers Anonymous”

  1. Why do you say that

    > “This was the first project where I didn’t feel the need to use Selenium/WebDriver whatsoever”

    Do you trust just the unit tests? No E2E tests?
    How do you check that your robot interacts correctly with the UI?

    Liked by 1 person

    1. Do you trust just the unit tests?

      Yes, we could test everything via unit tests including the game logic, the UI logic (React shallow rendering) and the robot logic.

      No E2E tests?

      No, we didn’t feel these were at all necessary since we had great unit test coverage

      How do you check that your robot interacts correctly with the UI?

      Manually – but because we had such good unit tests there wasn’t any major issues

      Like

Comments are closed.