Skip to content

Commit 24164db

Browse files
authored
ci: Check local setup before running functional tests (#845)
1 parent 1e14f5c commit 24164db

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

scripts/run-functional-tests.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,35 @@
11
#!/bin/bash
22

3+
# If a developer has an incorrect local setup, we want to tell them clearly, instead of them needing to read cryptic test failures.
4+
checkTestPrerequisites() {
5+
# Check if Appium server is running on default port (4567)
6+
APPIUM_PORT=${APPIUM_TEST_SERVER_PORT:-4567}
7+
APPIUM_HOST=${APPIUM_TEST_SERVER_HOST:-127.0.0.1}
8+
if ! curl -s "http://${APPIUM_HOST}:${APPIUM_PORT}/status" > /dev/null; then
9+
echo "Error: Appium server is not running on ${APPIUM_HOST}:${APPIUM_PORT}"
10+
echo "Please start the Appium server first with: appium server -p ${APPIUM_PORT}, or set APPIUM_TEST_SERVER_HOST and APPIUM_TEST_SERVER_PORT environment variables"
11+
exit 1
12+
fi
13+
14+
# Check if any Android device is connected
15+
if ! adb devices | grep -q "device$"; then
16+
echo "Error: No Android device connected"
17+
echo "Please connect an Android device or start an emulator"
18+
echo "Current devices list:"
19+
adb devices
20+
exit 1
21+
fi
22+
23+
# Check if android-apidemos is installed
24+
if [ ! -f "node_modules/android-apidemos/apks/ApiDemos-debug.apk" ]; then
25+
echo "Error: android-apidemos package not found"
26+
echo "Installing android-apidemos package..."
27+
npm install android-apidemos --save-dev
28+
fi
29+
}
30+
31+
checkTestPrerequisites
32+
333
RESULTS_XML=test-results.xml
434
echo "{\"reporterEnabled\": \"spec, xunit\", \"xunitReporterOptions\": {\"output\": \"$RESULTS_XML\"}}" > reporter_config.json
535
ARGS=(./test/functional/driver-e2e-specs.js \

0 commit comments

Comments
 (0)