diff options
author | aszlig <aszlig@nix.build> | 2020-08-29 00:57:47 +0200 |
---|---|---|
committer | aszlig <aszlig@nix.build> | 2020-08-29 01:08:17 +0200 |
commit | 0e72073cb6b5f2d6c3b1ec0eb87412dce809f48c (patch) | |
tree | eb28b1d0d148821d46fa11a84dae5ccfa1d73643 /tests/games | |
parent | ecbf74ae6117197f3b7560753f7db73e363f5991 (diff) |
tests: Switch all tests to Python test driver
Since the removal[1] of the Perl test driver, our tests will no longer run or even evaluate. Fortunately, the test API is more or less the same, so the transition to Python was not very involved. However, I did add a "# fmt: off" on top of every testScript, since formatting with black not only has issues with parameterised antiquotations but is also plain ugly to mix 2 spaces of indentation with 4 spaces of indentation. Additionally, I'd like to have a maximum line length of 79 characters in my Nix expressions while black on the other side even *insists* of using longer lines. [1]: https://github.com/NixOS/nixpkgs/commit/0620184f3f94f1bf8de014ab168 Signed-off-by: aszlig <aszlig@nix.build>
Diffstat (limited to 'tests/games')
-rw-r--r-- | tests/games/starbound.nix | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/tests/games/starbound.nix b/tests/games/starbound.nix index d1ef15e1..5fbb85aa 100644 --- a/tests/games/starbound.nix +++ b/tests/games/starbound.nix @@ -10,10 +10,9 @@ let ''; escapeScreenshot = pkgs.lib.replaceStrings ["-"] ["_"]; in '' - $client->nest("${description}", sub { - $client->screenshot("before_${escapeScreenshot name}"); - $client->succeed("${pkgs.xdotool}/bin/xdotool '${xdoFile}'"); - }); + with client.nested("${description}"): + client.screenshot("before_${escapeScreenshot name}") + client.succeed("${pkgs.xdotool}/bin/xdotool '${xdoFile}'") ''; clickAt = name: x: y: xdo { @@ -68,22 +67,22 @@ in { }; testScript = '' - $server->waitForUnit("starbound.service"); + # fmt: off + server.wait_for_unit("starbound.service") - $client->nest("waiting for client to start up", sub { - $client->waitForX; - $client->succeed("starbound >&2 &"); - $client->waitForText(qr/options/i); - }); + with client.nested("waiting for client to start up"): + client.wait_for_x() + client.succeed("starbound >&2 &") + client.wait_for_text('(?i)options') ${clickAt "join-game" 100 560} - $client->waitForText(qr/select/i); + client.wait_for_text('(?i)select') ${clickAt "new-character" 460 220} - $client->waitForText(qr/randomise/i); + client.wait_for_text('(?i)randomise') ${clickAt "create-character" 600 625} - $client->waitForText(qr/select/i); + client.wait_for_text('(?i)select') ${clickAt "use-character" 460 220} - $client->waitForText(qr/ser[vu]er/i); + client.wait_for_text('(?i)ser[vu]er') ${clickAt "server-address" 460 322} ${typeText "server-address" "192.168.0.1"} @@ -96,8 +95,8 @@ in { ${clickAt "join-server" 495 420} - $client->waitForText(qr/graduation/i); - $client->sleep(30); - $client->screenshot("client"); + client.wait_for_text('(?i)graduation') + client.sleep(30) + client.screenshot("client") ''; } |