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 {};
libresprite = handleTest ./libresprite.nix {};
libreswan = handleTest ./libreswan.nix {};
librewolf = handleTest ./firefox.nix { firefoxPackage = pkgs.librewolf; };
lidarr = handleTest ./lidarr.nix {};
lightdm = handleTest ./lightdm.nix {};
limesurvey = handleTest ./limesurvey.nix {};

View File

@ -1,5 +1,14 @@
import ./make-test-python.nix ({ pkgs, firefoxPackage, ... }: {
name = "firefox";
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.binaryName;
meta = with pkgs.lib.maintainers; {
maintainers = [ eelco shlevy ];
};
@ -9,7 +18,7 @@ import ./make-test-python.nix ({ pkgs, firefoxPackage, ... }: {
{ imports = [ ./common/x11.nix ];
environment.systemPackages = [
firefoxPackage
firefoxPackage'
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"):
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.sleep(40)
@ -96,7 +105,7 @@ import ./make-test-python.nix ({ pkgs, firefoxPackage, ... }: {
with subtest("Check whether Firefox can play sound"):
with record_audio(machine):
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)
machine.copy_from_vm("/tmp/record.wav")

View File

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