[Testing] Add E2E test on Explorer #228
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
pull_request: | |
branches: | |
- develop | |
defaults: | |
run: | |
working-directory: lynx | |
jobs: | |
android-e2e-test: | |
env: | |
APPIUM_TEST_SERVER_PORT: 4723 | |
APPIUM_TEST_SERVER_HOST: 127.0.0.1 | |
runs-on: lynx-ubuntu-22.04-physical-medium | |
steps: | |
- name: Download Source | |
uses: actions/checkout@v4.2.2 | |
with: | |
path: lynx | |
- name: Python Setup | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.13' | |
- name: Install Common Dependencies | |
uses: ./lynx/.github/actions/common-deps | |
- name: Install Appium | |
run: | | |
pushd $GITHUB_WORKSPACE/lynx | |
source tools/envsetup.sh | |
pnpm install appium@2.11.2 -w | |
pnpm install appium-espresso-driver@4.0.0 -w | |
popd | |
- name: Install libpulse0 | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libpulse0 | |
sudo apt-get install -y libxkbfile1 | |
- name: Start Android 28 emulator | |
run: | | |
set -x | |
export QT_QPA_PLATFORM=offscreen | |
nohup $ANDROID_HOME/emulator/emulator -no-window -avd Nexus_5_API_28 -no-snapshot -no-audio -no-boot-anim & | |
max_wait_time=300 | |
start_time=$(date +%s) | |
while true; do | |
current_time=$(date +%s) | |
elapsed_time=$((current_time - start_time)) | |
if [ $elapsed_time -gt $max_wait_time ]; then | |
echo "Emulator startup timed out." | |
exit 1 | |
fi | |
$ANDROID_HOME/platform-tools/adb devices | |
if $ANDROID_HOME/platform-tools/adb devices | grep -q "device$"; then | |
echo "Emulator startup completed." | |
break | |
fi | |
echo "Waiting for emulator to startup..." | |
sleep 10 | |
done | |
$ANDROID_HOME/platform-tools/adb devices | |
- name: Repack and Install Explorer App | |
run: | | |
pushd $GITHUB_WORKSPACE/lynx | |
LATEST_VERSION=$(ls -1 "$ANDROID_HOME/build-tools" | sort -V | tail -n 1) | |
target_dir=$(find ./node_modules/.pnpm -type d -name "appium-adb@*" | head -n 1) | |
ESPRESSO_SIGN_KEYS_DIR="" | |
if [ -n "$target_dir" ]; then | |
ESPRESSO_SIGN_KEYS_DIR="$target_dir/node_modules/appium-adb/keys" | |
else | |
echo "node_modules/.pnpm/appium-adb is not founded!" | |
exit 1 | |
fi | |
APK_PATH=${{ github.workspace }}/lynx/explorer/android/lynx_explorer/build_temp | |
java -jar $ANDROID_HOME/build-tools/$LATEST_VERSION/lib/apksigner.jar sign --key $ESPRESSO_SIGN_KEYS_DIR/testkey.pk8 --cert $ESPRESSO_SIGN_KEYS_DIR/testkey.x509.pem --out $APK_PATH/LynxExplorer-noasan-release-signed.apk $APK_PATH/LynxExplorer-noasan-release.apk | |
adb install $APK_PATH/LynxExplorer-noasan-release-signed.apk | |
- name: Start Appium server | |
run: | | |
pushd $GITHUB_WORKSPACE/lynx | |
source tools/envsetup.sh | |
pushd node_modules/appium/node_modules/.bin | |
ls | |
nohup appium server \ | |
--port=$APPIUM_TEST_SERVER_PORT \ | |
--address=$APPIUM_TEST_SERVER_HOST \ | |
--log-no-colors \ | |
--log-timestamp | |
popd | |
popd | |
- name: Run Android E2E Test | |
run: | | |
pushd $GITHUB_WORKSPACE/lynx/testing/integration_test/test_script | |
export server_port=$APPIUM_TEST_SERVER_PORT | |
export platform=android | |
pip3 install -r requirements.txt | |
python3 manage.py runtest android_test.core |