Skip to content

test(linux): read the window size again before the screenshot - #2848

Open
Laotree wants to merge 1 commit into
nsgo-dev:mainfrom
Laotree:fix/linux-automation-shot-size
Open

Laotree wants to merge 1 commit into
nsgo-dev:mainfrom
Laotree:fix/linux-automation-shot-size

Conversation

@Laotree

@Laotree Laotree commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Summary

TestLinuxAutomationEndToEnd reads the window list once, right after the app connects, and later compares the screenshot against that size. The window changes size during the test: revealing the auto-hiding menu bar for the Actions > Reset step shortens the window content by the bar's height, and the engine lays the view out again. On such a run the capture is 480x615 while the stored size is 480x640, so the test fails although the screenshot covers the window. In CI this is the intermittent screenshot size 480x615 of window {... Height:640 ...} failure.

The test now reads the window size again just before the screenshot, so both describe the same moment.

Fixes #2819.

Targets

  • Shared code (core, base, ui, tsx, the nsgo tool)
  • macOS
  • iOS
  • tvOS
  • watchOS
  • Android
  • Windows
  • Linux
  • Web
  • Mini programs
  • Docs or website only

Screenshots

None

Verification

  • head: 0f2cf5bb4ad0
  • base: a10710d3c4f
  • commands:
    • NSGO_AUTOMATION_E2E=1 GDK_BACKEND=x11 GSK_RENDERER=cairo GTK_A11Y=none xvfb-run -a dbus-run-session -- go tool nsgo test -run '^TestLinuxAutomationEndToEnd$' ./cmd/nsgo -- -count=1 before the change, in an Ubuntu 24.04 container with libgtk-4-1 4.14.5+ds-0ubuntu0.10 (the version test.yml installs) → 1 failed, twice: screenshot size 480x615 of window {ID:1 Graph:1 Title:Automation Kind:window Width:480 Height:640 Default:true}: <nil>
    • the same command after the change → 1 passed, three times
    • a probe read the window list at the capture: it reports Width:480 Height:615, so the capture agrees with the window and only the stored size was stale
    • go tool nsgo check -target linux_x64 -jobs 2 → 0
    • gofmt -l cmd/nsgo/automation_e2e_linux_test.go → no output
  • result: pass
  • not covered: the macOS and Windows automation end-to-end tests, which this change does not touch; the rest of the Linux packages, which the check covers but this container does not run.

Checklist

  • The title is a Conventional Commit, such as fix(linux): keep the caret after a paste; a squash merge uses it as the commit subject.
  • Docs whose facts change are updated, and a capability users can see has a line in a changelog.d/ fragment, not in CHANGELOG.md. Nothing a user sees changes: this is test code.
  • No new third-party code, assets, or dependencies.

🤖 Generated with Claude Code

The end-to-end test compares the screenshot with the window size read when the app connects. A revealed menu bar shortens the window content during the test, so the capture is 25 px shorter and the test fails although it covers the window.

Read the window size just before the screenshot so both describe the same moment.
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

This pull request has no valid Local CI declaration for its head commit, so a maintainer audits it before merging:

  • the body has no <!-- local-ci --> block under ## Verification

Run the checks on the head commit, fill the block in the template, then push or edit the body: this label and comment update on their own.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

linux: TestLinuxAutomationEndToEnd reports a screenshot 25 px shorter than the window

1 participant