Skip to content

Commit 8c18e06

Browse files
Fix activate app (#38)
* Fix activate app * Add documentation * check app is installed for ios * rename port to flutter-server-port * fix readme for commands --------- Co-authored-by: saikrishna321 <[email protected]>
1 parent 33920b8 commit 8c18e06

File tree

9 files changed

+477
-406
lines changed

9 files changed

+477
-406
lines changed

.circleci/config.yml

Lines changed: 50 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -8,64 +8,59 @@ 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:
12-
# Specify the execution environment.
13-
# See: https://circleci.com/docs/executor-intro/ & https://circleci.com/docs/configuration-reference/#executor-job
14-
macos:
15-
# Specify the Xcode version you desire here
16-
# See: https://circleci.com/docs/using-macos/
17-
xcode: 15.2.0
11+
build:
12+
# Specify the execution environment.
13+
# See: https://circleci.com/docs/executor-intro/ & https://circleci.com/docs/configuration-reference/#executor-job
14+
macos:
15+
# Specify the Xcode version you desire here
16+
# See: https://circleci.com/docs/using-macos/
17+
xcode: 15.2.0
1818

19-
# Add steps to the job
20-
# See: https://circleci.com/docs/jobs-steps/#steps-overview & https://circleci.com/docs/configuration-reference/#steps
21-
steps:
22-
# Checkout the code as the first step.
23-
- checkout
24-
- run: xcrun simctl list devices available
25-
- run:
26-
name: Node Version
27-
command: |
28-
nvm install v20.2.0 && nvm alias default 20.2.0
29-
- run:
30-
name: Install Appium and Run iOS Test
31-
command: |
32-
release_info=$(curl -s https://api.github.com/repos/AppiumTestDistribution/appium-flutter-server/releases/latest)
33-
asset_urls=$(echo "$release_info" | grep "browser_download_url" | cut -d '"' -f 4)
34-
ios_app=$(echo "$asset_urls" | tail -n 1)
35-
echo "$ios_app"
36-
nvm install v20.2.0 && nvm alias default 20.2.0
37-
node -v
38-
target_sim_id=$(xcrun simctl list devices available | grep "iPhone 14" | cut -d "(" -f2 | cut -d ")" -f1 | head -n 1)
39-
echo $target_sim_id
40-
echo 'export UDID=$target_sim_id' >> $BASH_ENV
41-
xcrun simctl boot $target_sim_id
42-
xcrun simctl bootstatus $target_sim_id -b
43-
npm install -g appium
44-
npm ci
45-
npm run build
46-
appium driver run xcuitest build-wda
47-
wda=$(ls -d /Users/distiller/Library/Developer/Xcode/DerivedData/WebDriverAgent*)
48-
echo $wda
49-
echo 'export WDA_PATH=$wda' >> $BASH_ENV
50-
echo ${WDA_PATH}
51-
echo ${PROJECT_ENV_VAR}
52-
xcrun simctl install $target_sim_id $wda/Build/Products/Debug-iphonesimulator/WebDriverAgentRunner-Runner.app
53-
xcrun simctl launch $target_sim_id "com.facebook.WebDriverAgentRunner.xctrunner"
54-
mkdir appium-logs
55-
UDID=$target_sim_id APP_PATH=$ios_app npm run wdio-ios
19+
# Add steps to the job
20+
# See: https://circleci.com/docs/jobs-steps/#steps-overview & https://circleci.com/docs/configuration-reference/#steps
21+
steps:
22+
# Checkout the code as the first step.
23+
- checkout
24+
- run: xcrun simctl list devices available
25+
- run:
26+
name: Node Version
27+
command: |
28+
nvm install v20.2.0 && nvm alias default 20.2.0
29+
- run:
30+
name: Install Appium and Run iOS Test
31+
command: |
32+
release_info=$(curl -s https://api.github.com/repos/AppiumTestDistribution/appium-flutter-server/releases/latest)
33+
asset_urls=$(echo "$release_info" | grep "browser_download_url" | cut -d '"' -f 4)
34+
ios_app=$(echo "$asset_urls" | tail -n 1)
35+
echo "$ios_app"
36+
nvm install v20.2.0 && nvm alias default 20.2.0
37+
node -v
38+
target_sim_id=$(xcrun simctl list devices available | grep "iPhone 14" | cut -d "(" -f2 | cut -d ")" -f1 | head -n 1)
39+
echo $target_sim_id
40+
echo 'export UDID=$target_sim_id' >> $BASH_ENV
41+
xcrun simctl boot $target_sim_id
42+
xcrun simctl bootstatus $target_sim_id -b
43+
npm install -g appium
44+
npm ci
45+
npm run build
46+
appium driver run xcuitest build-wda
47+
wda=$(ls -d /Users/distiller/Library/Developer/Xcode/DerivedData/WebDriverAgent*)
48+
echo $wda
49+
echo 'export WDA_PATH=$wda' >> $BASH_ENV
50+
echo ${WDA_PATH}
51+
echo ${PROJECT_ENV_VAR}
52+
xcrun simctl install $target_sim_id $wda/Build/Products/Debug-iphonesimulator/WebDriverAgentRunner-Runner.app
53+
xcrun simctl launch $target_sim_id "com.facebook.WebDriverAgentRunner.xctrunner"
54+
mkdir appium-logs
55+
UDID=$target_sim_id APP_PATH=$ios_app npm run wdio-ios
5656
57-
# Collect XML test results data to show in the UI, and save the same XML
58-
# files under test-results folder in the Artifacts tab
59-
- store_test_results:
60-
path: test_output
61-
- store_artifacts:
62-
path: test_output
63-
destination: scan-output
57+
- store_artifacts:
58+
path: appium-logs
6459

6560
# Orchestrate jobs using workflows
6661
# See: https://circleci.com/docs/workflows/ & https://circleci.com/docs/configuration-reference/#workflows
6762
workflows:
68-
ios: # This is the name of the workflow, feel free to change it to better match your workflow.
69-
# Inside the workflow, you define the jobs you want to run.
70-
jobs:
71-
- build
63+
ios: # This is the name of the workflow, feel free to change it to better match your workflow.
64+
# Inside the workflow, you define the jobs you want to run.
65+
jobs:
66+
- build

.github/workflows/doc.yml

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,42 @@ name: Update README with latest flutter server version
44

55
# Controls when the workflow will run
66
on:
7-
repository_dispatch:
8-
types: [server-update]
7+
repository_dispatch:
8+
types: [server-update]
99

1010
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1111
jobs:
12-
# This workflow contains a single job called "build"
13-
build:
14-
# The type of runner that the job will run on
15-
runs-on: ubuntu-latest
12+
# This workflow contains a single job called "build"
13+
build:
14+
# The type of runner that the job will run on
15+
runs-on: ubuntu-latest
1616

17-
# Steps represent a sequence of tasks that will be executed as part of the job
18-
steps:
19-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
20-
- uses: actions/checkout@v4
17+
# Steps represent a sequence of tasks that will be executed as part of the job
18+
steps:
19+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
20+
- uses: actions/checkout@v4
2121

22-
- name: Update README with latest commit id and push to repo
23-
run: |
24-
npm install -g mustache
25-
touch data.json
26-
echo "{\"SERVER_VERSION\": \"${{ github.event.client_payload.version }}\"}" > data.json
27-
git config --global user.name "GitHub Actions"
28-
git config --global user.email "[email protected]"
29-
git status
30-
BRANCH_NAME=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
31-
echo "Running on branch: '$BRANCH_NAME'"
32-
if [[ "$BRANCH_NAME" = "main" ]]; then
33-
git pull --rebase origin main
34-
cat data.json
35-
mustache data.json template.mustache > README_new.md
36-
mv README_new.md README.md
37-
rm -rf data.json
38-
echo "There are changes in 'main'. Update README"
39-
git add README.md
40-
git commit -m "Update README with latest commit ID - ${{ github.event.client_payload.version }}"
41-
git push -u origin main
42-
43-
fi
44-
env:
45-
GITHUB_TOKEN: ${{ secrets.UPDATE_TOKEN }}
22+
- name: Update README with latest commit id and push to repo
23+
run: |
24+
npm install -g mustache
25+
touch data.json
26+
echo "{\"SERVER_VERSION\": \"${{ github.event.client_payload.version }}\"}" > data.json
27+
git config --global user.name "GitHub Actions"
28+
git config --global user.email "[email protected]"
29+
git status
30+
BRANCH_NAME=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
31+
echo "Running on branch: '$BRANCH_NAME'"
32+
if [[ "$BRANCH_NAME" = "main" ]]; then
33+
git pull --rebase origin main
34+
cat data.json
35+
mustache data.json template.mustache > README_new.md
36+
mv README_new.md README.md
37+
rm -rf data.json
38+
echo "There are changes in 'main'. Update README"
39+
git add README.md
40+
git commit -m "Update README with latest commit ID - ${{ github.event.client_payload.version }}"
41+
git push -u origin main
42+
43+
fi
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.UPDATE_TOKEN }}

.github/workflows/main.yml

Lines changed: 72 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,77 @@
11
on:
2-
push:
3-
branches:
4-
- main
5-
pull_request:
6-
branches:
7-
- main
2+
push:
3+
branches:
4+
- main
5+
pull_request:
6+
branches:
7+
- main
88

99
name: Appium Flutter Integration Driver
1010
jobs:
11-
Build_Server:
12-
runs-on: ubuntu-latest
13-
strategy:
14-
matrix:
15-
api-level: [29]
16-
target: [google_apis]
17-
steps:
18-
- name: Check out my other private repo
19-
uses: actions/checkout@master
20-
- name: Set up JDK 17
21-
uses: actions/setup-java@v3
22-
with:
23-
java-version: '17'
24-
distribution: 'adopt'
25-
- name: Setup Android SDK
26-
uses: android-actions/[email protected]
11+
Build_Server:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
api-level: [29]
16+
target: [google_apis]
17+
steps:
18+
- name: Check out my other private repo
19+
uses: actions/checkout@master
20+
- name: Set up JDK 17
21+
uses: actions/setup-java@v3
22+
with:
23+
java-version: '17'
24+
distribution: 'adopt'
25+
- name: Setup Android SDK
26+
uses: android-actions/[email protected]
2727

28-
- name: 'List files'
29-
run: |
30-
release_info=$(curl -s https://api.github.com/repos/AppiumTestDistribution/appium-flutter-server/releases/latest)
31-
asset_urls=$(echo "$release_info" | grep "browser_download_url" | cut -d '"' -f 4)
32-
android_app=$(echo "$asset_urls" | head -n 1)
33-
echo "$android_app"
34-
ios_app=$(echo "$asset_urls" | tail -n 1)
35-
echo "$ios_app"
36-
curl -LO $android_app
37-
ls ${{ github.workspace }}
38-
echo "APP_PATH=${{ github.workspace }}/app-debug.apk" >> $GITHUB_ENV
39-
- uses: actions/setup-node@v4
40-
with:
41-
node-version: 20
42-
- name: Enable KVM group perms
43-
run: |
44-
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
45-
sudo udevadm control --reload-rules
46-
sudo udevadm trigger --name-match=kvm
47-
- name: Linting
48-
run: |
49-
npm install
50-
npm run prettier-check
51-
- name: run tests
52-
uses: reactivecircus/android-emulator-runner@v2
53-
with:
54-
api-level: ${{ matrix.api-level }}
55-
target: ${{ matrix.target }}
56-
arch: x86_64
57-
profile: Nexus 6
58-
script: |
59-
echo ${{ env }}
60-
adb devices
61-
node --version
62-
npm install -g wait-on
63-
npm install -g appium
64-
npm install
65-
npm run build
66-
appium driver list
67-
mkdir ${{ github.workspace }}/appium-logs
68-
adb logcat > ${{ github.workspace }}/appium-logs/flutter.txt &
69-
echo $android_app
70-
APP_PATH=${{ env.APP_PATH }} npm run wdio-android
71-
# appium server -pa=/wd/hub & wait-on http://127.0.0.1:4723/wd/hub/status &&
72-
- name: upload appium logs
73-
if: always()
74-
uses: actions/upload-artifact@v4
75-
with:
76-
name: appium-logs
77-
path: ${{ github.workspace }}/appium-logs
28+
- name: 'List files'
29+
run: |
30+
release_info=$(curl -s https://api.github.com/repos/AppiumTestDistribution/appium-flutter-server/releases/latest)
31+
asset_urls=$(echo "$release_info" | grep "browser_download_url" | cut -d '"' -f 4)
32+
android_app=$(echo "$asset_urls" | head -n 1)
33+
echo "$android_app"
34+
ios_app=$(echo "$asset_urls" | tail -n 1)
35+
echo "$ios_app"
36+
curl -LO $android_app
37+
ls ${{ github.workspace }}
38+
echo "APP_PATH=${{ github.workspace }}/app-debug.apk" >> $GITHUB_ENV
39+
- uses: actions/setup-node@v4
40+
with:
41+
node-version: 20
42+
- name: Enable KVM group perms
43+
run: |
44+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
45+
sudo udevadm control --reload-rules
46+
sudo udevadm trigger --name-match=kvm
47+
- name: Linting
48+
run: |
49+
npm install
50+
npm run prettier-check
51+
- name: run tests
52+
uses: reactivecircus/android-emulator-runner@v2
53+
with:
54+
api-level: ${{ matrix.api-level }}
55+
target: ${{ matrix.target }}
56+
arch: x86_64
57+
profile: Nexus 6
58+
script: |
59+
echo ${{ env }}
60+
adb devices
61+
node --version
62+
npm install -g wait-on
63+
npm install -g appium
64+
npm install
65+
npm run build
66+
appium driver list
67+
mkdir ${{ github.workspace }}/appium-logs
68+
adb logcat > ${{ github.workspace }}/appium-logs/flutter.txt &
69+
echo $android_app
70+
APP_PATH=${{ env.APP_PATH }} npm run wdio-android
71+
# appium server -pa=/wd/hub & wait-on http://127.0.0.1:4723/wd/hub/status &&
72+
- name: upload appium logs
73+
if: always()
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: appium-logs
77+
path: ${{ github.workspace }}/appium-logs

.github/workflows/publish.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44
name: Node.js Package
55

66
on:
7-
release:
8-
types: [created]
7+
release:
8+
types: [created]
99

1010
jobs:
11-
publish-npm:
12-
runs-on: ubuntu-latest
13-
steps:
14-
- uses: actions/checkout@v4
15-
- uses: actions/setup-node@v3
16-
with:
17-
node-version: 18
18-
registry-url: https://registry.npmjs.org/
19-
- run: npm ci
20-
- run: npm run build
21-
- run: npm publish
22-
env:
23-
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
11+
publish-npm:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-node@v3
16+
with:
17+
node-version: 18
18+
registry-url: https://registry.npmjs.org/
19+
- run: npm ci
20+
- run: npm run build
21+
- run: npm publish
22+
env:
23+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

docs/commands.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Flutter Commands
2+
3+
## mobile: launchApp
4+
5+
Launches the app with given app with appId(Android) or bundleId iOS. Will throw error when the app is not installed.
6+
7+
### Arguments
8+
9+
Name | Type | Required | Description | Example
10+
--- | --- | --- | --- | ---
11+
appId | string | yes | app identifier(Android) or bundle identifier(iOS) of the app to be launched | com.mycompany.app
12+
arguments | string&#124;array | no | One or more command line arguments for the app. If the app is already running then this argument is ignored. | ['-s', '-m']
13+
environment | dict | no | Environment variables mapping for the app. If the app is already running then this argument is ignored. | {'var': 'value'}

0 commit comments

Comments
 (0)