File tree Expand file tree Collapse file tree 5 files changed +63
-20
lines changed Expand file tree Collapse file tree 5 files changed +63
-20
lines changed Original file line number Diff line number Diff line change @@ -231,3 +231,29 @@ jobs:
231
231
with :
232
232
name : video-${{ matrix.browser }}-linux-test-results
233
233
path : test-results
234
+ test_android :
235
+ name : Android on macOS
236
+ runs-on : macos-10.15
237
+ steps :
238
+ - uses : actions/checkout@v2
239
+ - uses : actions/setup-node@v1
240
+ with :
241
+ node-version : 14
242
+ - uses : microsoft/playwright-github-action@v1
243
+ - run : npm ci
244
+ - run : npm run build
245
+ - name : Create Android Emulator
246
+ run : utils/avd_recreate.sh
247
+ - name : Start Android Emulator
248
+ run : utils/avd_start.sh
249
+ - run : npx folio test/android -p browserName=chromium --workers=1 --forbid-only --global-timeout=5400000 --retries=3 --reporter=dot,json
250
+ env :
251
+ FOLIO_JSON_OUTPUT_NAME : " test-results/report.json"
252
+ PW_ANDROID_TESTS : 1
253
+ - run : ./utils/upload_flakiness_dashboard.sh ./test-results/report.json
254
+ if : always() && github.ref == 'refs/heads/master'
255
+ - uses : actions/upload-artifact@v1
256
+ if : ${{ always() }}
257
+ with :
258
+ name : android-test-results
259
+ path : test-results
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ const { it, expect } = folio;
20
20
if ( process . env . PW_ANDROID_TESTS ) {
21
21
it ( 'should run ADB shell commands' , async function ( { device } ) {
22
22
const output = await device . shell ( 'echo 123' ) ;
23
- expect ( output ) . toBe ( '123\n' ) ;
23
+ expect ( output . toString ( ) ) . toBe ( '123\n' ) ;
24
24
} ) ;
25
25
26
26
it ( 'should open a ADB socket' , async function ( { device } ) {
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
+ set -e
4
+
3
5
SDKDIR=$PWD /.android-sdk
4
6
export ANDROID_SDK_ROOT=${SDKDIR}
5
7
export ANDROID_HOME=${SDKDIR}
@@ -10,18 +12,18 @@ mkdir ${SDKDIR}/cmdline-tools
10
12
11
13
echo Downloading Android SDK...
12
14
cd ${SDKDIR} /cmdline-tools
13
- curl https://dl.google.com/android/repository/commandlinetools-mac-6858069_latest.zip -o commandlinetools-mac-6858069_latest.zip
14
- unzip commandlinetools-mac-6858069_latest.zip
15
+ COMMAND_LINE_TOOLS_ZIP=${SDKDIR} /commandlinetools.zip
16
+ curl https://dl.google.com/android/repository/commandlinetools-mac-6858069_latest.zip -o ${COMMAND_LINE_TOOLS_ZIP}
17
+ unzip ${COMMAND_LINE_TOOLS_ZIP}
18
+ rm ${COMMAND_LINE_TOOLS_ZIP}
15
19
mv cmdline-tools latest
20
+ ln -s ${SDKDIR} /cmdline-tools/latest ${SDKDIR} /tools
16
21
17
22
echo Installing emulator...
18
- yes | ${SDKDIR} /cmdline-tools/latest/bin/sdkmanager platform-tools emulator
19
-
20
- echo Installing system image...
21
- ${SDKDIR} /cmdline-tools/latest/bin/sdkmanager " system-images;android-30;google_apis;x86"
23
+ yes | ${ANDROID_HOME} /tools/bin/sdkmanager --install platform-tools emulator
22
24
23
25
echo Installing platform SDK...
24
- ${SDKDIR} /cmdline- tools/latest/ bin/sdkmanager " platforms;android-30"
26
+ yes | ${ANDROID_HOME} / tools/bin/sdkmanager --install " platforms;android-30"
25
27
26
28
echo Starting ADB...
27
- ${SDKDIR } /platform-tools/adb devices
29
+ ${ANDROID_HOME } /platform-tools/adb devices
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
- SDKDIR=$PWD /.android-sdk
4
- export ANDROID_SDK_ROOT=${SDKDIR}
5
- export ANDROID_HOME=${SDKDIR}
6
- export ANDROID_AVD_HOME=${SDKDIR} /avd
3
+ set -e
7
4
8
- ${SDKDIR} /cmdline-tools/latest/bin/avdmanager delete avd --name android30
9
- echo -ne ' \n' | ${SDKDIR} /cmdline-tools/latest/bin/avdmanager create avd --name android30 --device pixel_4_xl --package " system-images;android-30;google_apis;x86"
5
+ if [[ -z " ${ANDROID_HOME} " ]]; then
6
+ export SDKDIR=$PWD /.android-sdk
7
+ export ANDROID_HOME=${SDKDIR}
8
+ export ANDROID_SDK_ROOT=${SDKDIR}
9
+ fi
10
+
11
+ ${ANDROID_HOME} /tools/bin/avdmanager delete avd --name android30
12
+ echo " y" | ${ANDROID_HOME} /tools/bin/sdkmanager --install " system-images;android-30;google_apis;x86"
13
+ echo " no" | ${ANDROID_HOME} /tools/bin/avdmanager create avd --force --name android30 --device " Nexus 5X" -k ' system-images;android-30;google_apis;x86'
14
+ ${ANDROID_HOME} /emulator/emulator -list-avds
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
- SDKDIR=$PWD /.android-sdk
4
- export ANDROID_SDK_ROOT=${SDKDIR}
5
- export ANDROID_HOME=${SDKDIR}
6
- export ANDROID_AVD_HOME=${SDKDIR} /avd
3
+ set -e
7
4
8
- ${SDKDIR} /emulator/emulator -avd android30 -gpu swiftshader_indirect
5
+ if [[ -z " ${ANDROID_HOME} " ]]; then
6
+ SDKDIR=$PWD /.android-sdk
7
+ export ANDROID_HOME=${SDKDIR}
8
+ export ANDROID_SDK_ROOT=${SDKDIR}
9
+ fi
10
+
11
+ echo " Killing previous emulators"
12
+ adb devices | grep emulator | cut -f1 | while read line; do adb -s $line emu kill ; done
13
+
14
+ echo " Starting emulator"
15
+ nohup ${ANDROID_HOME} /emulator/emulator -avd android30 -no-audio -no-snapshot -no-window -gpu swiftshader_indirect &
16
+ ${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'
17
+ ${ANDROID_HOME} /platform-tools/adb devices
18
+ echo " Emulator started"
You can’t perform that action at this time.
0 commit comments