Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions qubes/tests/integ/dispvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,41 @@ def _handle_editor(self, winid, copy=False):
else:
raise KeyError(window_title)

def _whonix_ws_dispvm_confirm(self, action_str):
try:
winid = self.wait_for_window(
"qrexec-policy-agent",
search_class=True,
include_tray=False,
timeout=5,
)
except Exception:
return (
False,
"Failed to find qrexec confirmation window for "
f"{action_str} action",
)
try:
subprocess.run(
[
"bash",
"-c",
"--",
f"xdotool windowfocus {winid}; sleep 1.1; "
"xdotool key enter",
],
check=True,
)
except subprocess.CalledProcessError as err:
return (
False,
"Failed to activate qrexec confirmation window for "
"{} action: exit code {}, {}{}".format(
action_str, err.returncode, err.stdout, err.stderr
),
)
return (True, "")

@unittest.skipUnless(
spawn.find_executable("xdotool"), "xdotool not installed"
)
Expand All @@ -905,6 +940,11 @@ def test_030_edit_file(self):
)
)

if "whonix-workstation" in self.template:
dvm_confirm_rslt = self._whonix_ws_dispvm_confirm("edit file")
if not dvm_confirm_rslt[0]:
self.fail(dvm_confirm_rslt[1])

# if first 5 windows isn't expected editor, there is no hope
winid = None
for _ in range(5):
Expand Down Expand Up @@ -1074,6 +1114,11 @@ def test_100_open_in_dispvm(self):
)
)

if "whonix-workstation" in self.template:
dvm_confirm_rslt = self._whonix_ws_dispvm_confirm("DispVM open")
if not dvm_confirm_rslt[0]:
self.fail(dvm_confirm_rslt[1])

# if first 5 windows isn't expected editor, there is no hope
winid = None
for _ in range(5):
Expand Down