Skip to content

Fix root yarn clean recursion and desktop-driver element screenshots - #4394

Merged
Jason Morse (JasonVMo) merged 1 commit into
mainfrom
user/jasonvmo/fix-infra-bugs
Oct 26, 2026
Merged

Jason Morse (JasonVMo) merged 1 commit into
mainfrom
user/jasonvmo/fix-infra-bugs

Conversation

@JasonVMo

Copy link
Copy Markdown
Contributor

Platforms Impacted

  • iOS
  • macOS
  • win32 (Office)
  • windows
  • android

Repository tooling only: the root clean script and the platform-neutral Desktop Driver WebdriverIO commands used by macOS, Windows, and Win32 desktop tests. No component or native source changes.

Description of changes

Root yarn clean no longer recurses. The root clean script runs tsc -b --clean && lage clean, and Lage's clean pipeline included the root workspace, so it re-ran that script indefinitely.

  • lage.config.mjs: adds a @fluentui-react-native/root#clean no-op target so Lage skips the root script while still cleaning every package.
  • scripts/src/tasks/clean.test.mjs (wired into scripts/package.json): regression test for the root script, the no-op root target, and the unchanged generic clean target.
  • references/agents/repository/development.md: documents the behavior.

Desktop Driver element.takeScreenshot() now captures the element. WebdriverIO elements inherit the session-wide takeScreenshot protocol command, so element.takeScreenshot() called GET /session/:id/screenshot and returned the whole window. The server's element screenshot route and the native crop were already correct.

  • packages/agentic/desktop-driver/src/wdio/DesktopWebdriver.ts: installDesktopWebdriverCommands registers an element-scoped takeScreenshot (addCommand(..., { attachToElement: true })) that delegates to takeElementScreenshot(this.elementId). This applies to connectDesktopWebdriver, attachDesktopWebdriver, and WDIO-managed browsers. browser.takeScreenshot() still captures the window. When the target does not support element capture, the call fails instead of falling back to a window image.
  • src/wdio/screenshots.contract.cjs and DesktopWebdriver.test.ts: fake-host regression covering connected, attached, and raw-WDIO-attach browsers, with distinct window and element payloads. It also checks saveScreenshot and that unsupported element capture fails.
  • references/test-integration.md: documents the behavior.
  • .changeset/desktop-element-screenshots.md: patch for @fluentui-react-native/desktop-driver.

Related: #4345 (not closed by this PR).

Verification

Automated (run on macOS):

  • yarn clean at the root: passed; it completes and exits instead of recursing.
  • yarn format && yarn lint && yarn build && yarn test in scripts: passed (53 tests).
  • yarn format && yarn lint && yarn build && yarn test in packages/agentic/desktop-driver: passed (69 passed; 3 opt-in native helper contract tests skipped, as they are by default). The new regression failed before the fix: the supported path returned window data, and the unsupported path succeeded instead of throwing.
  • yarn change:check: passed.
  • yarn clean-lage-cache && yarn lage buildci: passed (175/175 tasks).

Manual native check, macOS Fabric, apps/storybook:

  • yarn storybook bundle --macos, yarn storybook prep --macos, yarn storybook build --macos: passed.
  • yarn storybook driver --macos + yarn storybook run --macos, then yarn storybook test --macos --test "supports native pointer activation": passed (1/1).
  • Ad hoc WDIO probe against components-button--default through both connectDesktopWebdriver({ launchMode: 'attach' }) and attachDesktopWebdriver(...): passed. For the button (64.5 × 34 pt at 2× scale), element.takeScreenshot(), browser.takeElementScreenshot(id), and element.saveScreenshot(path) all returned the same 129 × 68 PNG showing only the button. browser.takeScreenshot() returned the 2720 × 1988 window.

Not run: Windows and Win32 native lanes. The change is in the platform-neutral WDIO layer and uses the existing element screenshot route.

Before After
yarn clean at the root re-invoked itself indefinitely. yarn clean cleans every workspace once and exits.
element.takeScreenshot() returned the full window (2720 × 1988 on macOS). element.takeScreenshot() returns the element crop (129 × 68 for the Storybook button), matching browser.takeElementScreenshot().

Pull request checklist

This PR has considered (when applicable):

  • Automated Tests
  • Documentation and examples
  • Keyboard Accessibility
  • Voiceover
  • Internationalization and Right-to-left Layouts

@github-actions

Copy link
Copy Markdown
Contributor

Bundle size report

Tree-shaken, minified production esbuild bundles with React and React Native runtimes externalized.

Scenario Modules-Mac (Δ) Modules-Win (Δ) Size-Mac (Δ) Size-Win (Δ)
components-button 64 (+2) 65 (+2) 50.63k (+687b) 50.55k (+687b)
components-catalog 214 (+55) 215 (+55) 205.49k (+50.22k) 205.41k (+50.22k)
design-theme-state 34 (+1) 35 (+1) 30.15k (+42b) 30.08k (+42b)
design-themed-root 38 (+1) 39 (+1) 32.12k (+42b) 32.04k (+42b)
design-color-lib 6 (+0) 6 (+0) 6.33k (+0b) 6.33k (+0b)
design-theme-state-legacy-source 35 (+1) 36 (+1) 31.81k (+42b) 31.73k (+42b)
design-legacy-theme-from-flex 58 (+1) 59 (+1) 97.77k (+42b) 97.63k (+42b)

The job is advisory: size changes are reported but do not fail the pull request. Bundle or analysis errors still fail.


View bundle-size workflow run

@JasonVMo
Jason Morse (JasonVMo) enabled auto-merge (squash) October 26, 2026 19:22
@JasonVMo
Jason Morse (JasonVMo) merged commit 8fb422f into main Oct 26, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants