librewolf: add nixos test

- support librewolf in the firefox nixos test
- use the correct binary name
- ensure autoplay is always on for the audio test, since
  librewolf disables it by default
This commit is contained in:
squalus 2022-07-08 17:40:24 -07:00
parent 9cd306c9eb
commit 478940e2c7
3 changed files with 17 additions and 6 deletions

View file

@ -278,6 +278,7 @@ in {
libreddit = handleTest ./libreddit.nix {}; libreddit = handleTest ./libreddit.nix {};
libresprite = handleTest ./libresprite.nix {}; libresprite = handleTest ./libresprite.nix {};
libreswan = handleTest ./libreswan.nix {}; libreswan = handleTest ./libreswan.nix {};
librewolf = handleTest ./firefox.nix { firefoxPackage = pkgs.librewolf; };
lidarr = handleTest ./lidarr.nix {}; lidarr = handleTest ./lidarr.nix {};
lightdm = handleTest ./lightdm.nix {}; lightdm = handleTest ./lightdm.nix {};
limesurvey = handleTest ./limesurvey.nix {}; limesurvey = handleTest ./limesurvey.nix {};

View file

@ -1,5 +1,14 @@
import ./make-test-python.nix ({ pkgs, firefoxPackage, ... }: { import ./make-test-python.nix ({ pkgs, firefoxPackage, ... }:
name = "firefox"; 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.binaryName;
meta = with pkgs.lib.maintainers; { meta = with pkgs.lib.maintainers; {
maintainers = [ eelco shlevy ]; maintainers = [ eelco shlevy ];
}; };
@ -9,7 +18,7 @@ import ./make-test-python.nix ({ pkgs, firefoxPackage, ... }: {
{ imports = [ ./common/x11.nix ]; { imports = [ ./common/x11.nix ];
environment.systemPackages = [ environment.systemPackages = [
firefoxPackage firefoxPackage'
pkgs.xdotool pkgs.xdotool
]; ];
@ -88,7 +97,7 @@ import ./make-test-python.nix ({ pkgs, firefoxPackage, ... }: {
with subtest("Wait until Firefox has finished loading the Valgrind docs page"): with subtest("Wait until Firefox has finished loading the Valgrind docs page"):
machine.execute( machine.execute(
"xterm -e 'firefox file://${pkgs.valgrind.doc}/share/doc/valgrind/html/index.html' >&2 &" "xterm -e '${firefoxPackage'.unwrapped.binaryName} file://${pkgs.valgrind.doc}/share/doc/valgrind/html/index.html' >&2 &"
) )
machine.wait_for_window("Valgrind") machine.wait_for_window("Valgrind")
machine.sleep(40) machine.sleep(40)
@ -96,7 +105,7 @@ import ./make-test-python.nix ({ pkgs, firefoxPackage, ... }: {
with subtest("Check whether Firefox can play sound"): with subtest("Check whether Firefox can play sound"):
with record_audio(machine): with record_audio(machine):
machine.succeed( machine.succeed(
"firefox file://${pkgs.sound-theme-freedesktop}/share/sounds/freedesktop/stereo/phone-incoming-call.oga >&2 &" "${firefoxPackage'.unwrapped.binaryName} file://${pkgs.sound-theme-freedesktop}/share/sounds/freedesktop/stereo/phone-incoming-call.oga >&2 &"
) )
wait_for_sound(machine) wait_for_sound(machine)
machine.copy_from_vm("/tmp/record.wav") machine.copy_from_vm("/tmp/record.wav")

View file

@ -1,4 +1,4 @@
{ stdenv, lib, callPackage, buildMozillaMach }: { stdenv, lib, callPackage, buildMozillaMach, nixosTests }:
let let
librewolf-src = callPackage ./librewolf.nix { }; librewolf-src = callPackage ./librewolf.nix { };
@ -22,6 +22,7 @@ in
maxSilent = 14400; # 4h, double the default of 7200s (c.f. #129212, #129115) maxSilent = 14400; # 4h, double the default of 7200s (c.f. #129212, #129115)
license = lib.licenses.mpl20; license = lib.licenses.mpl20;
}; };
tests = [ nixosTests.librewolf ];
updateScript = callPackage ./update.nix { updateScript = callPackage ./update.nix {
attrPath = "librewolf-unwrapped"; attrPath = "librewolf-unwrapped";
}; };