Merge pull request #73140 from worldofpeace/port-pantheon-test

nixosTests.pantheon: port to python
This commit is contained in:
Florian Klink 2019-11-25 21:08:25 +01:00 committed by GitHub
commit b16ddb977d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,9 +1,10 @@
import ./make-test.nix ({ pkgs, ...} : import ./make-test-python.nix ({ pkgs, ...} :
{ {
name = "pantheon"; name = "pantheon";
meta = with pkgs.stdenv.lib.maintainers; { meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ worldofpeace ]; maintainers = pkgs.pantheon.maintainers;
}; };
machine = { ... }: machine = { ... }:
@ -21,35 +22,37 @@ import ./make-test.nix ({ pkgs, ...} :
testScript = { nodes, ... }: let testScript = { nodes, ... }: let
user = nodes.machine.config.users.users.alice; user = nodes.machine.config.users.users.alice;
bob = nodes.machine.config.users.users.bob;
in '' in ''
startAll; machine.wait_for_unit("display-manager.service")
# Wait for display manager to start with subtest("Test we can see usernames in elementary-greeter"):
$machine->waitForText(qr/${user.description}/); machine.wait_for_text("${user.description}")
$machine->screenshot("lightdm"); machine.wait_for_text("${bob.description}")
machine.screenshot("elementary_greeter_lightdm")
# Log in with subtest("Login with elementary-greeter"):
$machine->sendChars("${user.password}\n"); machine.send_chars("${user.password}\n")
$machine->waitForFile("/home/alice/.Xauthority"); machine.wait_for_x()
$machine->succeed("xauth merge ~alice/.Xauthority"); machine.wait_for_file("${user.home}/.Xauthority")
machine.succeed("xauth merge ${user.home}/.Xauthority")
# Check if "pantheon-shell" components actually start with subtest("Check that logging in has given the user ownership of devices"):
$machine->waitUntilSucceeds("pgrep gala"); machine.succeed("getfacl -p /dev/snd/timer | grep -q ${user.name}")
$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. # TODO: DBus API could eliminate this? Pantheon uses Bamf.
$machine->succeed("getfacl -p /dev/snd/timer | grep -q alice"); 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 with subtest("Open elementary terminal"):
$machine->execute("su - alice -c 'DISPLAY=:0.0 io.elementary.terminal &'"); machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.terminal &'")
$machine->waitForWindow(qr/io.elementary.terminal/); machine.wait_for_window("io.elementary.terminal")
machine.sleep(20)
# Take a screenshot of the desktop machine.screenshot("screen")
$machine->sleep(20);
$machine->screenshot("screen");
''; '';
}) })