1import ./make-test-python.nix ({ pkgs, ...} :
2
3{
4 name = "signal-desktop";
5 meta = with pkgs.lib.maintainers; {
6 maintainers = [ flokli primeos ];
7 };
8
9 machine = { ... }:
10
11 {
12 imports = [
13 ./common/user-account.nix
14 ./common/x11.nix
15 ];
16
17 services.xserver.enable = true;
18 test-support.displayManager.auto.user = "alice";
19 environment.systemPackages = with pkgs; [ signal-desktop file ];
20 virtualisation.memorySize = 1024;
21 };
22
23 enableOCR = true;
24
25 testScript = { nodes, ... }: let
26 user = nodes.machine.config.users.users.alice;
27 in ''
28 start_all()
29 machine.wait_for_x()
30
31 # start signal desktop
32 machine.execute("su - alice -c signal-desktop &")
33
34 # Wait for the Signal window to appear. Since usually the tests
35 # are run sandboxed and therfore with no internet, we can not wait
36 # for the message "Link your phone ...". Nor should we wait for
37 # the "Failed to connect to server" message, because when manually
38 # running this test it will be not sandboxed.
39 machine.wait_for_text("Signal")
40 machine.wait_for_text("File Edit View Window Help")
41 machine.screenshot("signal_desktop")
42
43 # Test if the database is encrypted to prevent these issues:
44 # - https://github.com/NixOS/nixpkgs/issues/108772
45 # - https://github.com/NixOS/nixpkgs/pull/117555
46 print(machine.succeed("su - alice -c 'file ~/.config/Signal/sql/db.sqlite'"))
47 machine.succeed(
48 "su - alice -c 'file ~/.config/Signal/sql/db.sqlite' | grep 'db.sqlite: data'"
49 )
50 machine.fail(
51 "su - alice -c 'file ~/.config/Signal/sql/db.sqlite' | grep -e SQLite -e database"
52 )
53 '';
54})