summary refs log tree commit diff
path: root/nixos/tests/chromium.nix
diff options
context:
space:
mode:
authorMichael Weiss <dev.primeos@gmail.com>2021-01-20 16:42:40 +0100
committerMichael Weiss <dev.primeos@gmail.com>2021-01-20 16:57:46 +0100
commit8a7a8442c172bf419853b3d40e245fbc9bf69759 (patch)
treefdf630524eaccf0d29270a5f6bfe861a647400d4 /nixos/tests/chromium.nix
parent3df16a48bf41b440c0809ef11e420ece12282549 (diff)
downloadnixpkgs-8a7a8442c172bf419853b3d40e245fbc9bf69759.tar
nixpkgs-8a7a8442c172bf419853b3d40e245fbc9bf69759.tar.gz
nixpkgs-8a7a8442c172bf419853b3d40e245fbc9bf69759.tar.bz2
nixpkgs-8a7a8442c172bf419853b3d40e245fbc9bf69759.tar.lz
nixpkgs-8a7a8442c172bf419853b3d40e245fbc9bf69759.tar.xz
nixpkgs-8a7a8442c172bf419853b3d40e245fbc9bf69759.tar.zst
nixpkgs-8a7a8442c172bf419853b3d40e245fbc9bf69759.zip
nixos/tests/chromium: Fix a race condition
Only execute Ctrl+w to close the currently active window if the
new/secondary window (title: "New Tab") could be selected. This fixes a
test failure since the update to Chromium M88 (cc PR #110010).
Without this additional check the main window (title: "startup done")
could still be selected (and thus will be closed) and the script would
close both windows (i.e. terminate Chromium completely).
Diffstat (limited to 'nixos/tests/chromium.nix')
-rw-r--r--nixos/tests/chromium.nix15
1 files changed, 8 insertions, 7 deletions
diff --git a/nixos/tests/chromium.nix b/nixos/tests/chromium.nix
index 795b93f6f54..d4085bebac0 100644
--- a/nixos/tests/chromium.nix
+++ b/nixos/tests/chromium.nix
@@ -80,7 +80,7 @@ mapAttrs (channel: chromiumPkg: makeTest rec {
 
     def close_win():
         def try_close(_):
-            machine.execute(
+            status, _ = machine.execute(
                 ru(
                     "${xdo "close-window" ''
                       search --onlyvisible --name "new tab"
@@ -89,13 +89,14 @@ mapAttrs (channel: chromiumPkg: makeTest rec {
                     ''}"
                 )
             )
-            machine.execute(
-                ru(
-                    "${xdo "close-window" ''
-                      key Ctrl+w
-                    ''}"
+            if status == 0:
+                machine.execute(
+                    ru(
+                        "${xdo "close-window" ''
+                          key Ctrl+w
+                        ''}"
+                    )
                 )
-            )
             for _ in range(1, 20):
                 status, out = machine.execute(
                     ru(