Skip to content

Commit 6164473

Browse files
Update to RN 0.73 (#3543)
* Update to RN 0.73 * Change files * RN 73 requires node 18 * Add 72 profile * Update wdio/appium etc to get it running on node 18 * fix * fix * Update podfile locks * fix * fix * fix * see if building fixes resolution of focus-zone by e2e tests * Try specifying reports dir with full path * Try debug level reporting to identify error creating logs * try enabling more logs * alternate way to specify logfile. * downgrade @wdio/appium-service to move before webdriverio/webdriverio#12095 * Test no-packager * yarn init-test-app (With cleanup) * Try install Java18 * fix * fix * Android E2E fixes * fix? * fix * fix * Add more logging for E2E android test failure * more logs * more log * Use actual scroll region, to avoid OS swipe gestures * Increase android time out to navigate to page * fix * remove extra try/catch and logging * Fix windows build * test windows PR without node install --------- Co-authored-by: Saad Najmi <[email protected]>
1 parent 4c79e3e commit 6164473

File tree

200 files changed

+7542
-4480
lines changed

Some content is hidden

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

200 files changed

+7542
-4480
lines changed

.ado/azure-pipelines.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ jobs:
162162

163163
- bash: |
164164
echo "yarn $(platform)"
165-
yarn $(platform) --simulator "$(ios_simulator)"
165+
yarn $(platform) --simulator "$(ios_simulator)" --no-packager
166166
workingDirectory: apps/fluent-tester
167167
displayName: 'yarn $(platform)'
168168
@@ -175,7 +175,7 @@ jobs:
175175
pool:
176176
name: rnw-pool-4
177177
demands:
178-
- ImageOverride -equals rnw-img-vs2022
178+
- ImageOverride -equals rnw-img-vs2022-node18
179179
timeoutInMinutes: 60 # how long to run the job before automatically cancelling
180180
cancelTimeoutInMinutes: 5 # how much time to give 'run always even if cancelled tasks' before killing them
181181

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ steps:
77
tasks: 'assembleDebug'
88
gradleOptions: '-Xmx2g'
99
javaHomeOption: 'JDKVersion'
10-
jdkVersionOption: '1.11'
10+
jdkVersionOption: '1.17'
1111
workingDirectory: apps/fluent-tester/android
1212

1313
- script: |

.ado/templates/setup-repo-min-build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ steps:
44
- script: |
55
yarn build-tools
66
displayName: "yarn build-tools"
7+
8+
- script: |
9+
yarn build
10+
displayName: "yarn build"

.ado/templates/setup-repo.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# This template install dependencies, builds, and bundles this repo
22
steps:
3-
- task: NodeTool@0
4-
inputs:
5-
versionSource: 'fromFile'
6-
versionFilePath: '.node-version'
3+
# - task: NodeTool@0
4+
# inputs:
5+
# versionSource: 'fromFile'
6+
# versionFilePath: '.node-version'
77

88
- task: NuGetToolInstaller@0
99
inputs:

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16
1+
18

apps/E2E/global.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type {BrowserCommands} from 'webdriverio'
2+
3+
declare global {
4+
const browser: BrowserCommands;
5+
const driver: BrowserCommands.Driver;
6+
const $: BrowserCommands.$;
7+
}

apps/E2E/package.json

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,36 +23,37 @@
2323
],
2424
"dependencies": {
2525
"react": "18.2.0",
26-
"react-native": "^0.72.0",
27-
"react-native-macos": "^0.72.0",
28-
"react-native-windows": "^0.72.0"
26+
"react-native": "^0.73.0",
27+
"react-native-macos": "^0.73.0",
28+
"react-native-windows": "^0.73.0"
2929
},
3030
"devDependencies": {
3131
"@babel/core": "^7.8.0",
3232
"@babel/runtime": "^7.8.0",
3333
"@fluentui-react-native/eslint-config-rules": "workspace:*",
3434
"@fluentui-react-native/focus-zone": "workspace:*",
3535
"@fluentui-react-native/scripts": "workspace:*",
36-
"@react-native/metro-config": "^0.72.0",
36+
"@react-native/babel-preset": "^0.73.0",
37+
"@react-native/metro-babel-transformer": "^0.73.0",
38+
"@react-native/metro-config": "^0.73.0",
3739
"@rnx-kit/metro-config": "^1.3.1",
38-
"@types/jasmine": "3.10.3",
40+
"@types/jasmine": "5.1.4",
3941
"@types/react": "^18.2.0",
40-
"@wdio/appium-service": "7.30.0",
41-
"@wdio/cli": "7.30.1",
42-
"@wdio/jasmine-framework": "7.26.0",
43-
"@wdio/local-runner": "7.30.1",
44-
"@wdio/spec-reporter": "7.29.1",
45-
"appium": "^2.0.0",
46-
"appium-mac2-driver": "^1.8.2",
47-
"appium-uiautomator2-driver": "^2.29.0",
48-
"appium-windows-driver": "^2.12.0",
49-
"appium-xcuitest-driver": "^5.6.0",
50-
"metro-config": "^0.76.5",
51-
"metro-react-native-babel-preset": "^0.76.5",
42+
"@wdio/appium-service": "8.29.1",
43+
"@wdio/cli": "8.35.1",
44+
"@wdio/jasmine-framework": "8.35.1",
45+
"@wdio/local-runner": "8.35.1",
46+
"@wdio/spec-reporter": "8.32.4",
47+
"appium": "^2.5.1",
48+
"appium-mac2-driver": "^1.12.0",
49+
"appium-uiautomator2-driver": "^3.0.5",
50+
"appium-windows-driver": "^2.12.18",
51+
"appium-xcuitest-driver": "^7.9.1",
52+
"metro-config": "^0.80.0",
5253
"rimraf": "^5.0.1",
53-
"ts-node": "^8.10.1",
54+
"ts-node": "^10.7.0",
5455
"typescript": "4.9.4",
55-
"webdriverio": "7.30.1"
56+
"webdriverio": "8.35.1"
5657
},
5758
"installConfig": {
5859
"hoistingLimits": "dependencies"
@@ -64,10 +65,12 @@
6465
"microsoft/react-native"
6566
],
6667
"requirements": [
67-
"react-native@0.72"
68+
"react-native@0.73"
6869
],
6970
"capabilities": [
7071
"core",
72+
"core-macos",
73+
"core-windows",
7174
"react",
7275
"metro-config",
7376
"babel-preset-react-native"

apps/E2E/src/common/BasePage.ts

Lines changed: 63 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,13 @@ export abstract class BasePage {
9393
* Some components' E2E tests check only if the test page loads correctly or not. Others
9494
* (majority), perform UI manipulation tests on UI components on the test page. In these scenarios, these UI components have their
9595
* own section on the test page (by default, it's hidden so partners don't see it). This method opens up that testing section.
96-
*/
96+
*/
9797
async enableE2ETesterMode(): Promise<boolean | void> {
9898
const e2eSwitch = await this._e2eSwitch;
99-
await browser.waitUntil(async () => await e2eSwitch.isDisplayed() && await e2eSwitch.isEnabled(),
100-
{
99+
await browser.waitUntil(async () => (await e2eSwitch.isDisplayed()) && (await e2eSwitch.isEnabled()), {
101100
timeout: 15000,
102-
timeoutMsg: 'The E2E Switch should be enabled and visible before we interact with it'
103-
})
101+
timeoutMsg: 'The E2E Switch should be enabled and visible before we interact with it',
102+
});
104103

105104
switch (this.platform) {
106105
// Usually, we use .isSelected() to see if a control (our switch) is checked true or false, but the process is
@@ -139,7 +138,7 @@ export abstract class BasePage {
139138
const el = await element;
140139

141140
try {
142-
await browser.waitUntil(async () => expectedValue === await el.getAttribute(attribute));
141+
await browser.waitUntil(async () => expectedValue === (await el.getAttribute(attribute)));
143142
} catch {
144143
const actualValue = await el.getAttribute(attribute);
145144
switch (this.platform) {
@@ -181,7 +180,7 @@ export abstract class BasePage {
181180
* - Escape out of a menu: MenuPageObject.sendKeys(MenuPageObject.item1, [KEY_ESCAPE])
182181
*/
183182
async sendKeys(element: Promise<WebdriverIO.Element>, keys: Keys[]): Promise<void> {
184-
await (await element).addValue(keys);
183+
await (await element).addValue(keys.join());
185184
}
186185

187186
/** Short-hand method for PageObjects to get an element attribute during testing, with attribute being type-enforced. */
@@ -192,7 +191,7 @@ export abstract class BasePage {
192191
/* Scrolls until the desired test page's button is displayed. We use the scroll viewer UI element as the point to start scrolling.
193192
* We use a negative number as the Y-coordinate because that enables us to scroll downwards */
194193
async mobileScrollToComponentButton(): Promise<void> {
195-
if (await (await this._pageButton).isDisplayed()) {
194+
if (this.platform !== 'android' && (await (await this._pageButton).isDisplayed())) {
196195
return;
197196
}
198197

@@ -213,8 +212,52 @@ export abstract class BasePage {
213212
);
214213
break;
215214
}
215+
// UiScrollable seems to continuously scroll the wrong direction on android in the current appium / appium-uiautomator2-driver version
216+
// So Instead we use this rather overly complex method of scrolling the items into view. On future appium updates we should see if
217+
// we can return to using the simpler and probably more reliable UiScrollable method below.
218+
case 'android': {
219+
await browser.waitUntil(
220+
async () => {
221+
let needsScroll = true;
222+
let scrollLoc = { x: 8, y: 170 };
223+
let scrollSize = { width: 1264, height: 574 };
224+
const scroller = await By(TESTPAGE_BUTTONS_SCROLLVIEWER);
225+
scrollLoc = await scroller.getLocation();
226+
scrollSize = await scroller.getSize();
227+
228+
const pageButton = await this._pageButton;
229+
const isPageButtonDisplayed = await pageButton.isDisplayed();
230+
if (isPageButtonDisplayed) {
231+
// Verify that the button is fully on screen
232+
const buttonLoc = await pageButton.getLocation();
233+
const buttonSize = await pageButton.getSize();
234+
needsScroll = scrollLoc.y + scrollSize.height <= buttonLoc.y + buttonSize.height;
235+
}
236+
237+
if (needsScroll) {
238+
await driver.execute('mobile: scrollGesture', {
239+
direction: 'down',
240+
left: scrollLoc.x + scrollSize.width * 0.2,
241+
width: scrollSize.width - scrollSize.width * 0.4,
242+
top: scrollLoc.y + scrollSize.height * 0.2,
243+
height: scrollSize.height - scrollSize.height * 0.4,
244+
percent: 0.6,
245+
speed: 1000,
246+
});
247+
248+
return false;
249+
}
250+
251+
return true;
252+
},
253+
{
254+
timeout: this.waitForUiEvent,
255+
timeoutMsg: errorMsg,
256+
},
257+
);
258+
break;
259+
}
216260
default:
217-
case 'android':
218261
/* 'mobile: scroll' which is used for iOS, does not support direction option on Android.
219262
* Instead, we use the UiScrollable class to scroll down to the desired view based on its 'description' (accessibilityLabel).
220263
* The first selector tells which container to scroll in, and the other selector tells which component to scroll to. */
@@ -235,7 +278,11 @@ export abstract class BasePage {
235278

236279
/** Waits for the tester app to load by checking if the startup page loads. If the app doesn't load before the timeout, it causes the test to fail. */
237280
async waitForInitialPageToDisplay(): Promise<boolean | void> {
238-
return await this.waitForCondition(async () => await (await this._initialPage).isDisplayed(), this.ERRORMESSAGE_APPLOAD, BOOT_APP_TIMEOUT);
281+
return await this.waitForCondition(
282+
async () => await (await this._initialPage).isDisplayed(),
283+
this.ERRORMESSAGE_APPLOAD,
284+
BOOT_APP_TIMEOUT,
285+
);
239286
}
240287

241288
/* Scrolls to the specified or primary UI test element until it is displayed. */
@@ -311,7 +358,12 @@ export abstract class BasePage {
311358

312359
/* A method that allows the caller to pass in a condition. A wrapper for waitUntil(). Once testing becomes more extensive,
313360
* this will allow cleaner code within all the Page Objects. */
314-
async waitForCondition(condition: () => Promise<boolean>, errorMsg?: string, timeout?: number, interval?: number): Promise<boolean | void> {
361+
async waitForCondition(
362+
condition: () => Promise<boolean>,
363+
errorMsg?: string,
364+
timeout?: number,
365+
interval?: number,
366+
): Promise<boolean | void> {
315367
return await browser.waitUntil(async () => await condition(), {
316368
timeout: timeout ?? this.waitForUiEvent,
317369
timeoutMsg: errorMsg ?? 'Error. Please see /errorShots and logs for more information.',

apps/E2E/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"*": ["*", "*.win32", "./*"],
99
"src/*": ["./src/*", "src"]
1010
},
11-
"types": ["webdriverio/async", "@wdio/jasmine-framework", "node", "@types/jasmine"]
11+
"types": ["./global", "webdriverio", "@wdio/jasmine-framework", "node", "@types/jasmine"]
1212
},
1313
"include": ["src"]
1414
}

apps/E2E/wdio.conf.android.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ exports.config = {
1717
'appium:appPackage': 'com.microsoft.reacttestapp',
1818
'appium:appActivity': 'MainActivity',
1919
'appium:automationName': 'uiautomator2',
20+
// These two capabilities disable the normal onscreen keyboard.
21+
// The onscreen keyboard has a very complex representation that makes the appium code respond very slow.
22+
'appium:resetKeyboard': true,
23+
'appium:unicodeKeyboard': true,
2024
},
2125
],
2226

apps/fluent-tester/android/build.gradle

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
buildscript {
2-
def androidTestAppDir = "../../../node_modules/react-native-test-app/android"
3-
apply(from: "${androidTestAppDir}/dependencies.gradle")
4-
apply(from: "${androidTestAppDir}/test-app-util.gradle")
2+
apply(from: {
3+
def searchDir = rootDir.toPath()
4+
do {
5+
def p = searchDir.resolve("node_modules/react-native-test-app/android/dependencies.gradle")
6+
if (p.toFile().exists()) {
7+
return p.toRealPath().toString()
8+
}
9+
} while (searchDir = searchDir.getParent())
10+
throw new GradleException("Could not find `react-native-test-app`");
11+
}())
512

613
repositories {
714
mavenCentral()
@@ -10,7 +17,7 @@ buildscript {
1017

1118
dependencies {
1219
getReactNativeDependencies().each { dependency ->
13-
classpath(dependency)
20+
classpath(dependency)
1421
}
1522
}
1623
}
@@ -19,7 +26,16 @@ allprojects {
1926
repositories {
2027
maven {
2128
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
22-
url("${rootDir}/../../../node_modules/react-native/android")
29+
url({
30+
def searchDir = rootDir.toPath()
31+
do {
32+
def p = searchDir.resolve("node_modules/react-native/android")
33+
if (p.toFile().exists()) {
34+
return p.toRealPath().toString()
35+
}
36+
} while (searchDir = searchDir.getParent())
37+
throw new GradleException("Could not find `react-native`");
38+
}())
2339
}
2440
mavenCentral()
2541
google()

apps/fluent-tester/android/gradle.properties

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,28 @@ org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryEr
2626
android.useAndroidX=true
2727
# Automatically convert third-party libraries to use AndroidX
2828
android.enableJetifier=true
29-
30-
# Version of Flipper to use with React Native. Default value is whatever React
31-
# Native defaults to. To disable Flipper, set it to `false`.
32-
#FLIPPER_VERSION=0.125.0
33-
34-
# Enable Fabric at runtime.
35-
#USE_FABRIC=1
36-
37-
# Uncomment the line below if building react-native from source
38-
#ANDROID_NDK_VERSION=21.4.7075529
29+
# Jetifier randomly fails on these libraries
30+
android.jetifier.ignorelist=hermes-android
31+
32+
# Use this property to specify which architecture you want to build.
33+
# You can also override it from the CLI using
34+
# ./gradlew <task> -PreactNativeArchitectures=x86_64
35+
reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
36+
37+
# Use this property to enable support to the new architecture.
38+
# This will allow you to use TurboModules and the Fabric render in
39+
# your application. You should enable this flag either if you want
40+
# to write custom TurboModules/Fabric components OR use libraries that
41+
# are providing them.
42+
# Note that this is incompatible with web debugging.
43+
#newArchEnabled=true
44+
#bridgelessEnabled=true
45+
46+
# Uncomment the line below to build React Native from source.
47+
#react.buildFromSource=true
48+
49+
# Version of Android NDK to build against.
50+
#ANDROID_NDK_VERSION=26.1.10909125
51+
52+
# Version of Kotlin to build against.
53+
#KOTLIN_VERSION=1.8.22
Binary file not shown.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)