Loading nixos/tests/firefox.nix +14 −16 Original line number Diff line number Diff line import ./make-test-python.nix ({ pkgs, firefoxPackage, ... }: let firefoxPackage' = firefoxPackage.override (args: { extraPrefsFiles = (args.extraPrefsFiles or []) ++ [ # make sure that autoplay is enabled by default for the audio test (builtins.toString (builtins.toFile "autoplay-pref.js" ''defaultPref("media.autoplay.default",0);'')) ]; }); in { name = firefoxPackage'.unwrapped.pname; name = firefoxPackage.pname; meta = with pkgs.lib.maintainers; { maintainers = [ eelco shlevy ]; }; Loading @@ -17,10 +10,13 @@ in { pkgs, ... }: { imports = [ ./common/x11.nix ]; environment.systemPackages = [ firefoxPackage' pkgs.xdotool ]; environment.systemPackages = [ pkgs.xdotool ]; programs.firefox = { enable = true; preferences."media.autoplay.default" = 0; package = firefoxPackage; }; # Create a virtual sound device, with mixing # and all, for recording audio. Loading Loading @@ -58,7 +54,9 @@ in }; testScript = '' testScript = let exe = firefoxPackage.unwrapped.binaryName; in '' from contextlib import contextmanager Loading Loading @@ -97,7 +95,7 @@ in with subtest("Wait until Firefox has finished loading the Valgrind docs page"): machine.execute( "xterm -e '${firefoxPackage'.unwrapped.binaryName} file://${pkgs.valgrind.doc}/share/doc/valgrind/html/index.html' >&2 &" "xterm -e '${exe} file://${pkgs.valgrind.doc}/share/doc/valgrind/html/index.html' >&2 &" ) machine.wait_for_window("Valgrind") machine.sleep(40) Loading @@ -105,7 +103,7 @@ in with subtest("Check whether Firefox can play sound"): with record_audio(machine): machine.succeed( "${firefoxPackage'.unwrapped.binaryName} file://${pkgs.sound-theme-freedesktop}/share/sounds/freedesktop/stereo/phone-incoming-call.oga >&2 &" "${exe} file://${pkgs.sound-theme-freedesktop}/share/sounds/freedesktop/stereo/phone-incoming-call.oga >&2 &" ) wait_for_sound(machine) machine.copy_from_vm("/tmp/record.wav") Loading Loading
nixos/tests/firefox.nix +14 −16 Original line number Diff line number Diff line import ./make-test-python.nix ({ pkgs, firefoxPackage, ... }: let firefoxPackage' = firefoxPackage.override (args: { extraPrefsFiles = (args.extraPrefsFiles or []) ++ [ # make sure that autoplay is enabled by default for the audio test (builtins.toString (builtins.toFile "autoplay-pref.js" ''defaultPref("media.autoplay.default",0);'')) ]; }); in { name = firefoxPackage'.unwrapped.pname; name = firefoxPackage.pname; meta = with pkgs.lib.maintainers; { maintainers = [ eelco shlevy ]; }; Loading @@ -17,10 +10,13 @@ in { pkgs, ... }: { imports = [ ./common/x11.nix ]; environment.systemPackages = [ firefoxPackage' pkgs.xdotool ]; environment.systemPackages = [ pkgs.xdotool ]; programs.firefox = { enable = true; preferences."media.autoplay.default" = 0; package = firefoxPackage; }; # Create a virtual sound device, with mixing # and all, for recording audio. Loading Loading @@ -58,7 +54,9 @@ in }; testScript = '' testScript = let exe = firefoxPackage.unwrapped.binaryName; in '' from contextlib import contextmanager Loading Loading @@ -97,7 +95,7 @@ in with subtest("Wait until Firefox has finished loading the Valgrind docs page"): machine.execute( "xterm -e '${firefoxPackage'.unwrapped.binaryName} file://${pkgs.valgrind.doc}/share/doc/valgrind/html/index.html' >&2 &" "xterm -e '${exe} file://${pkgs.valgrind.doc}/share/doc/valgrind/html/index.html' >&2 &" ) machine.wait_for_window("Valgrind") machine.sleep(40) Loading @@ -105,7 +103,7 @@ in with subtest("Check whether Firefox can play sound"): with record_audio(machine): machine.succeed( "${firefoxPackage'.unwrapped.binaryName} file://${pkgs.sound-theme-freedesktop}/share/sounds/freedesktop/stereo/phone-incoming-call.oga >&2 &" "${exe} file://${pkgs.sound-theme-freedesktop}/share/sounds/freedesktop/stereo/phone-incoming-call.oga >&2 &" ) wait_for_sound(machine) machine.copy_from_vm("/tmp/record.wav") Loading