From 4eeff46bbb70fb37c85f2d9d22a66b63aa918a97 Mon Sep 17 00:00:00 2001 From: Kirill Radzikhovskyy Date: Mon, 30 Oct 2023 06:49:08 +1100 Subject: [PATCH] freetube: add test This change fixes ofborg eval error --- nixos/tests/all-tests.nix | 1 + nixos/tests/freetube.nix | 41 ++++++++++++++++++++ pkgs/applications/video/freetube/default.nix | 4 +- 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 nixos/tests/freetube.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 2f6d5a8dae88..07a2df74735e 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -306,6 +306,7 @@ in { forgejo = handleTest ./forgejo.nix { }; freenet = handleTest ./freenet.nix {}; freeswitch = handleTest ./freeswitch.nix {}; + freetube = discoverTests (import ./freetube.nix); freshrss-sqlite = handleTest ./freshrss-sqlite.nix {}; freshrss-pgsql = handleTest ./freshrss-pgsql.nix {}; frigate = handleTest ./frigate.nix {}; diff --git a/nixos/tests/freetube.nix b/nixos/tests/freetube.nix new file mode 100644 index 000000000000..f285384b68e0 --- /dev/null +++ b/nixos/tests/freetube.nix @@ -0,0 +1,41 @@ +let + tests = { + wayland = { pkgs, ... }: { + imports = [ ./common/wayland-cage.nix ]; + services.cage.program = "${pkgs.freetube}/bin/freetube"; + virtualisation.memorySize = 2047; + environment.variables.NIXOS_OZONE_WL = "1"; + environment.variables.DISPLAY = "do not use"; + }; + xorg = { pkgs, ... }: { + imports = [ ./common/user-account.nix ./common/x11.nix ]; + virtualisation.memorySize = 2047; + services.xserver.enable = true; + services.xserver.displayManager.sessionCommands = '' + ${pkgs.freetube}/bin/freetube + ''; + test-support.displayManager.auto.user = "alice"; + }; + }; + + mkTest = name: machine: + import ./make-test-python.nix ({ pkgs, ... }: { + inherit name; + nodes = { "${name}" = machine; }; + meta.maintainers = with pkgs.lib.maintainers; [ kirillrdy ]; + enableOCR = true; + + testScript = '' + start_all() + machine.wait_for_unit('graphical.target') + machine.wait_for_text('Your Subscription list is currently empty') + machine.send_key("ctrl-r") + machine.wait_for_text('Your Subscription list is currently empty') + machine.screenshot("main.png") + machine.send_key("ctrl-comma") + machine.wait_for_text('General Settings', timeout=30) + machine.screenshot("preferences.png") + ''; + }); +in +builtins.mapAttrs (k: v: mkTest k v { }) tests diff --git a/pkgs/applications/video/freetube/default.nix b/pkgs/applications/video/freetube/default.nix index 47bda7e135da..a3fd87e6142e 100644 --- a/pkgs/applications/video/freetube/default.nix +++ b/pkgs/applications/video/freetube/default.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, fetchurl, appimageTools, makeWrapper, electron }: +{ stdenv, lib, fetchurl, appimageTools, makeWrapper, electron, nixosTests }: stdenv.mkDerivation rec { pname = "freetube"; @@ -9,6 +9,8 @@ stdenv.mkDerivation rec { sha256 = "add96ad3509d4d5c6d8658b005dfd046963cd6bb0a4e1f3e88f726a86c05810f"; }; + passthru.tests = nixosTests.freetube; + appimageContents = appimageTools.extractType2 { name = "${pname}-${version}"; inherit src;