nixos/firefox: Port integration test to python

This commit is contained in:
Jacek Galowicz 2019-11-05 16:27:07 +01:00
parent 45b339b736
commit d6b7a9909e

View File

@ -1,4 +1,4 @@
import ./make-test.nix ({ pkgs, ... }: { import ./make-test-python.nix ({ pkgs, ... }: {
name = "firefox"; name = "firefox";
meta = with pkgs.stdenv.lib.maintainers; { meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ eelco shlevy ]; maintainers = [ eelco shlevy ];
@ -11,19 +11,27 @@ import ./make-test.nix ({ pkgs, ... }: {
environment.systemPackages = [ pkgs.firefox pkgs.xdotool ]; environment.systemPackages = [ pkgs.firefox pkgs.xdotool ];
}; };
testScript = testScript = ''
'' machine.wait_for_x()
$machine->waitForX;
$machine->execute("xterm -e 'firefox file://${pkgs.valgrind.doc}/share/doc/valgrind/html/index.html' &"); with subtest("wait until Firefox has finished loading the Valgrind docs page"):
$machine->waitForWindow(qr/Valgrind/); machine.execute(
$machine->sleep(40); # wait until Firefox has finished loading the page "xterm -e 'firefox file://${pkgs.valgrind.doc}/share/doc/valgrind/html/index.html' &"
$machine->execute("xdotool key space"); # do I want to make Firefox the )
# default browser? I just want to close the dialog machine.wait_for_window("Valgrind")
$machine->sleep(2); # wait until Firefox hides the default browser window machine.sleep(40)
$machine->execute("xdotool key F12");
$machine->sleep(10); # wait until Firefox draws the developer tool panel with subtest("Close default browser prompt"):
$machine->succeed("xwininfo -root -tree | grep Valgrind"); machine.execute("xdotool key space")
$machine->screenshot("screen");
with subtest("Hide default browser window"):
machine.sleep(2)
machine.execute("xdotool key F12")
with subtest("wait until Firefox draws the developer tool panel"):
machine.sleep(10)
machine.succeed("xwininfo -root -tree | grep Valgrind")
machine.screenshot("screen")
''; '';
}) })