chore: fix Android 13 compatibility (#16139)

This commit is contained in:
Max Schmitt 2022-08-02 18:22:27 +02:00 committed by GitHub
parent 649c070b48
commit 153670978d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 8 deletions

View file

@ -250,7 +250,7 @@ export class AndroidDevice extends SdkObject {
const commandLine = `_ --disable-fre --no-default-browser-check --no-first-run --remote-debugging-socket-name=${socketName}`;
debug('pw:android')('Starting', pkg, commandLine);
await this._backend.runCommand(`shell:echo "${commandLine}" > /data/local/tmp/chrome-command-line`);
await this._backend.runCommand(`shell:am start -n ${pkg}/com.google.android.apps.chrome.Main about:blank`);
await this._backend.runCommand(`shell:am start -a android.intent.action.VIEW -d about:blank ${pkg}`);
return await this._connectToBrowser(socketName, options);
}

View file

@ -67,7 +67,7 @@ test('androidDevice.options.omitDriverInstall', async function({ playwright }) {
await androidDevice.shell(`cmd package uninstall com.microsoft.playwright.androiddriver`);
await androidDevice.shell(`cmd package uninstall com.microsoft.playwright.androiddriver.test`);
await androidDevice.shell('am start -n com.android.chrome/com.google.android.apps.chrome.Main about:blank');
await androidDevice.shell('am start -a android.intent.action.VIEW -d about:blank com.android.chrome');
let fillStatus = '';
androidDevice.fill({ res: 'com.android.chrome:id/url_bar' }, 'Hello').then(() => {

View file

@ -24,7 +24,7 @@ echo Installing emulator...
yes | ${ANDROID_HOME}/tools/bin/sdkmanager --install platform-tools emulator
echo Installing platform SDK...
yes | ${ANDROID_HOME}/tools/bin/sdkmanager --install "platforms;android-32"
yes | ${ANDROID_HOME}/tools/bin/sdkmanager --install "platforms;android-33"
echo Starting ADB...
${ANDROID_HOME}/platform-tools/adb devices

View file

@ -8,7 +8,7 @@ if [[ -z "${ANDROID_HOME}" ]]; then
export ANDROID_SDK_ROOT=${SDKDIR}
fi
${ANDROID_HOME}/tools/bin/avdmanager delete avd --name android32 || true
echo "y" | ${ANDROID_HOME}/tools/bin/sdkmanager --install "system-images;android-32;google_apis;x86_64"
echo "no" | ${ANDROID_HOME}/tools/bin/avdmanager create avd --force --name android32 --device "Nexus 5X" --package "system-images;android-32;google_apis;x86_64"
${ANDROID_HOME}/tools/bin/avdmanager delete avd --name android33 || true
echo "y" | ${ANDROID_HOME}/tools/bin/sdkmanager --install "system-images;android-33;google_apis;x86_64"
echo "no" | ${ANDROID_HOME}/tools/bin/avdmanager create avd --force --name android33 --device "Nexus 5X" --package "system-images;android-33;google_apis;x86_64"
${ANDROID_HOME}/emulator/emulator -list-avds

View file

@ -16,7 +16,17 @@ if [[ -n "${GITHUB_ACTIONS}" ]]; then
fi
echo "Starting emulator"
nohup ${ANDROID_HOME}/emulator/emulator -avd android32 -no-audio -no-window -gpu ${EMULATOR_GPU} -no-boot-anim &
nohup ${ANDROID_HOME}/emulator/emulator -avd android33 -no-audio -no-window -gpu ${EMULATOR_GPU} -no-boot-anim &
${ANDROID_HOME}/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done; input keyevent 82'
${ANDROID_HOME}/platform-tools/adb devices
echo "Emulator started"
echo "Emulator started"
echo "Installing Chromium WebView"
CHROMIUM_ANDROID_REVISION="1030456"
WEBVIEW_TMP_DIR="$(mktemp -d)"
WEBVIEW_TMP_FILE="$WEBVIEW_TMP_DIR/chrome-android-zip"
curl -s -o "${WEBVIEW_TMP_FILE}" "https://storage.googleapis.com/chromium-browser-snapshots/Android/${CHROMIUM_ANDROID_REVISION}/chrome-android.zip"
unzip -q "${WEBVIEW_TMP_FILE}" -d "${WEBVIEW_TMP_DIR}"
${ANDROID_HOME}/platform-tools/adb install -r "${WEBVIEW_TMP_DIR}/chrome-android/apks/SystemWebViewShell.apk"
rm -rf "${WEBVIEW_TMP_DIR}"
echo "Chromium WebView installed"