Skip to content

Commit cb905f9

Browse files
authored
Switch fluentui-react-native to pnpm mode (#3984)
* switch over to pnpm and make non-appium fixes * first stage of appium fixes * fix type errors after upgrading to new appium version * get e2e tests running * use cross-env to normalize the e2e commands for both prep and run
1 parent 2ba6a9f commit cb905f9

File tree

46 files changed

+3038
-2973
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+3038
-2973
lines changed

.ado/templates/e2e-testing-android.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ steps:
3838
condition: succeeded()
3939
displayName: 'Create success build variable'
4040

41+
- script: |
42+
yarn e2eprep:android
43+
workingDirectory: apps/E2E
44+
displayName: 'prepare E2E Android tests'
45+
condition: succeeded()
46+
4147
- script: |
4248
yarn e2etest:android
4349
workingDirectory: apps/E2E

.ado/templates/e2e-testing-ios.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ steps:
1111
condition: succeeded()
1212
displayName: 'Create success build variable'
1313

14+
- script: |
15+
yarn e2eprep:ios
16+
workingDirectory: apps/E2E
17+
displayName: 'prepare E2E iOS tests'
18+
condition: succeeded()
19+
1420
- script: |
1521
yarn e2etest:ios
1622
workingDirectory: apps/E2E

.ado/templates/e2e-testing-macos.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ steps:
1111
condition: succeeded()
1212
displayName: 'Create success build variable'
1313

14+
- script: |
15+
yarn e2eprep:macos
16+
workingDirectory: apps/E2E
17+
displayName: 'prepare E2E macos tests'
18+
condition: succeeded()
19+
1420
- script: |
1521
yarn e2etest:macos
1622
workingDirectory: apps/E2E

.ado/templates/e2e-testing-uwp.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ steps:
3535
condition: succeeded()
3636
displayName: 'Create success build variable'
3737

38+
- script: |
39+
yarn e2eprep:windows
40+
workingDirectory: apps/E2E
41+
displayName: 'prepare E2E Windows tests'
42+
condition: succeeded()
43+
3844
- script: |
3945
yarn e2etest:windows
4046
workingDirectory: apps\E2E

.ado/templates/e2e-testing-win32.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ steps:
2525
condition: succeeded()
2626
displayName: 'Create success build variable'
2727

28+
- script: |
29+
yarn e2eprep:win32
30+
workingDirectory: apps/E2E
31+
displayName: 'prepare E2E Win32 tests'
32+
condition: succeeded()
33+
2834
- script: |
2935
yarn e2etest:win32
3036
workingDirectory: apps/E2E

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,7 @@ apps/*/.vscode/.react/
115115
!**/.yarn/versions
116116

117117
# Ccache
118-
.ccache
118+
.ccache
119+
120+
# Appium
121+
**/.appium
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
diff --git a/lib/index.js b/lib/index.js
2+
index cff5a1256df83e746d874c5ca722d5b3b8c8ac3c..178a004a0b4231a6be964b8c33d153a2525ac168 100644
3+
--- a/lib/index.js
4+
+++ b/lib/index.js
5+
@@ -20,18 +20,26 @@ expectLib.extend = (m) => {
6+
};
7+
expectLib.extend(filteredMatchers);
8+
const expectWithSoft = expectLib;
9+
-Object.defineProperty(expectWithSoft, 'soft', {
10+
- value: (actual) => createSoftExpect(actual)
11+
-});
12+
-Object.defineProperty(expectWithSoft, 'getSoftFailures', {
13+
- value: (testId) => SoftAssertService.getInstance().getFailures(testId)
14+
-});
15+
-Object.defineProperty(expectWithSoft, 'assertSoftFailures', {
16+
- value: (testId) => SoftAssertService.getInstance().assertNoFailures(testId)
17+
-});
18+
-Object.defineProperty(expectWithSoft, 'clearSoftFailures', {
19+
- value: (testId) => SoftAssertService.getInstance().clearFailures(testId)
20+
-});
21+
+if (!Object.prototype.hasOwnProperty.call(expectWithSoft, 'soft')) {
22+
+ Object.defineProperty(expectWithSoft, 'soft', {
23+
+ value: (actual) => createSoftExpect(actual)
24+
+ });
25+
+}
26+
+if (!Object.prototype.hasOwnProperty.call(expectWithSoft, 'getSoftFailures')) {
27+
+ Object.defineProperty(expectWithSoft, 'getSoftFailures', {
28+
+ value: (testId) => SoftAssertService.getInstance().getFailures(testId)
29+
+ });
30+
+}
31+
+if (!Object.prototype.hasOwnProperty.call(expectWithSoft, 'assertSoftFailures')) {
32+
+ Object.defineProperty(expectWithSoft, 'assertSoftFailures', {
33+
+ value: (testId) => SoftAssertService.getInstance().assertNoFailures(testId)
34+
+ });
35+
+}
36+
+if (!Object.prototype.hasOwnProperty.call(expectWithSoft, 'clearSoftFailures')) {
37+
+ Object.defineProperty(expectWithSoft, 'clearSoftFailures', {
38+
+ value: (testId) => SoftAssertService.getInstance().clearFailures(testId)
39+
+ });
40+
+}
41+
export const expect = expectWithSoft;
42+
export const getConfig = () => DEFAULT_OPTIONS;
43+
export const setDefaultOptions = (options = {}) => {
44+
diff --git a/lib/index.js.bak b/lib/index.js.bak
45+
new file mode 100644
46+
index 0000000000000000000000000000000000000000..cff5a1256df83e746d874c5ca722d5b3b8c8ac3c
47+
--- /dev/null
48+
+++ b/lib/index.js.bak
49+
@@ -0,0 +1,48 @@
50+
+import { expect as expectLib } from 'expect';
51+
+import * as wdioMatchers from './matchers.js';
52+
+import { DEFAULT_OPTIONS } from './constants.js';
53+
+import createSoftExpect from './softExpect.js';
54+
+import { SoftAssertService } from './softAssert.js';
55+
+export const matchers = new Map();
56+
+const filteredMatchers = {};
57+
+const extend = expectLib.extend;
58+
+Object.keys(wdioMatchers).forEach(matcher => {
59+
+ if (typeof wdioMatchers[matcher] === 'function') {
60+
+ filteredMatchers[matcher] = wdioMatchers[matcher];
61+
+ }
62+
+});
63+
+expectLib.extend = (m) => {
64+
+ if (!m || typeof m !== 'object') {
65+
+ return;
66+
+ }
67+
+ Object.entries(m).forEach(([name, matcher]) => matchers.set(name, matcher));
68+
+ return extend(m);
69+
+};
70+
+expectLib.extend(filteredMatchers);
71+
+const expectWithSoft = expectLib;
72+
+Object.defineProperty(expectWithSoft, 'soft', {
73+
+ value: (actual) => createSoftExpect(actual)
74+
+});
75+
+Object.defineProperty(expectWithSoft, 'getSoftFailures', {
76+
+ value: (testId) => SoftAssertService.getInstance().getFailures(testId)
77+
+});
78+
+Object.defineProperty(expectWithSoft, 'assertSoftFailures', {
79+
+ value: (testId) => SoftAssertService.getInstance().assertNoFailures(testId)
80+
+});
81+
+Object.defineProperty(expectWithSoft, 'clearSoftFailures', {
82+
+ value: (testId) => SoftAssertService.getInstance().clearFailures(testId)
83+
+});
84+
+export const expect = expectWithSoft;
85+
+export const getConfig = () => DEFAULT_OPTIONS;
86+
+export const setDefaultOptions = (options = {}) => {
87+
+ Object.entries(options).forEach(([key, value]) => {
88+
+ if (key in DEFAULT_OPTIONS) {
89+
+ DEFAULT_OPTIONS[key] = value;
90+
+ }
91+
+ });
92+
+};
93+
+export const setOptions = setDefaultOptions;
94+
+export { SnapshotService } from './snapshot.js';
95+
+export { SoftAssertService } from './softAssert.js';
96+
+export { SoftAssertionService } from './softAssertService.js';
97+
+export * as utils from './utils.js';

.yarnrc.yml

Lines changed: 67 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,82 @@
1-
dynamicPackageExtensions: ./scripts/dynamic.extensions.mjs
1+
catalog:
2+
'@types/jasmine': '5.1.13'
3+
'@wdio/appium-service': '^9.23.0'
4+
'@wdio/cli': '^9.23.0'
5+
'@wdio/globals': '^9.23.0'
6+
'@wdio/jasmine-framework': '^9.23.0'
7+
'@wdio/json-reporter': '^9.20.0'
8+
'@wdio/local-runner': '^9.23.0'
9+
'@wdio/logger': '^9.18.0'
10+
'@wdio/runner': '^9.23.0'
11+
'@wdio/spec-reporter': '^9.20.0'
12+
'appium': '^3.1.2'
13+
'appium-mac2-driver': '^3.2.13'
14+
'appium-uiautomator2-driver': '^6.7.8'
15+
'appium-windows-driver': '^5.1.5'
16+
'appium-xcuitest-driver': '^10.14.5'
17+
'expect-webdriverio': '^5.6.1'
18+
'rimraf': '^6.1.2'
19+
'webdriverio': '^9.23.0'
220

3-
enableGlobalCache: false
21+
dynamicPackageExtensions: ./scripts/dynamic.extensions.mjs
422

523
enableScripts: false
624

7-
nodeLinker: node-modules
25+
globalFolder: .yarn/store
26+
27+
nodeLinker: pnpm
828

929
packageExtensions:
10-
"@svgr/core@*":
30+
'appium@*':
31+
dependencies:
32+
'@colors/colors': '*'
33+
'appium-mac2-driver': '*'
34+
'appium-uiautomator2-driver': '*'
35+
'appium-windows-driver': '*'
36+
'appium-xcuitest-driver': '*'
37+
'appium-mac2-driver@*':
38+
dependencies:
39+
'appium': '*'
40+
'appium-uiautomator2-driver@*':
41+
dependencies:
42+
'appium': '*'
43+
'appium-windows-driver@*':
44+
dependencies:
45+
'appium': '*'
46+
'appium-xcuitest-driver@*':
47+
dependencies:
48+
'appium': '*'
49+
'iconv-lite@*':
50+
dependencies:
51+
'iconv-lite': '*'
52+
'@wdio/appium-service@*':
53+
dependencies:
54+
'appium': '*'
55+
'appium-webdriveragent@*':
56+
dependencies:
57+
appium-xcode: '*'
58+
'expect-webdriverio@*':
59+
dependencies:
60+
'@wdio/globals': '*'
61+
'@wdio/logger': '*'
62+
'webdriverio': '*'
63+
'@wdio/runner@*':
64+
dependencies:
65+
'expect-webdriverio': '*'
66+
'@wdio/jasmine-framework@*':
67+
dependencies:
68+
'expect-webdriverio': '*'
69+
'@svgr/core@*':
1170
dependencies:
12-
"@svgr/plugin-jsx": "*"
13-
"@svgr/plugin-svgo": "*"
71+
'@svgr/plugin-jsx': '*'
72+
'@svgr/plugin-svgo': '*'
1473
react-native-svg@*:
1574
dependencies:
16-
buffer: "*"
75+
buffer: '*'
1776

1877
plugins:
1978
- checksum: 672e525b81762c6162366bd3ffec5e86ab8fac2655ef0267047e86a0f32e79a4bde0f170bc30479663f40aa3f006d91f8dc3289f679dd4dc5ae5a5d12ba3ad0b
2079
path: .yarn/plugins/@rnx-kit/yarn-plugin-dynamic-extensions.cjs
21-
spec: "https://raw.githubusercontent.com/microsoft/rnx-kit/main/incubator/yarn-plugin-dynamic-extensions/index.js"
80+
spec: 'https://raw.githubusercontent.com/microsoft/rnx-kit/main/incubator/yarn-plugin-dynamic-extensions/index.js'
2281

2382
yarnPath: .yarn/releases/yarn-4.11.0.cjs

apps/E2E/package.json

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,29 @@
33
"version": "1.43.11",
44
"description": "Package containing E2E testing specs",
55
"license": "MIT",
6-
"main": "lib-commonjs/index.js",
7-
"module": "lib/index.js",
8-
"react-native": "src/index.ts",
6+
"main": "lib/index.js",
7+
"module": "lib/index.mjs",
98
"typings": "lib/index.d.ts",
109
"exports": {
1110
".": {
12-
"import": "./lib/index.js",
13-
"require": "./lib-commonjs/index.js",
14-
"types": "./lib/index.d.ts"
11+
"types": "./lib/index.d.ts",
12+
"import": "./lib/index.mjs",
13+
"require": "./lib/index.js"
1514
}
1615
},
1716
"scripts": {
18-
"build": "fluentui-scripts build",
17+
"build": "fluentui-scripts hybrid-build",
1918
"lint": "fluentui-scripts eslint",
20-
"e2etest:android": "wdio run wdio.conf.android.js",
21-
"e2etest:ios": "wdio run wdio.conf.ios.js",
22-
"e2etest:macos": "wdio run wdio.conf.macos.js",
23-
"e2etest:win32": "wdio run wdio.conf.win32.js",
24-
"e2etest:windows": "rimraf errorShots reports && wdio run wdio.conf.windows.js"
19+
"e2eprep:android": "cross-env APPIUM_HOME=.appium yarn exec appium driver install uiautomator2",
20+
"e2eprep:ios": "cross-env APPIUM_HOME=.appium yarn exec appium driver install xcuitest",
21+
"e2eprep:macos": "cross-env APPIUM_HOME=.appium yarn exec appium driver install mac2",
22+
"e2eprep:win32": "cross-env APPIUM_HOME=.appium yarn exec appium driver install windows",
23+
"e2eprep:windows": "cross-env APPIUM_HOME=.appium yarn exec appium driver install windows",
24+
"e2etest:android": "cross-env APPIUM_HOME=.appium wdio run wdio.conf.android.js",
25+
"e2etest:ios": "cross-env APPIUM_HOME=.appium wdio run wdio.conf.ios.js",
26+
"e2etest:macos": "cross-env APPIUM_HOME=.appium wdio run wdio.conf.macos.js",
27+
"e2etest:win32": "cross-env APPIUM_HOME=.appium wdio run wdio.conf.win32.js",
28+
"e2etest:windows": "rimraf errorShots reports && cross-env APPIUM_HOME=.appium wdio run wdio.conf.windows.js"
2529
},
2630
"repository": {
2731
"type": "git",
@@ -33,6 +37,8 @@
3337
"dist/*"
3438
],
3539
"dependencies": {
40+
"@office-iss/react-native-win32": "^0.74.0",
41+
"@office-iss/rex-win32": "0.73.11-devmain.16.0.17615.15030",
3642
"react": "18.2.0",
3743
"react-native": "^0.74.0",
3844
"react-native-macos": "^0.74.0",
@@ -48,26 +54,30 @@
4854
"@react-native/metro-babel-transformer": "^0.74.0",
4955
"@react-native/metro-config": "^0.74.0",
5056
"@rnx-kit/metro-config": "^2.0.0",
51-
"@types/jasmine": "5.1.4",
57+
"@types/jasmine": "catalog:",
5258
"@types/node": "^22.2.0",
5359
"@types/react": "^18.2.0",
54-
"@wdio/appium-service": "^9.12.6",
55-
"@wdio/cli": "^9.12.6",
56-
"@wdio/globals": "^9.12.6",
57-
"@wdio/jasmine-framework": "^9.12.6",
58-
"@wdio/json-reporter": "^9.12.6",
59-
"@wdio/local-runner": "^9.12.6",
60-
"@wdio/spec-reporter": "^9.12.6",
61-
"appium": "^2.11.2",
62-
"appium-mac2-driver": "^1.12.0",
63-
"appium-uiautomator2-driver": "^3.0.5",
64-
"appium-windows-driver": "^2.12.18",
65-
"appium-xcuitest-driver": "^7.9.1",
60+
"@wdio/appium-service": "catalog:",
61+
"@wdio/cli": "catalog:",
62+
"@wdio/globals": "catalog:",
63+
"@wdio/jasmine-framework": "catalog:",
64+
"@wdio/json-reporter": "catalog:",
65+
"@wdio/local-runner": "catalog:",
66+
"@wdio/logger": "catalog:",
67+
"@wdio/runner": "catalog:",
68+
"@wdio/spec-reporter": "catalog:",
69+
"appium": "catalog:",
70+
"appium-mac2-driver": "catalog:",
71+
"appium-uiautomator2-driver": "catalog:",
72+
"appium-windows-driver": "catalog:",
73+
"appium-xcuitest-driver": "catalog:",
74+
"cross-env": "^7.0.3",
75+
"expect-webdriverio": "catalog:",
6676
"metro-config": "^0.80.3",
6777
"rimraf": "^5.0.1",
6878
"ts-node": "^10.7.0",
69-
"typescript": "4.9.4",
70-
"webdriverio": "^9.12.6"
79+
"typescript": "^5.8.0",
80+
"webdriverio": "catalog:"
7181
},
7282
"installConfig": {
7383
"hoistingLimits": "dependencies"

apps/E2E/src/Callout/pages/CalloutPageObject.win.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,21 @@ class CalloutPageObject extends BasePage {
66
/**************** UI Element Interaction Methods ******************/
77
/******************************************************************/
88
async isCalloutOpen(): Promise<boolean> {
9-
return await (await this._primaryComponent).isDisplayed();
9+
return this._primaryComponent.isDisplayed();
1010
}
1111

1212
// This both opens and waits for it to go in view
1313
async openCalloutAndWaitForLoad(): Promise<void> {
1414
if (!(await this.isCalloutOpen())) {
15-
const calloutButton = await this._buttonToOpenCallout;
16-
await browser.waitUntil(async () => await calloutButton.isEnabled(),
17-
{
15+
await browser.waitUntil(async () => await this._buttonToOpenCallout.isEnabled(), {
1816
timeout: 15000,
19-
timeoutMsg: 'Button to open the Callout is not enabled.'
17+
timeoutMsg: 'Button to open the Callout is not enabled.',
2018
});
2119

22-
await calloutButton.click();
23-
await this.waitForCondition(
24-
async () => await this.isCalloutOpen(),
25-
'Clicked the button to open the Callout, but the Callout did not open correctly.',
26-
);
20+
await this._buttonToOpenCallout.click();
21+
await this._primaryComponent.waitForDisplayed({
22+
timeoutMsg: 'Clicked the button to open the Callout, but the Callout did not open correctly',
23+
});
2724
}
2825
}
2926

0 commit comments

Comments
 (0)