diff --git a/briar-desktop/build.gradle.kts b/briar-desktop/build.gradle.kts index 7003c3d9ba2710e950d090aba19e7fda674602c9..df9c9080f7cdad27b53c5f0ec13d1794f143b7fc 100644 --- a/briar-desktop/build.gradle.kts +++ b/briar-desktop/build.gradle.kts @@ -132,7 +132,7 @@ tasks.register<Jar>("notificationTest") { "processResources" ) ) // We need this for Gradle optimization to work - archiveClassifier.set("notificationTest") // Naming the jar + archiveFileName.set("notificationTest.jar") // Version-agnostic name of the jar duplicatesStrategy = DuplicatesStrategy.EXCLUDE manifest { attributes("Main-Class" to "org.briarproject.briar.desktop.notification.linux.TestNativeNotificationsKt") diff --git a/briar-desktop/src/test/kotlin/org/briarproject/briar/desktop/notification/linux/TestNativeNotifications.kt b/briar-desktop/src/test/kotlin/org/briarproject/briar/desktop/notification/linux/TestNativeNotifications.kt index dffcbebfaa3f3bced3fbd7906259a5d60cfe7d26..b444b8de3642a0e1c825b78be3df2b3bc73f918b 100644 --- a/briar-desktop/src/test/kotlin/org/briarproject/briar/desktop/notification/linux/TestNativeNotifications.kt +++ b/briar-desktop/src/test/kotlin/org/briarproject/briar/desktop/notification/linux/TestNativeNotifications.kt @@ -20,7 +20,7 @@ package org.briarproject.briar.desktop.notification.linux /** * Small program to test notification support for Linux. * Build with ./gradlew briar-desktop:notificationTest - * and run as java -jar briar-desktop/build/libs/briar-desktop-*-notificationTest.jar + * and run as java -jar briar-desktop/build/libs/notificationTest.jar */ fun main() { LibnotifyNotificationProvider.apply { diff --git a/systemTests/gnome.sh b/systemTests/gnome.sh new file mode 100755 index 0000000000000000000000000000000000000000..a7d558ba82ce19464d0d310ddef35ab41c34733e --- /dev/null +++ b/systemTests/gnome.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +export $(xargs -0 -a "/proc/$(pgrep gnome-session -n -U $UID)/environ") 2>/dev/null +export LD_LIBRARY_PATH=/run/current-system/sw/lib +java -jar /tmp/test.jar diff --git a/systemTests/plasma.sh b/systemTests/plasma.sh new file mode 100755 index 0000000000000000000000000000000000000000..9f99dea859ea4e8a06e96a35ceede0c0e8dc8f5d --- /dev/null +++ b/systemTests/plasma.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +export $(xargs -0 -a "/proc/$(pgrep plasmashell -n -U $UID)/environ") 2>/dev/null +export LD_LIBRARY_PATH=/run/current-system/sw/lib +java -jar /tmp/test.jar diff --git a/systemTests/vms.nix b/systemTests/vms.nix index b6d5bf12d0886af8bf12d8449cd426bcfa5df22d..6a95631395149b826a9fe183e26663b11eff3f57 100644 --- a/systemTests/vms.nix +++ b/systemTests/vms.nix @@ -57,22 +57,6 @@ in pkgs.nixosTest { environment.systemPackages = [ pkgs.jdk ]; }; }; - - /* - Unfortunately, it was not straightforward to run the jar on the following desktop environments. - Enlightenment always starts a configuration dialog which somehow needs to be skipped, - Gnome and Plasma doesn't show the notifications when run from the test script, but does show them when run from the terminal (Konsole). - Additionally, Gnome only started with Wayland which is incompatible with the `wait_for_window()` function in the test script. - Therefore these machines are disabled for now. - - enlightenment = { ... }: makeDesktopEnvironment { - envOptions = { - services.xserver = { - displayManager.lightdm.enable = true; - desktopManager.enlightenment.enable = true; - }; - }; - }; gnome = { ... }: makeDesktopEnvironment { envOptions = { services.xserver = { @@ -91,6 +75,20 @@ in pkgs.nixosTest { }; }; }; + + /* + Unfortunately, it was not straightforward to run the jar on the Enlightenment desktop environment. + It always starts a configuration dialog which somehow needs to be skipped. + Therefore the following machine is disabled for now. + + enlightenment = { ... }: makeDesktopEnvironment { + envOptions = { + services.xserver = { + displayManager.lightdm.enable = true; + desktopManager.enlightenment.enable = true; + }; + }; + }; */ }; @@ -98,17 +96,38 @@ in pkgs.nixosTest { skipLint = true; testScript = { nodes, ... }: let in '' - def run(machine): - machine.wait_for_x() - machine.wait_for_window("xfce4-panel") - machine.sleep(20) - machine.copy_from_host("../briar-desktop/build/libs/briar-desktop-0.2.1-snapshot-notificationTest.jar", "/tmp/test.jar") - machine.succeed("su - alice -c 'DISPLAY=:0.0 LD_LIBRARY_PATH=/run/current-system/sw/lib java -jar /tmp/test.jar &'") + # test on systems with libnotify installed - # test on system with libnotify installed - run(xfce) + xfce.wait_for_x() + xfce.wait_for_window("xfce4-panel") + xfce.sleep(10) + xfce.copy_from_host("../briar-desktop/build/libs/notificationTest.jar", "/tmp/test.jar") + xfce.succeed("su - alice -c 'DISPLAY=:0.0 LD_LIBRARY_PATH=/run/current-system/sw/lib java -jar /tmp/test.jar &'") xfce.sleep(1) - xfce.screenshot("notifications") + xfce.screenshot("notifications_xfce") xfce.shutdown() + + gnome.wait_for_x() + gnome.sleep(5) + gnome.send_key( 'esc' ) + gnome.sleep(5) + gnome.copy_from_host("../briar-desktop/build/libs/notificationTest.jar", "/tmp/test.jar") + gnome.copy_from_host("gnome.sh", "/tmp/") + gnome.succeed("chown alice:users /tmp/gnome.sh") + gnome.succeed("su - alice -c '/tmp/gnome.sh &'") + gnome.sleep(1) + gnome.screenshot("notifications_gnome") + gnome.shutdown() + + plasma.wait_for_x() + plasma.wait_for_window("Plasma") + plasma.sleep(5) + plasma.copy_from_host("../briar-desktop/build/libs/notificationTest.jar", "/tmp/test.jar") + plasma.copy_from_host("plasma.sh", "/tmp/") + plasma.succeed("chown alice:users /tmp/plasma.sh") + plasma.succeed("su - alice -c '/tmp/plasma.sh &'") + plasma.sleep(1) + plasma.screenshot("notifications_plasma") + plasma.shutdown() ''; }