Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

devops: add android bot to tests_secondary (#40799)

Dmitry Gozmand2edf45eca26
diff --git a/.github/workflows/tests_secondary.yml b/.github/workflows/tests_secondary.yml
index e793291e12..1953ee2166 100644
--- a/.github/workflows/tests_secondary.yml
+++ b/.github/workflows/tests_secondary.yml
@@ -320,3 +320,34 @@ jobs:
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
env:
PWTEST_CHANNEL: chromium
+
+ test_android:
+ name: Android
+ environment: ${{ github.event_name == 'push' && 'allow-uploading-flakiness-results' || null }}
+ runs-on: playwright-x64-ubuntu24-64-core
+ steps:
+ - uses: actions/checkout@v6
+ - uses: actions/setup-java@v5
+ with:
+ distribution: 'temurin'
+ java-version: '21'
+ - name: Enable KVM group perms
+ run: |
+ echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
+ sudo udevadm control --reload-rules
+ sudo udevadm trigger --name-match=kvm
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 22
+ - name: Create Android Emulator
+ run: utils/avd_recreate.sh
+ - name: Start Android Emulator
+ run: utils/avd_start.sh
+ - uses: ./.github/actions/run-test
+ with:
+ browsers-to-install: android
+ command: npm run atest
+ bot-name: "android"
+ flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
+ flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
+ flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
diff --git a/tests/android/playwright.config.ts b/tests/android/playwright.config.ts
index db8e968b17..06e8085c5d 100644
--- a/tests/android/playwright.config.ts
+++ b/tests/android/playwright.config.ts
@@ -40,6 +40,7 @@ const config: Config<ServerWorkerOptions & PlaywrightWorkerOptions & PlaywrightT
reporter: process.env.CI ? [
['dot'],
['json', { outputFile: path.join(outputDir, 'report.json') }],
+ ['blob'],
] : 'line',
projects: [],
};
diff --git a/tests/page/page-evaluate.spec.ts b/tests/page/page-evaluate.spec.ts
index 4c8912cf31..4c6e7aaffa 100644
--- a/tests/page/page-evaluate.spec.ts
+++ b/tests/page/page-evaluate.spec.ts
@@ -161,13 +161,16 @@ it('should work with unicode chars', async ({ page }) => {
expect(result).toBe(42);
});
-it('should work with large strings', async ({ page }) => {
+it('should work with large strings', async ({ page, isAndroid }) => {
+ it.skip(isAndroid, 'string is too long :(');
+
const expected = 'x'.repeat(40000);
expect(await page.evaluate(data => data, expected)).toBe(expected);
});
-it('should work with large unicode strings', async ({ page, browserName, platform }) => {
+it('should work with large unicode strings', async ({ page, browserName, platform, isAndroid }) => {
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/16367' });
+ it.skip(isAndroid, 'string is too long :(');
const expected = '🎭'.repeat(10000);
expect(await page.evaluate(data => data, expected)).toBe(expected);
diff --git a/tests/page/page-route.spec.ts b/tests/page/page-route.spec.ts
index c2f1f41f0f..9f426e588c 100644
--- a/tests/page/page-route.spec.ts
+++ b/tests/page/page-route.spec.ts
@@ -1036,8 +1036,10 @@ for (const method of ['fulfill', 'continue', 'fallback', 'abort'] as const) {
});
}
-it('should intercept when postData is more than 1MB', async ({ page, server }) => {
+it('should intercept when postData is more than 1MB', async ({ page, server, isAndroid }) => {
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/22753' });
+ it.fixme(isAndroid);
+
await page.goto(server.EMPTY_PAGE);
let interceptionCallback;
const interceptionPromise = new Promise(x => interceptionCallback = x);
diff --git a/utils/avd_install.sh b/utils/avd_install.sh
index a0586d6936..a7264ebaf7 100755
--- a/utils/avd_install.sh
+++ b/utils/avd_install.sh
@@ -16,7 +16,7 @@ cd ${ANDROID_HOME}/cmdline-tools
COMMAND_LINE_TOOLS_ZIP=${ANDROID_HOME}/commandlinetools.zip
# https://developer.android.com/studio
curl https://dl.google.com/android/repository/commandlinetools-mac-11076708_latest.zip -o ${COMMAND_LINE_TOOLS_ZIP}
-unzip ${COMMAND_LINE_TOOLS_ZIP}
+unzip ${COMMAND_LINE_TOOLS_ZIP}
rm ${COMMAND_LINE_TOOLS_ZIP}
mv cmdline-tools latest
diff --git a/utils/avd_recreate.sh b/utils/avd_recreate.sh
index 81c3484907..1b1c050942 100755
--- a/utils/avd_recreate.sh
+++ b/utils/avd_recreate.sh
@@ -6,6 +6,13 @@ if [[ -z "${ANDROID_HOME}" ]]; then
export ANDROID_HOME="$PWD/.android-sdk"
fi
+# Pin AVD storage to ~/.android so cmdline-tools (avdmanager) and the
+# emulator binary agree on the location. On Linux runners that set
+# XDG_CONFIG_HOME (e.g. GitHub Actions), avdmanager otherwise writes to
+# $XDG_CONFIG_HOME/.android/avd while `emulator` only searches $HOME/.android/avd.
+export ANDROID_USER_HOME="$HOME/.android"
+export ANDROID_AVD_HOME="$HOME/.android/avd"
+
ANDROID_ARCH="x86_64"
# on MacOS M1 we need to use arm64 (can't emulate x86_64)
diff --git a/utils/avd_start.sh b/utils/avd_start.sh
index 77bf7e45ad..7fa111fcbb 100755
--- a/utils/avd_start.sh
+++ b/utils/avd_start.sh
@@ -6,6 +6,10 @@ if [[ -z "${ANDROID_HOME}" ]]; then
export ANDROID_HOME="$PWD/.android-sdk"
fi
+# Keep in sync with avd_recreate.sh — both tools must agree on the AVD path.
+export ANDROID_USER_HOME="$HOME/.android"
+export ANDROID_AVD_HOME="$HOME/.android/avd"
+
bash $PWD/utils/avd_stop.sh
EMULATOR_EXTRA_ARGS=()