Skip to content

Commit e6eea8c

Browse files
committed
Resolve merge conflicts and fix hosted legacy desktop navigation
Preserve the upstream Windows SDK override, size the tester window for hosted desktops, avoid native clip-edge clicks, and use keyboard navigation when macOS physical clicks are disabled. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c786bea1-0895-43e7-85ea-ddfa98295f66
1 parent c5bb74a commit e6eea8c

7 files changed

Lines changed: 95 additions & 165 deletions

File tree

‎apps/E2E/README.md‎

Lines changed: 6 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -11,78 +11,6 @@ targets (`desktop.config.mts` in `apps/fluent-tester` and `apps/win32`) and run
1111
the suites from their own directories. Applications do not import E2E suites or
1212
install Storybook.
1313

14-
<<<<<<< HEAD
15-
## Run the tests
16-
17-
After `yarn` and `yarn build` at the repository root, run the endpoint's
18-
`e2eprep` and `e2etest` scripts from its app directory:
19-
20-
| Endpoint | Directory | Prepare | Test | Spec files |
21-
| -------- | -------------------- | ---------------------- | ---------------------- | ---------- |
22-
| macOS | `apps/fluent-tester` | `yarn e2eprep:macos` | `yarn e2etest:macos` | 31 |
23-
| Windows | `apps/fluent-tester` | `yarn e2eprep:windows` | `yarn e2etest:windows` | 10 |
24-
| Win32 | `apps/win32` | `yarn e2eprep:win32` | `yarn e2etest:win32` | 40 |
25-
26-
`e2etest` runs the `legacy` suite, the grouped selection in `desktop-specs.mts`.
27-
Rerun `e2eprep` when the app, its JavaScript, or its native dependencies change;
28-
`e2etest` alone repeats the tests against what is already prepared. Each stage
29-
also runs alone through the app's `desktop-test` script, for example
30-
`yarn desktop-test --target macos build`.
31-
32-
`e2eprep` runs these stages:
33-
34-
- **macOS:** build or verify the native helper, bundle, `pod install`, then
35-
build with Xcode. The bundle comes first because CocoaPods embeds only the
36-
resources that exist during `pod install`.
37-
- **Windows:** build or verify the helper, bundle, generate the Fabric RN Test
38-
App project, build it with the app's `windows` script in build-only mode,
39-
and register the Debug package with
40-
`apps/fluent-tester/scripts/register-windows-app.ps1`. `e2etest` starts Metro
41-
itself, because Debug builds load their JavaScript from it, launches the
42-
registered package, and stops both when the run ends.
43-
The build pins Windows SDK 10.0.22621.0 across the solution so RNSVG's WinMD
44-
does not target a newer SDK than the app. The target explicitly uses the
45-
Windows title `FluentTester`, rather than the component title `Fluent Tester`.
46-
- **Win32:** build or verify the helper and bundle `dist/index.win32.bundle`.
47-
There is no native build: `e2etest` launches the prebuilt REX host from
48-
`@office-iss/rex-win32` against that bundle.
49-
50-
A test run never builds the native helper implicitly. See the `desktop-test`
51-
[commands](../../packages/agentic/desktop-test/references/commands.md) and
52-
[platform setup](../../packages/agentic/desktop-test/references/platforms.md) for
53-
stage semantics.
54-
55-
### Prerequisites
56-
57-
- Node.js 22.19 or later (WebdriverIO 10).
58-
- **macOS:** Xcode, CocoaPods, and Accessibility and Screen Recording authority
59-
for the verified native helper. Check it with
60-
`desktop-driver doctor --platform macos --permissions`; see
61-
[getting started](../../packages/agentic/desktop-driver/references/getting-started.md)
62-
and the [macOS provider guide](../../packages/agentic/desktop-driver/native/macos/README.md).
63-
- **Windows:** the
64-
[React Native Windows development dependencies](https://microsoft.github.io/react-native-windows/docs/rnw-dependencies)
65-
(grab every item and the appropriate versions), PowerShell 7 (`pwsh`),
66-
[Developer Mode](https://docs.microsoft.com/en-us/windows/uwp/get-started/enable-your-device-for-development),
67-
Windows SDK 10.0.22621.0, and the Windows App Runtime 1.8 that Fabric apps load. See the
68-
[Windows tester guide](../fluent-tester/docs/windows.md) for more setup.
69-
- **Win32:** a Windows host. The REX host is a prebuilt npm package, so no
70-
native toolchain is required.
71-
72-
### Suites
73-
74-
`legacy` selects 31 macOS files, 10 Windows files, and 40 Win32 files. The
75-
Windows selection is an allowlist. It omits the `TabsLegacy` and `Tokens`
76-
patterns that the old Windows configuration carried, because neither folder
77-
exists any more: `TabsLegacy` was removed and `Tokens` was split into
78-
`ColorTokens`, `CornerRadiusTokens`, `Spacing`, and others. The harness fails on
79-
any unmatched pattern rather than silently omitting it.
80-
81-
`pilot` and `behavioral-pilot` are smaller suites for qualifying an endpoint.
82-
Run them with the same options as `e2etest`:
83-
||||||| 01ab9fee6
84-
From the repository root, after the normal repository build:
85-
=======
8614
## Run the tests
8715

8816
After `yarn` and `yarn build` at the repository root, run the endpoint's
@@ -125,6 +53,12 @@ A test run never builds the native helper implicitly. See the `desktop-test`
12553
[platform setup](../../packages/agentic/desktop-test/references/platforms.md) for
12654
stage semantics.
12755

56+
The suites size the native client window to 1000x680 at (8, 32), keeping it
57+
within the hosted 1024x768 desktop and above the tester's minimum layout size.
58+
On macOS runners that explicitly disable physical clicks, page navigation
59+
uses native focus and Space instead: legacy navigation buttons do not expose
60+
AXPress. Component interaction assertions keep their existing input semantics.
61+
12862
### Prerequisites
12963

13064
- Node.js 22.19 or later (WebdriverIO 10).
@@ -154,7 +88,6 @@ any unmatched pattern rather than silently omitting it.
15488

15589
`pilot` and `behavioral-pilot` are smaller suites for qualifying an endpoint.
15690
Run them with the same options as `e2etest`:
157-
>>>>>>> e7729c839f41bafc19a19930d3d86d4f5d7cb4f9
15891

15992
```sh
16093
yarn desktop-test --config ../E2E/desktop.config.mts --target win32 test --suite pilot --list

‎apps/E2E/desktop-adapters.test.cjs‎

Lines changed: 73 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -85,24 +85,31 @@ test('native key chords release held input even when dispatch fails', async () =
8585
}
8686
});
8787

88-
test('native scrolling clips an oversized scroller to the window client viewport', async () => {
89-
let scrolled = false;
90-
globalThis.browser = {
91-
capabilities: { 'furn:features': { wheel: true } },
92-
getWindowRect: async () => ({ x: 200, y: 100, width: 1000, height: 700 }),
93-
getElementRect: async (id) =>
94-
id === 'scroller' ? { x: 10, y: 80, width: 150, height: 670 } : { x: 20, y: scrolled ? 450 : 720, width: 120, height: 24 },
95-
getWindowHandle: async () => 'window',
96-
switchToWindow: async (handle) => assert.equal(handle, 'window'),
97-
async performActions() {
98-
scrolled = true;
99-
},
100-
async waitUntil(predicate) {
101-
assert.equal(await predicate(), true);
102-
},
103-
};
104-
await scrollNativeDesktopElement({ elementId: 'button', isDisplayed: async () => true }, { elementId: 'scroller' });
105-
assert.equal(scrolled, true);
88+
test('native scrolling clips oversized scrollers and keeps click centers away from clip edges', async () => {
89+
for (const [scrollerHeight, targetY] of [
90+
[670, 720],
91+
[585, 652],
92+
]) {
93+
let scrolled = false;
94+
globalThis.browser = {
95+
capabilities: { 'furn:features': { wheel: true } },
96+
getWindowRect: async () => ({ x: 200, y: 100, width: 1000, height: 700 }),
97+
getElementRect: async (id) =>
98+
id === 'scroller'
99+
? { x: 10, y: 80, width: 150, height: scrollerHeight }
100+
: { x: 20, y: scrolled ? 450 : targetY, width: 120, height: 24 },
101+
getWindowHandle: async () => 'window',
102+
switchToWindow: async (handle) => assert.equal(handle, 'window'),
103+
async performActions() {
104+
scrolled = true;
105+
},
106+
async waitUntil(predicate) {
107+
assert.equal(await predicate(), true);
108+
},
109+
};
110+
await scrollNativeDesktopElement({ elementId: 'button', isDisplayed: async () => true }, { elementId: 'scroller' });
111+
assert.equal(scrolled, true);
112+
}
106113
});
107114

108115
test('negative disabled-control clicks use physical input and release it on failure', async () => {
@@ -132,3 +139,51 @@ test('negative disabled-control clicks use physical input and release it on fail
132139
assert.equal(released, true);
133140
}
134141
});
142+
143+
test('hosted macOS navigation uses keyboard only when physical clicks are explicitly disabled', async () => {
144+
for (const physicalClick of [false, true, undefined]) {
145+
const page = new BasePage();
146+
page.platform = 'macos';
147+
const inputs = [];
148+
const button = {
149+
elementId: 'page',
150+
isDisplayed: async () => true,
151+
isEnabled: async () => true,
152+
click: async () => inputs.push('click'),
153+
};
154+
Object.defineProperties(page, {
155+
_pageButton: { value: button },
156+
_testPageButtonScrollViewer: { value: { elementId: 'scroller' } },
157+
});
158+
page.waitForPageToLoad = async () => true;
159+
globalThis.browser = {
160+
capabilities: { browserName: 'furn-native-desktop', 'furn:features': { physicalClick, keyboard: true } },
161+
getWindowRect: async () => ({ x: 8, y: 32, width: 1000, height: 680 }),
162+
getElementRect: async () => ({ x: 10, y: 80, width: 140, height: 30 }),
163+
async elementSendKeys(id, text) {
164+
assert.equal(id, 'page');
165+
assert.equal(text, '');
166+
inputs.push('focus');
167+
},
168+
async performActions([source]) {
169+
assert.deepEqual(source.actions, [
170+
{ type: 'keyDown', value: Keys.SPACE },
171+
{ type: 'keyUp', value: Keys.SPACE },
172+
]);
173+
inputs.push('space');
174+
},
175+
async releaseActions() {
176+
inputs.push('release');
177+
},
178+
};
179+
assert.equal(await page.navigateToPageAndLoadTests(), true);
180+
assert.deepEqual(inputs, physicalClick === false ? ['focus', 'space', 'release'] : ['click']);
181+
if (physicalClick === false) {
182+
browser.capabilities['furn:features'].keyboard = false;
183+
await assert.rejects(page.navigateToPageAndLoadTests(), /does not support keyboard navigation/);
184+
button.isEnabled = async () => false;
185+
assert.equal(await page.navigateToPageAndLoadTests(), true);
186+
assert.deepEqual(inputs, ['focus', 'space', 'release']);
187+
}
188+
}
189+
});

‎apps/E2E/src/common/BasePage.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,13 @@ export abstract class BasePage {
9292
await this.sendKeys(pageButton, [Keys.ENTER]);
9393
} else if (!isNativeDesktop() || (await this._pageButton.isEnabled())) {
9494
// The tester disables the selected page's button; specs that share a page (e.g. IconLegacy and IconV1) find it already open.
95-
await this._pageButton.click();
95+
if (isNativeDesktop() && this.platform === 'macos' && browser.capabilities['furn:features']?.physicalClick === false) {
96+
// Hosted macOS disables physical clicks, and legacy navigation buttons do not expose AXPress.
97+
if (!browser.capabilities['furn:features']?.keyboard) throw new Error('This desktop does not support keyboard navigation.');
98+
await this.sendKeys(this._pageButton, [Keys.SPACE]);
99+
} else {
100+
await this._pageButton.click();
101+
}
96102
}
97103

98104
// Wait for page to load

‎apps/E2E/src/common/desktopHooks.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ export default {
1717
async before() {
1818
reporting = await createDesktopReportSession({ artifactsRoot: path.resolve('artifacts', 'desktop'), kind: 'lifecycle' });
1919
installLegacyDesktopAttributes();
20-
// Native cohorts use the app's initial bounds and native scrolling, not an emulated maximize command.
20+
// Initial app bounds can extend beyond the hosted 1024x768 desktop (or be smaller than the tester's minimum layout).
21+
if (!browser.capabilities['furn:features']?.setWindowRect) throw new Error('The native tester window cannot be sized.');
22+
await browser.setWindowRect(8, 32, 1000, 680);
2123
const { width, height } = await browser.getWindowRect();
2224
if (width <= 0 || height <= 0) throw new Error('The native tester window has no usable bounds.');
2325
},

‎apps/E2E/src/common/nativeDesktop.ts‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,13 @@ async function isCenterWithinScroller(element: PageElement, scroller: PageElemen
4444
const window = await browser.getWindowRect();
4545
const x = targetRect.x + targetRect.width / 2;
4646
const y = targetRect.y + targetRect.height / 2;
47+
// Avoid the native clip edge: a center one pixel inside the UIA bounds can still hit the surrounding pane.
48+
const inset = 8;
4749
return (
48-
x > Math.max(0, viewport.x) &&
49-
y > Math.max(0, viewport.y) &&
50-
x < Math.min(window.width, viewport.x + viewport.width) &&
51-
y < Math.min(window.height, viewport.y + viewport.height)
50+
x > Math.max(0, viewport.x) + inset &&
51+
y > Math.max(0, viewport.y) + inset &&
52+
x < Math.min(window.width, viewport.x + viewport.width) - inset &&
53+
y < Math.min(window.height, viewport.y + viewport.height) - inset
5254
);
5355
}
5456

‎apps/fluent-tester/README.md‎

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,6 @@
77
- [Windows](./docs/windows.md)
88
- [Win32](./../win32/README.md)
99

10-
<<<<<<< HEAD
11-
## End-to-end tests
12-
13-
The macOS and Windows end-to-end tests run from this directory through `desktop-test`. Run `e2eprep` once per
14-
renderer or native change, then `e2etest`:
15-
16-
```sh
17-
yarn e2eprep:macos && yarn e2etest:macos
18-
yarn e2eprep:windows && yarn e2etest:windows
19-
```
20-
21-
`e2eprep` builds the desktop driver helper, bundles, prepares, and builds the app; `e2etest` runs the `legacy` suite
22-
from [`apps/E2E`](../E2E/README.md), which covers prerequisites, suites, and debugging failures. For the harness
23-
itself, see the `@fluentui-react-native/desktop-test` package guide at `packages/agentic/desktop-test/README.md`.
24-
25-
Windows preparation requires Windows SDK 10.0.22621.0 and Windows App Runtime 1.8.
26-
The target uses the SDK consistently for the app and its native dependencies,
27-
registers the Debug package, and matches its exact `FluentTester` window title.
28-
The test run owns Metro and stops it on completion.
29-
||||||| 01ab9fee6
30-
For native desktop E2E configuration and suite execution, see the
31-
`@fluentui-react-native/desktop-test` package guide at
32-
`packages/agentic/desktop-test/README.md`.
33-
=======
3410
## End-to-end tests
3511

3612
The macOS and Windows end-to-end tests run from this directory through `desktop-test`. Run `e2eprep` once per
@@ -50,4 +26,3 @@ Windows preparation requires Windows App Runtime 1.8 and Windows SDK 10.0.22621.
5026
The target uses the SDK consistently for the app and its native dependencies,
5127
registers the Debug package, and matches its exact `FluentTester` window title.
5228
The test run owns Metro and stops it on completion.
53-
>>>>>>> e7729c839f41bafc19a19930d3d86d4f5d7cb4f9
Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,14 @@
11
import { defineDesktopConfig } from '@fluentui-react-native/desktop-test/config';
22

3-
<<<<<<< HEAD
4-
const metroPort = 8081;
5-
6-
||||||| 01ab9fee6
7-
=======
83
const metroPort = 8081;
94
// Hosted runners set the installed SDK (the Windows Server 2025 image ships only 10.0.26100.0).
105
const windowsSdkVersion = process.env.WindowsTargetPlatformVersion || '10.0.22621.0';
116

12-
>>>>>>> e7729c839f41bafc19a19930d3d86d4f5d7cb4f9
137
export default defineDesktopConfig({
148
schemaVersion: 1,
159
projectRoot: new URL('.', import.meta.url),
1610
targets: {
1711
macos: { host: { kind: 'react-native-test-app', renderer: 'fabric' }, launchTimeoutMs: 180_000 },
18-
<<<<<<< HEAD
19-
windows: {
20-
// Windows uses the app displayName, not the component displayName used by macOS.
21-
host: { kind: 'react-native-test-app', renderer: 'fabric', application: { windowTitle: 'FluentTester' } },
22-
launchTimeoutMs: 180_000,
23-
commands: {
24-
// The default build stage does not register the package that the harness launches by AUMID.
25-
build: [
26-
{
27-
command: 'yarn',
28-
args: [
29-
'windows',
30-
'--no-deploy',
31-
'--no-launch',
32-
'--no-packager',
33-
// RNSVG otherwise chooses the newest SDK and its WinMD is rejected by the RN Test App.
34-
'--msbuildprops',
35-
'WindowsTargetPlatformVersion=10.0.22621.0',
36-
],
37-
},
38-
{ command: 'pwsh', args: ['-NoProfile', '-File', 'scripts/register-windows-app.ps1'] },
39-
],
40-
},
41-
// Debug builds of the RN Test App load their JavaScript from Metro.
42-
services: [
43-
{
44-
id: 'metro',
45-
command: { command: 'yarn', args: ['exec', 'rnx-cli', 'start', '--no-interactive', '--port', String(metroPort)] },
46-
// eslint-disable-next-line @microsoft/sdl/no-insecure-url -- React Native Test App connects to loopback Metro
47-
readyUrl: `http://127.0.0.1:${metroPort}/status`,
48-
},
49-
],
50-
},
51-
||||||| 01ab9fee6
52-
windows: { host: { kind: 'react-native-test-app', renderer: 'fabric' }, launchTimeoutMs: 180_000 },
53-
=======
5412
windows: {
5513
// Windows uses the app displayName, not the component displayName used by macOS.
5614
host: { kind: 'react-native-test-app', renderer: 'fabric', application: { windowTitle: 'FluentTester' } },
@@ -83,6 +41,5 @@ export default defineDesktopConfig({
8341
},
8442
],
8543
},
86-
>>>>>>> e7729c839f41bafc19a19930d3d86d4f5d7cb4f9
8744
},
8845
});

0 commit comments

Comments
 (0)