Skip to content

Commit 6c03eb9

Browse files
committed
Add Android Demo
1 parent 3f76413 commit 6c03eb9

File tree

3 files changed

+78
-2
lines changed

3 files changed

+78
-2
lines changed

.github/workflows/acceptance-v6.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,4 @@ jobs:
5454
TD_API_KEY: ${{ secrets.TESTDRIVER_API_KEY }}
5555
TD_WEBSITE: https://testdriver-sandbox.vercel.app
5656
TD_THIS_FILE: ${{ matrix.test }}
57+
TD_GENYMOTION_KEY: ${{ secrets.GENYMOTION_KEY }}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
version: 6.0.0
2+
session: 685c63558f43d1527c84d053
3+
steps:
4+
# Start the instance and install APK
5+
- prompt: Download and Start APK
6+
commands:
7+
- command: exec
8+
lang: pwsh
9+
code: |
10+
# Authenticate Gmsaas
11+
gmsaas auth token ${TD_GENYMOTION_KEY}
12+
gmsaas config set android-sdk-path C:\Android
13+
14+
# Start instance, with name 'td'
15+
$instance=$(gmsaas instances start 3990323a-1e9a-49df-ad87-6947f7fc166e td)
16+
gmsaas instances adbconnect $instance
17+
18+
# Save Instance ID
19+
$instance | Out-File -FilePath C:\instance_id
20+
21+
# Get Display Link
22+
gmsaas instances display -y $instance
23+
$clipboard = Get-Clipboard
24+
$escapedUrl = '"' + $clipboard + '"'
25+
26+
# Open Chrome to Emulator
27+
Start-Process 'C:/Program Files/Google/Chrome/Application/chrome.exe' -ArgumentList '--start-maximized',$escapedUrl
28+
29+
- command: exec
30+
lang: pwsh
31+
code: |
32+
# Download +install APK
33+
$apk_url = "https://dw.uptodown.net/dwn/RvVkii134Riphftvun7hQBZyU0aCwJjJMFI3FD3XyiR2-IJpuBWXadWSW1IBDH4us2x6lZT5CFGPXN-mCE8iXmUtEDZX9EcgP0ZDVFNBjF-6Esb49ktjva0lneLIgN0q/sfVkgNUCoq4pyIjN4Kgq_eLeFsdl17qphwZPltH0KDQ0MhaRZ2f14JU9eNL-NzInogYsiMKSi1Hi3i8dJlO7LeLBT-trJq_waAWMe6dxM0axtzM5XxyFcXrXKVvIdcVC/Qq5DSToc1YivIME2j6y0fjMcKHol6T4Zl8LeQs4lcgR4o0I_RP7IK0hUJuC_Le8U/todo-2-3-4.apk"
34+
Invoke-WebRequest -Uri "$apk_url" -OutFile "C:\app.apk"
35+
adb install C:\app.apk
36+
37+
# Get Package name
38+
$output = & 'C:\Android\build-tools\36.0.0\aapt.exe' dump badging C:\app.apk
39+
$package = ($output | Select-String "package: name='([^']+)'" ).Matches.Groups[1].Value
40+
41+
# Launch Application
42+
adb shell monkey -p $package -c android.intent.category.LAUNCHER 1
43+
44+
# Make Sure Window is open
45+
- command: wait-for-text
46+
text: gmsaas
47+
timeout: 60000
48+
49+
- prompt: assert app opens
50+
commands:
51+
- command: assert
52+
expect: The Todo App is open
53+
54+
- command: hover-text
55+
action: click
56+
text: "click anywhere"
57+
description: Label that describes to click anywhere
58+
59+
- prompt: Stop the Android Instance
60+
commands:
61+
- command: exec
62+
lang: pwsh
63+
code: |
64+
$instance = Get-Content -Path C:\instance_id -Raw
65+
66+
gmsaas instances stop $instance

testdriver/examples/mobile/readme.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1-
# TBD
1+
# Android Example
2+
3+
Starts a Genymotion cloud instance, downloads and installs an APK, Opens in browser.
4+
5+
This example only needs a Genymotion Key. It downloads a simple todo APK from a website
6+
and installs.
7+
8+
The Recipe ID and APK URL will likely be env variables, but are hard coded here.
9+
10+
Also the starting and stopping of the android instance should be in a post and pre run
11+
so the instance is always stopped whether the test passes or not.
212

3-
- Alex is working on this

0 commit comments

Comments
 (0)