Skip to content

Commit 25e5534

Browse files
DeepDiver1975claude
andcommitted
test/gui: write window screenshots with grabScreenshot(path)
The previous run captured all screens but uploaded no artifact: the code used the deprecated grabWidget() and called Image.save(dir, name) with two arguments, but Squish's Image.save() takes a single full path, so nothing was written. Switch to object.grabScreenshot(path) and verify the file exists, falling back to a desktop capture (which is then also verified) so a run can never report success while producing no files. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
1 parent 111c42e commit 25e5534

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

test/gui/shared/scripts/helpers/DocScreenshotHelper.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,20 @@ def capture_doc_screenshot(screen_id):
102102
if window_ref is not None:
103103
try:
104104
window = squish.waitForObject(window_ref)
105-
squish.grabWidget(window).save(
106-
os.path.dirname(target), os.path.basename(target)
105+
# object.grabScreenshot(path) is the current API (grabWidget is
106+
# deprecated). Image.save() takes a single full path, not
107+
# (dir, name) -- passing two args silently fails to write.
108+
window.grabScreenshot(target)
109+
if os.path.exists(target):
110+
test.log(f"Doc screenshot (window) captured: {rel_name}")
111+
return target
112+
test.log(
113+
f"grabScreenshot wrote no file for '{screen_id}'; "
114+
f"falling back to desktop capture"
107115
)
108-
test.log(f"Doc screenshot (window) captured: {rel_name}")
109-
return target
110116
except (LookupError, RuntimeError) as err:
111117
test.log(
112-
f"grabWidget failed for '{screen_id}' ({err}); "
118+
f"grabScreenshot failed for '{screen_id}' ({err}); "
113119
f"falling back to desktop capture"
114120
)
115121

0 commit comments

Comments
 (0)