From aa6fb602a036480f19701079508cdfb810305aa6 Mon Sep 17 00:00:00 2001 From: worldofpeace Date: Wed, 6 Nov 2019 20:20:16 -0500 Subject: [PATCH 1/4] nixosTests.pantheon: adjust test slightly --- nixos/tests/pantheon.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/nixos/tests/pantheon.nix b/nixos/tests/pantheon.nix index 9888887ee8b5..699634134842 100644 --- a/nixos/tests/pantheon.nix +++ b/nixos/tests/pantheon.nix @@ -22,16 +22,18 @@ import ./make-test.nix ({ pkgs, ...} : testScript = { nodes, ... }: let user = nodes.machine.config.users.users.alice; in '' - startAll; - # Wait for display manager to start + $machine->waitForUnit("display-manager.service"); + + # Test we can see username in elementary-greeter $machine->waitForText(qr/${user.description}/); - $machine->screenshot("lightdm"); + $machine->screenshot("elementary_greeter_lightdm"); # Log in $machine->sendChars("${user.password}\n"); - $machine->waitForFile("/home/alice/.Xauthority"); - $machine->succeed("xauth merge ~alice/.Xauthority"); + $machine->waitForUnit("default.target","alice"); + $machine->waitForFile("${user.home}/.Xauthority"); + $machine->succeed("xauth merge ${user.home}/.Xauthority"); # Check if "pantheon-shell" components actually start $machine->waitUntilSucceeds("pgrep gala"); From e15c4e48a217544b7e543d2f9bb5f49ec71723b5 Mon Sep 17 00:00:00 2001 From: worldofpeace Date: Wed, 6 Nov 2019 20:38:23 -0500 Subject: [PATCH 2/4] nixosTests.pantheon: port to python --- nixos/tests/pantheon.nix | 51 ++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/nixos/tests/pantheon.nix b/nixos/tests/pantheon.nix index 699634134842..398d7c8e7315 100644 --- a/nixos/tests/pantheon.nix +++ b/nixos/tests/pantheon.nix @@ -1,9 +1,10 @@ -import ./make-test.nix ({ pkgs, ...} : +import ./make-test-python.nix ({ pkgs, ...} : { name = "pantheon"; + meta = with pkgs.stdenv.lib.maintainers; { - maintainers = [ worldofpeace ]; + maintainers = pkgs.pantheon.maintainers; }; machine = { ... }: @@ -23,35 +24,35 @@ import ./make-test.nix ({ pkgs, ...} : user = nodes.machine.config.users.users.alice; in '' # Wait for display manager to start - $machine->waitForUnit("display-manager.service"); + machine.wait_for_unit("display-manager.service") # Test we can see username in elementary-greeter - $machine->waitForText(qr/${user.description}/); - $machine->screenshot("elementary_greeter_lightdm"); + machine.wait_for_text("${user.description}") + machine.screenshot("elementary_greeter_lightdm") - # Log in - $machine->sendChars("${user.password}\n"); - $machine->waitForUnit("default.target","alice"); - $machine->waitForFile("${user.home}/.Xauthority"); - $machine->succeed("xauth merge ${user.home}/.Xauthority"); + # Log in with elementary-greeter + machine.send_chars("${user.password}\n") + machine.wait_for_unit("default.target", "${user.name}") + machine_wait_for_x() + machine.wait_for_file("${user.home}/.Xauthority") + machine.succeed("xauth merge ${user.home}/.Xauthority") - # Check if "pantheon-shell" components actually start - $machine->waitUntilSucceeds("pgrep gala"); - $machine->waitForWindow(qr/gala/); - $machine->waitUntilSucceeds("pgrep wingpanel"); - $machine->waitForWindow("wingpanel"); - $machine->waitUntilSucceeds("pgrep plank"); - $machine->waitForWindow(qr/plank/); + # Check that logging in has given the user ownership of devices + machine.succeed("getfacl -p /dev/snd/timer | grep -q ${user.name}") - # Check that logging in has given the user ownership of devices. - $machine->succeed("getfacl -p /dev/snd/timer | grep -q alice"); + # TODO: DBus API could eliminate this? + # Check if pantheon-shell components actually start + machine.wait_until_succeeds("pgrep gala") + machine.wait_for_window("gala") + machine.wait_until_succeeds("pgrep wingpanel") + machine.wait_for_window("wingpanel") + machine.wait_until_succeeds("pgrep plank") + machine.wait_for_window("plank") # Open elementary terminal - $machine->execute("su - alice -c 'DISPLAY=:0.0 io.elementary.terminal &'"); - $machine->waitForWindow(qr/io.elementary.terminal/); - - # Take a screenshot of the desktop - $machine->sleep(20); - $machine->screenshot("screen"); + machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.terminal &'") + machine.wait_for_window("io.elementary.terminal") + machine.sleep(20) + machine.screenshot("screen") ''; }) From a60daae73309a8b57df68b272a285643debd711a Mon Sep 17 00:00:00 2001 From: worldofpeace Date: Sat, 9 Nov 2019 16:06:19 -0500 Subject: [PATCH 3/4] nixosTests.pantheon: check for bob description --- nixos/tests/pantheon.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nixos/tests/pantheon.nix b/nixos/tests/pantheon.nix index 398d7c8e7315..ee57200e8a8e 100644 --- a/nixos/tests/pantheon.nix +++ b/nixos/tests/pantheon.nix @@ -22,18 +22,19 @@ import ./make-test-python.nix ({ pkgs, ...} : testScript = { nodes, ... }: let user = nodes.machine.config.users.users.alice; + bob = nodes.machine.config.users.users.bob; in '' # Wait for display manager to start machine.wait_for_unit("display-manager.service") - # Test we can see username in elementary-greeter + # Test we can see usernames in elementary-greeter machine.wait_for_text("${user.description}") + machine.wait_for_text("${bob.description}") machine.screenshot("elementary_greeter_lightdm") # Log in with elementary-greeter machine.send_chars("${user.password}\n") - machine.wait_for_unit("default.target", "${user.name}") - machine_wait_for_x() + machine.wait_for_x() machine.wait_for_file("${user.home}/.Xauthority") machine.succeed("xauth merge ${user.home}/.Xauthority") From c16df6bbac6a36a029a622fc45f93f736ec9b340 Mon Sep 17 00:00:00 2001 From: worldofpeace Date: Mon, 25 Nov 2019 12:03:51 -0500 Subject: [PATCH 4/4] nixosTests.pantheon: use subtest --- nixos/tests/pantheon.nix | 49 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/nixos/tests/pantheon.nix b/nixos/tests/pantheon.nix index ee57200e8a8e..6ff19be1bb95 100644 --- a/nixos/tests/pantheon.nix +++ b/nixos/tests/pantheon.nix @@ -24,36 +24,35 @@ import ./make-test-python.nix ({ pkgs, ...} : user = nodes.machine.config.users.users.alice; bob = nodes.machine.config.users.users.bob; in '' - # Wait for display manager to start machine.wait_for_unit("display-manager.service") - # Test we can see usernames in elementary-greeter - machine.wait_for_text("${user.description}") - machine.wait_for_text("${bob.description}") - machine.screenshot("elementary_greeter_lightdm") + with subtest("Test we can see usernames in elementary-greeter"): + machine.wait_for_text("${user.description}") + machine.wait_for_text("${bob.description}") + machine.screenshot("elementary_greeter_lightdm") - # Log in with elementary-greeter - machine.send_chars("${user.password}\n") - machine.wait_for_x() - machine.wait_for_file("${user.home}/.Xauthority") - machine.succeed("xauth merge ${user.home}/.Xauthority") + with subtest("Login with elementary-greeter"): + machine.send_chars("${user.password}\n") + machine.wait_for_x() + machine.wait_for_file("${user.home}/.Xauthority") + machine.succeed("xauth merge ${user.home}/.Xauthority") - # Check that logging in has given the user ownership of devices - machine.succeed("getfacl -p /dev/snd/timer | grep -q ${user.name}") + with subtest("Check that logging in has given the user ownership of devices"): + machine.succeed("getfacl -p /dev/snd/timer | grep -q ${user.name}") - # TODO: DBus API could eliminate this? - # Check if pantheon-shell components actually start - machine.wait_until_succeeds("pgrep gala") - machine.wait_for_window("gala") - machine.wait_until_succeeds("pgrep wingpanel") - machine.wait_for_window("wingpanel") - machine.wait_until_succeeds("pgrep plank") - machine.wait_for_window("plank") + # TODO: DBus API could eliminate this? Pantheon uses Bamf. + with subtest("Check if pantheon session components actually start"): + machine.wait_until_succeeds("pgrep gala") + machine.wait_for_window("gala") + machine.wait_until_succeeds("pgrep wingpanel") + machine.wait_for_window("wingpanel") + machine.wait_until_succeeds("pgrep plank") + machine.wait_for_window("plank") - # Open elementary terminal - machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.terminal &'") - machine.wait_for_window("io.elementary.terminal") - machine.sleep(20) - machine.screenshot("screen") + with subtest("Open elementary terminal"): + machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.terminal &'") + machine.wait_for_window("io.elementary.terminal") + machine.sleep(20) + machine.screenshot("screen") ''; })