Skip to content

Commit eef6fd6

Browse files
test: clone and run wdio-android test (#54)
* Run E2E from flutter-finder repo https://github.com/AppiumTestDistribution/flutter-finder/tree/main
1 parent 5f8b024 commit eef6fd6

File tree

8 files changed

+27722
-30729
lines changed

8 files changed

+27722
-30729
lines changed

.circleci/config.yml

Lines changed: 61 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@ version: 2.1
88
# Define a job to be invoked later in a workflow.
99
# See: https://circleci.com/docs/jobs-steps/#jobs-overview & https://circleci.com/docs/configuration-reference/#jobs
1010
jobs:
11-
build:
11+
WDIO_IOS:
1212
# Specify the execution environment.
1313
# See: https://circleci.com/docs/executor-intro/ & https://circleci.com/docs/configuration-reference/#executor-job
1414
macos:
1515
# Specify the Xcode version you desire here
1616
# See: https://circleci.com/docs/using-macos/
1717
xcode: 15.2.0
1818

19-
# Add steps to the job
2019
# See: https://circleci.com/docs/jobs-steps/#steps-overview & https://circleci.com/docs/configuration-reference/#steps
2120
steps:
2221
# Checkout the code as the first step.
@@ -33,6 +32,10 @@ jobs:
3332
asset_urls=$(echo "$release_info" | grep "browser_download_url" | cut -d '"' -f 4)
3433
ios_app=$(echo "$asset_urls" | tail -n 1)
3534
echo "$ios_app"
35+
curl -LO $ios_app
36+
echo 'export APP_PATH=$CIRCLE_WORKING_DIRECTORY/ios.zip' >> $BASH_ENV
37+
echo $pwd
38+
echo ls
3639
nvm install v20.2.0 && nvm alias default 20.2.0
3740
node -v
3841
target_sim_id=$(xcrun simctl list devices available | grep "iPhone 14" | cut -d "(" -f2 | cut -d ")" -f1 | head -n 1)
@@ -43,7 +46,7 @@ jobs:
4346
npm install -g appium
4447
npm ci
4548
npm run build
46-
appium driver run xcuitest build-wda
49+
appium driver run xcuitest build-wda
4750
wda=$(ls -d /Users/distiller/Library/Developer/Xcode/DerivedData/WebDriverAgent*)
4851
echo $wda
4952
echo 'export WDA_PATH=$wda' >> $BASH_ENV
@@ -52,15 +55,68 @@ jobs:
5255
xcrun simctl install $target_sim_id $wda/Build/Products/Debug-iphonesimulator/WebDriverAgentRunner-Runner.app
5356
xcrun simctl launch $target_sim_id "com.facebook.WebDriverAgentRunner.xctrunner"
5457
mkdir appium-logs
55-
UDID=$target_sim_id APP_PATH=$ios_app npm run wdio-ios
58+
git clone https://github.com/AppiumTestDistribution/flutter-finder.git
59+
UDID=$target_sim_id APP_PATH=$ios_app npm run wdio-ios-ci
5660
5761
- store_artifacts:
5862
path: appium-logs
63+
JAVA_IOS:
64+
# Specify the execution environment.
65+
# See: https://circleci.com/docs/executor-intro/ & https://circleci.com/docs/configuration-reference/#executor-job
66+
# Add steps to the job
67+
# See: https://circleci.com/docs/jobs-steps/#steps-overview & https://circleci.com/docs/configuration-reference/#steps
68+
macos:
69+
# Specify the Xcode version you desire here
70+
# See: https://circleci.com/docs/using-macos/
71+
xcode: 15.2.0
72+
steps:
73+
# Checkout the code as the first step.
74+
- checkout
75+
- run: xcrun simctl list devices available
76+
- run:
77+
name: Node Version
78+
command: |
79+
nvm install v20.2.0 && nvm alias default 20.2.0
80+
- run:
81+
name: Install Appium and Run iOS Test
82+
command: |
83+
release_info=$(curl -s https://api.github.com/repos/AppiumTestDistribution/appium-flutter-server/releases/latest)
84+
asset_urls=$(echo "$release_info" | grep "browser_download_url" | cut -d '"' -f 4)
85+
ios_app=$(echo "$asset_urls" | tail -n 1)
86+
echo "$ios_app"
87+
curl -LO $ios_app
88+
echo 'export APP_PATH=$CIRCLE_WORKING_DIRECTORY/ios.zip' >> $BASH_ENV
89+
echo $APP_PATH
90+
nvm install v20.2.0 && nvm alias default 20.2.0
91+
node -v
92+
target_sim_id=$(xcrun simctl list devices available | grep "iPhone 14" | cut -d "(" -f2 | cut -d ")" -f1 | head -n 1)
93+
echo $target_sim_id
94+
echo 'export UDID=$target_sim_id' >> $BASH_ENV
95+
xcrun simctl boot $target_sim_id
96+
xcrun simctl bootstatus $target_sim_id -b
97+
npm install -g appium
98+
npm ci
99+
npm run build
100+
appium driver run xcuitest build-wda
101+
wda=$(ls -d /Users/distiller/Library/Developer/Xcode/DerivedData/WebDriverAgent*)
102+
echo $wda
103+
echo 'export WDA_PATH=$wda' >> $BASH_ENV
104+
echo ${WDA_PATH}
105+
echo ${PROJECT_ENV_VAR}
106+
xcrun simctl install $target_sim_id $wda/Build/Products/Debug-iphonesimulator/WebDriverAgentRunner-Runner.app
107+
xcrun simctl launch $target_sim_id "com.facebook.WebDriverAgentRunner.xctrunner"
108+
mkdir appium-logs
109+
git clone https://github.com/AppiumTestDistribution/flutter-finder.git
110+
cd flutter-finder/flutter-by/java
111+
UDID=$target_sim_id APP_PATH=$ios_app Platform=ios ./gradlew clean test --debug
59112
113+
- store_artifacts:
114+
path: flutter-finder/flutter-by/java/appium.log
60115
# Orchestrate jobs using workflows
61116
# See: https://circleci.com/docs/workflows/ & https://circleci.com/docs/configuration-reference/#workflows
62117
workflows:
63118
ios: # This is the name of the workflow, feel free to change it to better match your workflow.
64119
# Inside the workflow, you define the jobs you want to run.
65120
jobs:
66-
- build
121+
- WDIO_IOS
122+
- JAVA_IOS

.github/workflows/main.yml

Lines changed: 95 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
name: Appium Flutter Integration Driver
1010
jobs:
11-
Build_Server:
11+
Android_E2E_WDIO:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
@@ -48,6 +48,18 @@ jobs:
4848
run: |
4949
npm install
5050
npm run prettier-check
51+
- name: Build Driver
52+
run: |
53+
npm run build
54+
- name: Install Drivers
55+
run: |
56+
npm install -g appium
57+
appium driver list
58+
- name: Checkout Test from Flutter Finder
59+
uses: actions/checkout@v2
60+
with:
61+
repository: AppiumTestDistribution/flutter-finder
62+
path: finder
5163
- name: run tests
5264
uses: reactivecircus/android-emulator-runner@v2
5365
with:
@@ -59,19 +71,96 @@ jobs:
5971
echo ${{ env }}
6072
adb devices
6173
node --version
62-
npm install -g wait-on
63-
npm install -g appium
64-
npm install
65-
npm run build
74+
echo ${{ github.workspace }}
75+
ls ${{ github.workspace }}/finder -R
6676
appium driver list
6777
mkdir ${{ github.workspace }}/appium-logs
6878
adb logcat > ${{ github.workspace }}/appium-logs/flutter.txt &
6979
echo $android_app
70-
APP_PATH=${{ env.APP_PATH }} npm run wdio-android
80+
APP_PATH=${{ env.APP_PATH }} npm run wdio-android-ci
7181
# appium server -pa=/wd/hub & wait-on http://127.0.0.1:4723/wd/hub/status &&
7282
- name: upload appium logs
7383
if: always()
7484
uses: actions/upload-artifact@v4
7585
with:
7686
name: appium-logs
7787
path: ${{ github.workspace }}/appium-logs
88+
Android_E2E_JAVA:
89+
runs-on: ubuntu-latest
90+
strategy:
91+
matrix:
92+
api-level: [ 29 ]
93+
target: [ google_apis ]
94+
steps:
95+
- name: Check out my other private repo
96+
uses: actions/checkout@master
97+
- name: Set up JDK 17
98+
uses: actions/setup-java@v3
99+
with:
100+
java-version: '17'
101+
distribution: 'adopt'
102+
- name: Setup Android SDK
103+
uses: android-actions/[email protected]
104+
105+
- name: 'List files'
106+
run: |
107+
release_info=$(curl -s https://api.github.com/repos/AppiumTestDistribution/appium-flutter-server/releases/latest)
108+
asset_urls=$(echo "$release_info" | grep "browser_download_url" | cut -d '"' -f 4)
109+
android_app=$(echo "$asset_urls" | head -n 1)
110+
echo "$android_app"
111+
ios_app=$(echo "$asset_urls" | tail -n 1)
112+
echo "$ios_app"
113+
curl -LO $android_app
114+
ls ${{ github.workspace }}
115+
echo "APP_PATH=${{ github.workspace }}/app-debug.apk" >> $GITHUB_ENV
116+
- uses: actions/setup-node@v4
117+
with:
118+
node-version: 20
119+
- name: Enable KVM group perms
120+
run: |
121+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
122+
sudo udevadm control --reload-rules
123+
sudo udevadm trigger --name-match=kvm
124+
- name: Linting
125+
run: |
126+
npm install
127+
npm run prettier-check
128+
- name: Build Driver
129+
run: |
130+
npm run build
131+
- name: Install Drivers
132+
run: |
133+
npm install -g appium
134+
appium driver list
135+
- name: Checkout Test from Flutter Finder
136+
uses: actions/checkout@v2
137+
with:
138+
repository: AppiumTestDistribution/flutter-finder
139+
path: finder
140+
- name: run tests
141+
uses: reactivecircus/android-emulator-runner@v2
142+
with:
143+
working-directory: ${{ github.workspace }}/finder/flutter-by/java
144+
api-level: ${{ matrix.api-level }}
145+
target: ${{ matrix.target }}
146+
arch: x86_64
147+
profile: Nexus 6
148+
script: |
149+
echo ${{ env }}
150+
adb devices
151+
node --version
152+
echo ${{ github.workspace }}
153+
ls ${{ github.workspace }}/finder -R
154+
appium driver list
155+
mkdir ${{ github.workspace }}/appium-logs
156+
adb logcat > ${{ github.workspace }}/appium-logs/flutter.txt &
157+
echo $android_app
158+
ls
159+
APP_PATH=${{ env.APP_PATH }} Platform=android ./gradlew clean test
160+
# appium server -pa=/wd/hub & wait-on http://127.0.0.1:4723/wd/hub/status &&
161+
- name: upload appium logs
162+
if: always()
163+
uses: actions/upload-artifact@v4
164+
with:
165+
name: appium-logs-java
166+
path: ${{ github.workspace }}/appium-logs

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ yarn-debug.log*
1111
yarn-error.log*
1212
lerna-debug.log*
1313
.pnpm-debug.log*
14-
14+
flutter-finder
1515
# Diagnostic reports (https://nodejs.org/api/report.html)
1616
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
1717

0 commit comments

Comments
 (0)