1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
|
let
makeTest = import ./make-test-python.nix;
# Just to make sure everything is the same, need it for OCR & navigating greeter
user = "alice";
description = "Alice Foobar";
password = "foobar";
wallpaperName = "wallpaper.jpg";
# In case it ever shows up in the VM, we could OCR for it instead
wallpaperText = "Lorem ipsum";
# setup to make OCRing on terminal output more reliable
terminalTextColour = {
r = 91;
g = 113;
b = 102;
};
terminalTextColourString =
lib:
let
toHex = component: lib.optionalString (component < 16) "0" + lib.trivial.toHexString component;
in
"#${toHex terminalTextColour.r}${toHex terminalTextColour.g}${toHex terminalTextColour.b}";
terminalOcrTmpfilesSetup =
{
pkgs,
lib,
config,
}:
let
white = "255, 255, 255";
foreground = "${toString terminalTextColour.r}, ${toString terminalTextColour.g}, ${toString terminalTextColour.b}";
colorSection = color: {
Color = color;
Bold = true;
Transparency = false;
};
terminalColors = pkgs.writeText "customized.colorscheme" (
lib.generators.toINI { } {
Background = colorSection white;
Foreground = colorSection foreground;
Color2 = colorSection foreground;
Color2Intense = colorSection foreground;
}
);
terminalConfig = pkgs.writeText "terminal.ubports.conf" (
lib.generators.toINI { } {
General = {
colorScheme = "customized";
fontSize = "16";
fontStyle = "Inconsolata";
};
}
);
confBase = "${config.users.users.${user}.home}/.config";
userDirArgs = {
mode = "0700";
user = user;
group = "users";
};
in
{
"${confBase}".d = userDirArgs;
"${confBase}/terminal.ubports".d = userDirArgs;
"${confBase}/terminal.ubports/customized.colorscheme".L.argument = "${terminalColors}";
"${confBase}/terminal.ubports/terminal.ubports.conf".L.argument = "${terminalConfig}";
};
wallpaperFile =
pkgs:
pkgs.runCommand wallpaperName
{
nativeBuildInputs = with pkgs; [
(imagemagick.override { ghostscriptSupport = true; }) # produce OCR-able image
];
}
''
magick -size 640x480 canvas:black -pointsize 30 -fill white -annotate +100+100 '${wallpaperText}' $out
'';
lomiriWallpaperDconfSettings = pkgs: {
settings = {
"org/gnome/desktop/background" = {
picture-uri = "file://${wallpaperFile pkgs}";
};
};
};
sharedTestFunctions = lib: ''
from collections.abc import Callable
import tempfile
import subprocess
# Based on terminal-emulators.nix' check_for_pink
def check_for_color(color: str) -> Callable[[bool], bool]:
def check_for_color_retry(final=False) -> bool:
with tempfile.NamedTemporaryFile() as tmpin:
machine.send_monitor_command("screendump {}".format(tmpin.name))
cmd = 'convert {} -define histogram:unique-colors=true -format "%c" histogram:info:'.format(
tmpin.name
)
ret = subprocess.run(cmd, shell=True, capture_output=True)
if ret.returncode != 0:
raise Exception(
"image analysis failed with exit code {}".format(ret.returncode)
)
text = ret.stdout.decode("utf-8")
return color in text
return check_for_color_retry
def check_for_color_continued_presence(color: str) -> Callable[[bool], bool]:
colorFunc: Callable[[bool], bool] = check_for_color(color)
def check_for_color_continued_presence_retry(final=False) -> bool:
colorPresent: bool = colorFunc(final)
if final:
# If it fails now, retry handles the exception raising.
# Otherwise, we passed.
return colorPresent
else:
if colorPresent:
# We want retry to continue running us until the timeout, so signal failure.
return False
else:
# Color disappeared
raise Exception(
"color {} has disappeared from the screen!".format(color)
)
return check_for_color_continued_presence_retry
def ensure_terminal_running() -> None:
"""
Ensure that lomiri-terminal-app has finished starting up.
"""
terminalTextColor: str = "${terminalTextColourString lib}"
with machine.nested("Waiting for the screen to have terminalTextColor {} on it:".format(terminalTextColor)):
retry(check_for_color(terminalTextColor))
with machine.nested("Ensuring terminalTextColor {} stays present on the screen:".format(terminalTextColor)):
retry(fn=check_for_color_continued_presence(terminalTextColor), timeout_seconds=5)
def change_tty_back_forth(ttynumMain: int, ttynumDiff: int) -> None:
"""
A qtmir bump made the image get stuck, a tty switch back and forth fixes it.
"""
machine.send_key(f"ctrl-alt-f{ttynumDiff}")
machine.sleep(10)
machine.send_key(f"ctrl-alt-f{ttynumMain}")
machine.sleep(10)
def ensure_greeter_launched() -> None:
"""
Ensure that Lomiri (in greeter mode) has started up and is responsive.
Execution will stop at the user selection.
"""
machine.wait_for_unit("display-manager.service")
machine.wait_until_succeeds("pgrep -u lightdm -f 'lomiri --mode=greeter'")
# Start page shows current time
wait_for_text(r"(AM|PM)")
# Display "hangs" since qtmir bump? Not sure why. Switch to a different tty and back, and ensure that time is still shown
# Greeter runs on: tty1
change_tty_back_forth(1, 2)
wait_for_text(r"(AM|PM)")
machine.screenshot("lomiri_greeter_launched")
# Advance to user selection, to make sure display really isn't stuck anymore
machine.send_key("ret")
wait_for_text("${description}")
machine.screenshot("lomiri_greeter_login")
def ensure_lomiri_running(ttynumMain: int = 1, ttynumDiff: int = 2) -> None:
"""
Ensure that Lomiri has finished starting up.
"""
# Process runs
machine.wait_until_succeeds("pgrep -u ${user} -f 'lomiri --mode=full-shell'")
# One of the last UI elements that loads is the clock. In the past, we could OCR for AM/PM to ensure it's there. That is now flaky.
# The next best thing is to look for the launcher button, and ensure it stays around for awhile (DE doesn't crash).
launcherColor: str = "#5277C3"
with machine.nested("Waiting for the screen to have launcherColor {} on it:".format(launcherColor)):
retry(check_for_color(launcherColor))
with machine.nested("Ensuring launcherColor {} stays present on the screen:".format(launcherColor)):
retry(fn=check_for_color_continued_presence(launcherColor), timeout_seconds=30)
# Display "hangs" since qtmir bump? Not sure why. Switch to a different tty and back, and ensure that launcher button is still shown
change_tty_back_forth(ttynumMain, ttynumDiff)
with machine.nested("Waiting for the screen to have launcherColor {} on it:".format(launcherColor)):
retry(check_for_color(launcherColor))
# First input seems to get dropped while Mir registers the new input device. Send a key that does nothing, to get that out of the way, and sleep a tiny bit for registration to finish.
machine.send_key("left")
machine.sleep(3)
machine.screenshot("lomiri_launched")
def wait_for_text(text) -> None:
"""
Wait for on-screen text, and try to optimise retry count for slow hardware.
"""
machine.sleep(30)
machine.wait_for_text(text)
def toggle_maximise() -> None:
"""
Maximise the current window.
"""
machine.send_key("ctrl-meta_l-up")
# For some reason, Lomiri in these VM tests very frequently opens the starter menu a few seconds after sending the above.
# Because this isn't 100% reproducible all the time, and there is no command to await when OCR doesn't pick up some text,
# the best we can do is send some Escape input after waiting some arbitrary time and hope that it works out fine.
machine.sleep(5)
machine.send_key("esc")
machine.sleep(5)
def mouse_click(xpos, ypos) -> None:
"""
Move the mouse to a screen location and hit left-click.
"""
# Move
machine.execute(f"ydotool mousemove --absolute -- {xpos} {ypos}")
machine.sleep(2)
# Click (C0 - left button: down & up)
machine.execute("ydotool click 0xC0")
machine.sleep(2)
def open_starter() -> None:
"""
Open the starter, and ensure it's opened.
"""
# Using the keybind has a chance of instantly closing the menu again? Just click the button
mouse_click(15, 15)
'';
makeIndicatorTest =
{
name,
left,
ocr,
extraCheck ? null,
titleOcr,
}:
makeTest (
{ pkgs, lib, ... }:
{
name = "lomiri-desktop-ayatana-indicator-${name}";
meta = {
maintainers = lib.teams.lomiri.members;
};
nodes.machine =
{ config, ... }:
{
imports = [
./common/auto.nix
./common/user-account.nix
];
virtualisation.memorySize = 2047;
users.users.${user} = {
inherit description password;
};
test-support.displayManager.auto = {
enable = true;
inherit user;
};
# To control mouse via scripting
programs.ydotool.enable = true;
services.desktopManager.lomiri.enable = lib.mkForce true;
services.displayManager.defaultSession = lib.mkForce "lomiri";
# Not setting wallpaper, as it breaks indicator OCR(?)
};
enableOCR = true;
testScript =
{ nodes, ... }:
(sharedTestFunctions lib)
+ ''
start_all()
machine.wait_for_unit("multi-user.target")
# The session should start, and not be stuck in i.e. a crash loop
with subtest("lomiri starts"):
ensure_lomiri_running()
# The ayatana indicators are an important part of the experience, and they hold the only graphical way of exiting the session.
# There's a test app we could use that also displays their contents, but it's abit inconsistent.
mouse_click(735, 0) # the cog in the top-right, for the session indicator
wait_for_text(${titleOcr})
machine.screenshot("indicators_open")
# Indicator order within the menus *should* be fixed based on per-indicator order setting
# Session is the one we clicked, but it might not be the one we want to test right now.
# Go as far left as necessary.
${lib.strings.replicate left "machine.send_key(\"left\")\n"}
with subtest("ayatana indicator session works"):
wait_for_text(r"(${lib.strings.concatStringsSep "|" ocr})")
machine.screenshot("indicator_${name}")
''
+ lib.optionalString (extraCheck != null) extraCheck;
}
);
makeIndicatorTests =
{
titles,
details,
}:
let
titleOcr = "r\"(${builtins.concatStringsSep "|" titles})\"";
in
builtins.listToAttrs (
map (
{
name,
left,
ocr,
extraCheck ? null,
}:
{
name = "desktop-ayatana-indicator-${name}";
value = makeIndicatorTest {
inherit
name
left
ocr
extraCheck
titleOcr
;
};
}
) details
);
in
{
greeter = makeTest (
{ pkgs, lib, ... }:
{
name = "lomiri-greeter";
meta = {
maintainers = lib.teams.lomiri.members;
};
nodes.machine =
{ config, ... }:
{
imports = [ ./common/user-account.nix ];
virtualisation.memorySize = 2047;
users.users.${user} = {
inherit description password;
};
services.xserver.enable = true;
services.xserver.windowManager.icewm.enable = true;
services.xserver.displayManager.lightdm = {
enable = true;
greeters.lomiri.enable = true;
};
services.displayManager.defaultSession = lib.mkForce "none+icewm";
};
enableOCR = true;
testScript =
{ nodes, ... }:
(sharedTestFunctions lib)
+ ''
start_all()
machine.wait_for_unit("multi-user.target")
# Lomiri in greeter mode should work & be able to start a session
with subtest("lomiri greeter works"):
ensure_greeter_launched()
# Login
machine.send_chars("${password}\n")
machine.wait_for_x()
machine.screenshot("session_launched")
'';
}
);
desktop-basics = makeTest (
{ pkgs, lib, ... }:
{
name = "lomiri-desktop-basics";
meta = {
maintainers = lib.teams.lomiri.members;
};
nodes.machine =
{ config, ... }:
{
imports = [
./common/auto.nix
./common/user-account.nix
];
virtualisation.memorySize = 2047;
users.users.${user} = {
inherit description password;
};
test-support.displayManager.auto = {
enable = true;
inherit user;
};
# To control mouse via scripting
programs.ydotool.enable = true;
services.desktopManager.lomiri.enable = lib.mkForce true;
services.displayManager.defaultSession = lib.mkForce "lomiri";
# Help with OCR
fonts.packages = [ pkgs.inconsolata ];
environment = {
# Help with OCR
etc."xdg/alacritty/alacritty.toml".source = (pkgs.formats.toml { }).generate "alacritty.toml" {
font = rec {
normal.family = "Inconsolata";
bold.family = normal.family;
italic.family = normal.family;
bold_italic.family = normal.family;
size = 16;
};
colors = rec {
primary = {
foreground = "0x000000";
background = "0xffffff";
};
normal = {
green = primary.foreground;
};
};
};
etc."${wallpaperName}".source = wallpaperFile pkgs;
systemPackages = with pkgs; [
# Forcing alacritty to run as an X11 app when opened from the starter menu
(symlinkJoin {
name = "x11-${alacritty.name}";
paths = [ alacritty ];
nativeBuildInputs = [ makeWrapper ];
postBuild = ''
wrapProgram $out/bin/alacritty \
--set WINIT_UNIX_BACKEND x11 \
--set WAYLAND_DISPLAY ""
'';
inherit (alacritty) meta;
})
];
};
programs.dconf.profiles.user.databases = [
(lomiriWallpaperDconfSettings pkgs)
];
# Help with OCR
systemd.tmpfiles.settings = {
"10-lomiri-test-setup" = terminalOcrTmpfilesSetup { inherit pkgs lib config; };
};
};
enableOCR = true;
testScript =
{ nodes, ... }:
(sharedTestFunctions lib)
+ ''
start_all()
machine.wait_for_unit("multi-user.target")
# The session should start, and not be stuck in i.e. a crash loop
with subtest("lomiri starts"):
ensure_lomiri_running()
# Working terminal keybind is good
with subtest("terminal keybind works"):
machine.send_key("ctrl-alt-t")
ensure_terminal_running()
machine.screenshot("terminal_opens")
machine.send_key("alt-f4")
# We want the ability to launch applications
with subtest("starter menu works"):
open_starter()
machine.screenshot("starter_opens")
# Just try the terminal again, we know that it should work
machine.send_chars("Terminal\n")
ensure_terminal_running()
machine.send_key("alt-f4")
# We want support for X11 apps
with subtest("xwayland support works"):
open_starter()
machine.send_chars("Alacritty\n")
wait_for_text(r"(${user}|machine)")
machine.screenshot("alacritty_opens")
machine.send_key("alt-f4")
# Morph is how we go online
with subtest("morph browser works"):
open_starter()
machine.send_chars("Morph\n")
wait_for_text(r"(Bookmarks|address|site|visited any)")
machine.screenshot("morph_open")
# morph-browser has a separate VM test to test its basic functionalities
machine.send_key("alt-f4")
# LSS provides DE settings
with subtest("system settings open"):
open_starter()
machine.send_chars("System Settings\n")
wait_for_text("Rotation Lock")
machine.screenshot("settings_open")
# lomiri-system-settings has a separate VM test to test its basic functionalities
machine.send_key("alt-f4")
'';
}
);
desktop-appinteractions = makeTest (
{ pkgs, lib, ... }:
{
name = "lomiri-desktop-appinteractions";
meta = {
maintainers = lib.teams.lomiri.members;
};
nodes.machine =
{ config, ... }:
{
imports = [
./common/auto.nix
./common/user-account.nix
];
virtualisation.memorySize = 2047;
users.users.${user} = {
inherit description password;
# polkit agent test
extraGroups = [ "wheel" ];
};
test-support.displayManager.auto = {
enable = true;
inherit user;
};
# To control mouse via scripting
programs.ydotool.enable = true;
services.desktopManager.lomiri.enable = lib.mkForce true;
services.displayManager.defaultSession = lib.mkForce "lomiri";
# Help with OCR
fonts.packages = [ pkgs.inconsolata ];
environment = {
# Help with OCR
etc."xdg/alacritty/alacritty.yml".text = lib.generators.toYAML { } {
font = rec {
normal.family = "Inconsolata";
bold.family = normal.family;
italic.family = normal.family;
bold_italic.family = normal.family;
size = 16;
};
colors = rec {
primary = {
foreground = "0x000000";
background = "0xffffff";
};
normal = {
green = primary.foreground;
};
};
};
etc."${wallpaperName}".source = wallpaperFile pkgs;
variables = {
# So we can test what lomiri-content-hub is working behind the scenes
LOMIRI_CONTENT_HUB_LOGGING_LEVEL = "2";
};
systemPackages = with pkgs; [
# For a convenient way of kicking off lomiri-content-hub peer collection
lomiri.lomiri-content-hub.examples
];
};
programs.dconf.profiles.user.databases = [
(lomiriWallpaperDconfSettings pkgs)
];
# Help with OCR
systemd.tmpfiles.settings = {
"10-lomiri-test-setup" = terminalOcrTmpfilesSetup { inherit pkgs lib config; };
};
};
enableOCR = true;
testScript =
{ nodes, ... }:
(sharedTestFunctions lib)
+ ''
start_all()
machine.wait_for_unit("multi-user.target")
# The session should start, and not be stuck in i.e. a crash loop
with subtest("lomiri starts"):
ensure_lomiri_running()
# Working terminal keybind is good
with subtest("terminal keybind works"):
machine.send_key("ctrl-alt-t")
ensure_terminal_running()
machine.screenshot("terminal_opens")
# for the LSS lomiri-content-hub test to work reliably, we need to kick off peer collecting
machine.send_chars("lomiri-content-hub-test-importer\n")
wait_for_text(r"(/build/source|hub.cpp|handler.cpp|void|virtual|const)") # awaiting log messages from lomiri-content-hub
machine.send_key("ctrl-c")
# Doing this here, since we need an in-session shell & separately starting a terminal again wastes time
with subtest("polkit agent works"):
machine.send_chars("run0 touch /tmp/polkit-test\n")
# There's an authentication notification here that gains focus, but we struggle with OCRing it
# Just hope that it's up after a short wait
machine.sleep(10)
machine.screenshot("polkit_agent")
machine.send_chars("${password}")
machine.sleep(2) # Hopefully enough delay to make sure all the password characters have been registered? Maybe just placebo
machine.send_chars("\n")
machine.wait_for_file("/tmp/polkit-test", 10)
machine.send_key("alt-f4")
# LSS provides DE settings
with subtest("system settings open"):
open_starter()
machine.send_chars("System Settings\n")
wait_for_text("Rotation Lock")
machine.screenshot("settings_open")
# lomiri-system-settings has a separate VM test, only test Lomiri-specific lomiri-content-hub functionalities here
# Make fullscreen, can't navigate to Background plugin via keyboard unless window has non-phone-like aspect ratio
toggle_maximise()
# Load Background plugin
machine.send_key("tab")
machine.send_key("tab")
machine.send_key("tab")
machine.send_key("tab")
machine.send_key("tab")
machine.send_key("tab")
machine.send_key("ret")
wait_for_text("Background image")
# Try to load custom background
machine.send_key("shift-tab")
machine.send_key("shift-tab")
machine.send_key("shift-tab")
machine.send_key("shift-tab")
machine.send_key("shift-tab")
machine.send_key("shift-tab")
machine.send_key("ret")
# Peers should be loaded
wait_for_text("Gallery")
machine.screenshot("settings_lomiri-content-hub_peers")
# Select Gallery as content source
mouse_click(540, 80)
# Expect Gallery to be brought into the foreground, with its sharing page open
wait_for_text("Photos")
# If lomiri-content-hub encounters a problem, it may have crashed the original application issuing the request.
# Check that it's still alive
machine.succeed("pgrep -u ${user} -f lomiri-system-settings")
machine.screenshot("lomiri-content-hub_exchange")
# Testing any more would require more applications & setup, the fact that it's already being attempted is a good sign
machine.send_key("tab")
machine.send_key("ret")
machine.sleep(2) # sleep a tiny bit so gallery can close & the focus can return to LSS
machine.send_key("alt-f4")
'';
}
);
keymap =
let
pwInput = "qwerty";
pwOutput = "qwertz";
in
makeTest (
{ pkgs, lib, ... }:
{
name = "lomiri-keymap";
meta = {
maintainers = lib.teams.lomiri.members;
};
nodes.machine =
{ config, ... }:
{
imports = [ ./common/user-account.nix ];
virtualisation.memorySize = 2047;
users.users.${user} = {
inherit description;
password = lib.mkForce pwOutput;
};
services.desktopManager.lomiri.enable = lib.mkForce true;
services.displayManager.defaultSession = lib.mkForce "lomiri";
# Help with OCR
fonts.packages = [ pkgs.inconsolata ];
services.xserver.xkb.layout = lib.strings.concatStringsSep "," [
# Start with a non-QWERTY keymap to test keymap patch
"de"
# Then a QWERTY one to test switching
"us"
];
environment.etc."${wallpaperName}".source = wallpaperFile pkgs;
programs.dconf.profiles.user.databases = [
(lomiriWallpaperDconfSettings pkgs)
];
# Help with OCR
systemd.tmpfiles.settings = {
"10-lomiri-test-setup" = terminalOcrTmpfilesSetup { inherit pkgs lib config; };
};
};
enableOCR = true;
testScript =
{ nodes, ... }:
(sharedTestFunctions lib)
+ ''
start_all()
machine.wait_for_unit("multi-user.target")
# Lomiri in greeter mode should use the correct keymap
with subtest("lomiri greeter keymap works"):
ensure_greeter_launched()
# Login
machine.send_chars("${pwInput}\n")
# And the desktop doesn't render the wallpaper anymore. Grumble grumble...
# When going lomiri(greeter) -> lomiri(desktop), we run on tty2
ensure_lomiri_running(2, 1)
# Lomiri in desktop mode should use the correct keymap
with subtest("lomiri session keymap works"):
machine.send_key("ctrl-alt-t")
ensure_terminal_running()
machine.screenshot("terminal_opens")
machine.send_chars("touch ${pwInput}\n")
machine.wait_for_file("/home/alice/${pwOutput}", 90)
# Issues with this keybind: input leaks to focused surface, may open launcher
# Don't have the keyboard indicator to handle this better
machine.send_key("meta_l-spc")
machine.wait_for_console_text('SET KEYMAP "us"')
# Handle keybind fallout
machine.sleep(10) # wait for everything to settle
machine.send_key("esc") # close launcher in case it was opened
machine.sleep(2) # wait for animation to finish
# Make sure input leaks are gone
machine.send_key("backspace")
machine.send_key("backspace")
machine.send_key("backspace")
machine.send_key("backspace")
machine.send_key("backspace")
machine.send_key("backspace")
machine.send_key("backspace")
machine.send_key("backspace")
machine.send_key("backspace")
machine.send_key("backspace")
machine.send_chars("touch ${pwInput}\n")
machine.wait_for_file("/home/alice/${pwInput}", 90)
machine.send_key("alt-f4")
'';
}
);
}
// makeIndicatorTests {
titles = [
"Notifications" # messages
"Rotation" # display
"Battery" # power
"Sound" # sound
"Time" # datetime
"Date" # datetime
"System" # session
];
details = [
# messages normally has no contents
{
name = "display";
left = 6;
ocr = [ "Lock" ];
}
{
name = "bluetooth";
left = 5;
ocr = [ "Bluetooth" ];
}
{
name = "network";
left = 4;
ocr = [
"Flight"
"Wi-Fi"
];
}
{
name = "sound";
left = 3;
ocr = [
"Silent"
"Volume"
];
}
{
name = "power";
left = 2;
ocr = [
"Charge"
"Battery"
];
}
{
name = "datetime";
left = 1;
ocr = [
"Time"
"Date"
];
}
{
name = "session";
left = 0;
ocr = [ "Log Out" ];
extraCheck = ''
# We should be able to log out and return to the greeter
mouse_click(600, 250) # "Log Out"
mouse_click(340, 220) # confirm logout
machine.wait_until_fails("pgrep -u ${user} -f 'lomiri --mode=full-shell'")
'';
}
];
}
|