Skip to content

[tests] Take a screenshot on test timeout in run-packaged-macos-tests#25921

Open
rolfbjarne wants to merge 1 commit into
mainfrom
dev/rolf/screenshot-on-timeout
Open

[tests] Take a screenshot on test timeout in run-packaged-macos-tests#25921
rolfbjarne wants to merge 1 commit into
mainfrom
dev/rolf/screenshot-on-timeout

Conversation

@rolfbjarne

@rolfbjarne rolfbjarne commented Jul 3, 2026

Copy link
Copy Markdown
Member

When a test run times out (either the launch timeout or the execution timeout), take a screenshot of the screen using screencapture. The screenshot is then copied to the HTML report directory and shown as a download link in the report table.

🤖 Pull request created by Copilot

When a test run times out (either the launch timeout or the execution
timeout), take a screenshot of the screen using screencapture. The
screenshot is then copied to the HTML report directory and shown as a
download link in the report table.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne rolfbjarne marked this pull request as ready for review July 3, 2026 17:02
Copilot AI review requested due to automatic review settings July 3, 2026 17:02
@rolfbjarne rolfbjarne enabled auto-merge (squash) July 3, 2026 17:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the macOS packaged test runner so that when a test launch or execution hits a timeout, it captures a screenshot via screencapture and exposes it in the generated HTML report, aiding diagnosis of hung UI prompts or stalled tests.

Changes:

  • Extended ExecuteWithTimeout to return a screenshot path when a launch/execution timeout occurs.
  • Added a TakeScreenshot helper that invokes /usr/sbin/screencapture and stores the image in the test output directory.
  • Updated HTML report generation to copy screenshots into the report directory and add a “Screenshot” column with download links.

string output;
var screenshotPath = "";

for (var attempt = 0; attempt < maxLaunchAttempts; attempt++) {
Comment on lines +382 to +393
var p = Process.Start (new ProcessStartInfo {
FileName = "/usr/sbin/screencapture",
ArgumentList = { "-x", "-T", "0", path },
UseShellExecute = false,
});
if (p is not null) {
p.WaitForExit (TimeSpan.FromSeconds (10));
if (File.Exists (path)) {
Console.WriteLine ($"Screenshot saved to {path}");
return path;
}
}
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #95a2707] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 95a27078b386778a5dfb81ed456538c0f47cc8ae [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #95a2707] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 95a27078b386778a5dfb81ed456538c0f47cc8ae [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 95a27078b386778a5dfb81ed456538c0f47cc8ae [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #95a2707] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 95a27078b386778a5dfb81ed456538c0f47cc8ae [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🚀 [CI Build #95a2707] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 199 tests passed 🎉

Tests counts

✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 15 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 15 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 15 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 18 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 17 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 18 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 18 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Ventura (13): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

Linux build succeeded

Pipeline on Agent
Hash: 95a27078b386778a5dfb81ed456538c0f47cc8ae [PR build]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants