Skip to content

Commit 7749258

Browse files
author
Krzysztof Borowy
committed
ios
1 parent 0eaa85c commit 7749258

File tree

8 files changed

+296
-40
lines changed

8 files changed

+296
-40
lines changed

example/__tests__/commands.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { e2e } from '../jest.setup';
22

3-
const testAppId = 'com.microsoft.reacttestapp';
3+
const testAppId = 'com.microsoft.ReactTestApp';
44

55
export const commands = {
66
restartApp: async () => {
77
await e2e.terminateApp(testAppId);
88
await e2e.activateApp(testAppId);
99
},
1010
elementByLabel: async (id: string) => await e2e.$(`~${id}`),
11-
elementByLabelBy: async (id: string) => await e2e.$(`aria/${id}`),
1211
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest
3+
package="com.microsoft.ReactTestApp"
4+
/>

example/android/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ allprojects {
7777
matchingFallbacks = ["debug", "release"]
7878
}
7979
}
80-
androidExtension.testBuildType = 'release'
81-
androidExtension.sourceSets.androidTest.java.srcDirs += "$rootDir/app/src/androidTest/java"
8280

8381
project.dependencies {
8482
def hermesDir = file('../../node_modules/hermes-engine/android').absolutePath

example/examples/Functional.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ function Functional(): JSX.Element {
162162
return (
163163
<View key={name} style={styles.failed}>
164164
<Text style={styles.testLabel}>{name}</Text>
165-
<View accessibilityLabelledBy="Fail" accessibilityLabel={testID}>
165+
<View>
166166
<Text style={styles.testResult}>{`Step: ${
167167
result.step + 1
168168
}`}</Text>

example/jest.setup.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@ const Capabilities = {
1111
'appium:automationName': 'UiAutomator2',
1212
'appium:newCommandTimeout': 240,
1313
},
14-
ios: {},
14+
ios: {
15+
platformName: 'iOS',
16+
'appium:platformVersion': '16.4',
17+
'appium:deviceName': 'iPhone 14',
18+
'appium:automationName': 'XCUITest',
19+
'appium:app':
20+
'example/ios/build/Build/Products/Release-iphonesimulator/ReactTestApp.app',
21+
},
1522
};
1623

1724
let client: WebdriverIO.Browser;

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
"@types/react": "^18.0.0",
7878
"appium": "2.0.0-rc.3",
7979
"appium-uiautomator2-driver": "^2.26.2",
80+
"appium-xcuitest-driver": "^4.32.5",
8081
"concurrently": "^6.4.0",
8182
"eslint": "^8.0.0",
8283
"expo": "^48.0.0",

scripts/ios_e2e.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,27 @@ bundle_js() {
5555
react-native bundle --entry-file index.ts --platform ios --bundle-output example/index.ios.jsbundle $extraArgs
5656
}
5757

58+
assert_appium_server_running() {
59+
RES=$(curl -Is "http://0.0.0.0:4723/status" | grep HTTP | cut -d ' ' -f2)
60+
61+
if [ "$RES" != "200" ]; then
62+
echo "[iOS E2E] Appium server not running! Try starting it:"
63+
echo
64+
echo "yarn appium --config example/appium.config.js"
65+
echo
66+
exit 2
67+
fi;
68+
}
69+
70+
run_e2e_test() {
71+
export NODE_OPTIONS=--experimental-vm-modules
72+
export E2E_PLATFORM=ios
73+
assert_appium_server_running
74+
75+
echo "[iOS E2E] Running tests"
76+
jest --config example/jest.config.ts --roots=$PWD
77+
}
78+
5879

5980
case $1 in
6081
build)
@@ -66,6 +87,9 @@ case $1 in
6687
bundle)
6788
shift; bundle_js $@
6889
;;
90+
test)
91+
run_e2e_test
92+
;;
6993
*)
7094
echo -n "Unknown argument: $1"
7195
;;

0 commit comments

Comments
 (0)