Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update boilerplate #185

Merged
merged 18 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 32 additions & 77 deletions .github/workflows/e2e-android-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,92 +8,47 @@ on:

jobs:
android-app:
strategy:
matrix:
include:
- chromedriverVersion: "74.0.3729.6"
apiLevel: 30
emuTag: google_apis
arch: x86
profile: Nexus 6P
- chromedriverVersion: "2.44"
apiLevel: 28
emuTag: default
arch: x86
profile: Nexus 6P
- chromedriverVersion: "2.28"
apiLevel: 25
emuTag: default
arch: x86
profile: Nexus 6P
- chromedriverVersion: "2.20"
apiLevel: 23
emuTag: default
arch: x86
profile: Nexus 6P

env:
CI: true
ANDROID_AVD: emulator
APPIUM_TEST_SERVER_PORT: 4723
APPIUM_TEST_SERVER_HOST: 0.0.0.0
_FORCE_LOGS: 1
# No hardware acceleration is available for emulators on Ubuntu:
# https://github.com/marketplace/actions/android-emulator-runner#can-i-use-this-action-on-linux-vms
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- run: yarn install
- run: |
mkdir apps
wget https://github.com/webdriverio/native-demo-app/releases/download/v0.4.0/Android-NativeDemoApp-0.4.0.apk -P apps
- run: |
npm config set legacy-peer-deps true
npm install -g appium@next
npm install --chromedriver_version="${{ matrix.chromedriverVersion }}"
npm install --no-save mjpeg-consumer
name: Install dev dependencies
- uses: actions/setup-java@v3
- name: ⬇️ Checkout Repository
uses: actions/checkout@v3

- name: 🟢 Setup Node.js
uses: actions/setup-node@v3
with:
distribution: 'temurin'
java-version: '11'
- run: |
cwd=$(pwd)
pushd "$cwd"
cd ~
appium driver install uiautomator2
nohup appium server \
--port=$APPIUM_TEST_SERVER_PORT \
--address=$APPIUM_TEST_SERVER_HOST \
--relaxed-security \
2>&1 > "$cwd/appium.log" &
popd
name: Start Appium server
- run: nohup adb logcat > logcat.log &
name: Capture logcat
- uses: reactivecircus/android-emulator-runner@v2
name: e2e_api${{ matrix.apiLevel }}
node-version-file: '.nvmrc'

- name: 🧩 Install Dependencies
run: npm ci

- name: 📦 Download apps
run: |
mkdir apps
wget https://github.com/webdriverio/native-demo-app/releases/download/v1.0.8/android.wdio.native.app.v1.0.8.apk -P apps

- name: ☕ Setup Java and Android SDK
uses: actions/setup-java@v4
with:
script: yarn android.app
avd-name: ${{ env.ANDROID_AVD }}
sdcard-path-or-size: 1500M
api-level: ${{ matrix.apiLevel }}
disable-spellchecker: true
target: ${{ matrix.emuTag }}
arch: ${{ matrix.arch }}
profile: ${{ matrix.profile }}
- name: Save logcat output
if: ${{ always() }}
uses: actions/upload-artifact@master
distribution: 'zulu'
java-version: '17.x'

# https://github.com/marketplace/actions/android-emulator-runner#configurations
- name: 📱 Setup Android Emulator
uses: reactivecircus/android-emulator-runner@v2
with:
name: logcat-api${{ matrix.apiLevel }}
path: logcat.log
avd-name: Pixel_7_Pro_Android_14_API_34
api-level: 34
script: yarn android.app

- name: 📲 Run Tests on Android Emulator
run: npm run android.app

- name: Save server output
if: ${{ always() }}
uses: actions/upload-artifact@master
with:
name: appium-api${{ matrix.apiLevel }}
path: appium.log
name: appium-api
path: appium.log
116 changes: 59 additions & 57 deletions README.md

Large diffs are not rendered by default.

19 changes: 15 additions & 4 deletions config/wdio.android.app.conf.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from 'node:path';
import { join } from 'node:path';
import { config as baseConfig } from './wdio.shared.local.appium.conf.js';

export const config: WebdriverIO.Config = {
Expand All @@ -24,12 +24,23 @@ export const config: WebdriverIO.Config = {
// For W3C the appium capabilities need to have an extension prefix
// http://appium.io/docs/en/writing-running-appium/caps/
// This is `appium:` for all Appium Capabilities which can be found here
'appium:deviceName': 'Pixel_3_10.0',
'appium:platformVersion': '10.0',

//
// NOTE: Change this name according to the Emulator you have created on your local machine
'appium:deviceName': 'Pixel_7_Pro_Android_14_API_34',
//
// NOTE: Change this version according to the Emulator you have created on your local machine
'appium:platformVersion': '14.0',
'appium:orientation': 'PORTRAIT',
'appium:automationName': 'UiAutomator2',
// The path to the app
'appium:app': path.join(process.cwd(), 'apps', 'Android-NativeDemoApp-0.4.0.apk'),
'appium:app': join(
process.cwd(),
'apps',
//
// NOTE: Change this name according to the app version you downloaded
'android.wdio.native.app.v1.0.8.apk',
),
'appium:appWaitActivity': 'com.wdiodemoapp.MainActivity',
'appium:newCommandTimeout': 240,
},
Expand Down
9 changes: 7 additions & 2 deletions config/wdio.android.browser.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@ export const config: WebdriverIO.Config = {
// For W3C the appium capabilities need to have an extension prefix
// http://appium.io/docs/en/writing-running-appium/caps/
// This is `appium:` for all Appium Capabilities which can be found here
'appium:deviceName': 'Pixel_3_10.0',
'appium:platformVersion': '10.0',

//
// NOTE: Change this name according to the Emulator you have created on your local machine
'appium:deviceName': 'Pixel_7_Pro_Android_14_API_34',
//
// NOTE: Change this version according to the Emulator you have created on your local machine
'appium:platformVersion': '14.0',
'appium:automationName': 'UiAutomator2',
'appium:orientation': 'PORTRAIT',
'appium:newCommandTimeout': 240,
Expand Down
18 changes: 13 additions & 5 deletions config/wdio.ios.app.conf.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from 'node:path';
import { join } from 'node:path';
import { config as baseConfig } from './wdio.shared.local.appium.conf.js';

export const config: WebdriverIO.Config = {
Expand All @@ -22,17 +22,25 @@ export const config: WebdriverIO.Config = {
// For W3C the appium capabilities need to have an extension prefix
// This is `appium:` for all Appium Capabilities which can be found here
// http://appium.io/docs/en/writing-running-appium/caps/
'appium:deviceName': 'iPhone 13',
'appium:platformVersion': '15.4',

//
// NOTE: Change this name according to the Simulator you have created on your local machine
'appium:deviceName': 'iPhone 15',
//
// NOTE: Change this version according to the Simulator Version you have created on your local machine
'appium:platformVersion': '17.2',
'appium:orientation': 'PORTRAIT',
'appium:automationName': 'XCUITest',
// The path to the app
'appium:app': path.join(
'appium:app': join(
process.cwd(),
'apps',
'iOS-Simulator-NativeDemoApp-0.4.0.app.zip'
// Change this name according to the app version you downloaded
'ios.simulator.wdio.native.app.v1.0.8.zip'
),
'appium:newCommandTimeout': 240,
// This is needed to wait for the webview context to become available
'appium:webviewConnectTimeout': 5000,
}
]
};
9 changes: 7 additions & 2 deletions config/wdio.ios.browser.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@ export const config: WebdriverIO.Config = {
// For W3C the appium capabilities need to have an extension prefix
// This is `appium:` for all Appium Capabilities which can be found here
// http://appium.io/docs/en/writing-running-appium/caps/
'appium:deviceName': 'iPhone 12',
'appium:platformVersion': '14.5',

//
// NOTE: Change this name according to the Simulator you have created on your local machine
'appium:deviceName': 'iPhone 15',
//
// NOTE: Change this version according to the Simulator Version you have created on your local machine
'appium:platformVersion': '17.2',
'appium:orientation': 'PORTRAIT',
'appium:automationName': 'XCUITest',
'appium:newCommandTimeout': 240,
Expand Down
4 changes: 3 additions & 1 deletion config/wdio.shared.conf.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import type { Options } from '@wdio/types';

/**
* All not needed configurations, for this boilerplate, are removed.
* If you want to know which configuration options you have then you can
* check https://webdriver.io/docs/configurationfile
*/
export const config: WebdriverIO.Config = {
export const config: Options.Testrunner = {
//
// ====================
// Runner Configuration
Expand Down
12 changes: 11 additions & 1 deletion config/wdio.shared.local.appium.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,15 @@ export const config: WebdriverIO.Config = {
},
},
],
]
],
before: async ()=> {
// Only update the setting for Android, this is needed to reduce the timeout for the UiSelector locator strategy,
// which is also used in certain tests, so it will not wait for 10 seconds if it can't find an element
if (driver.isAndroid){
await driver.updateSettings({
// This reduces the timeout for the UiUiSelector from 10 seconds to 3 seconds
waitForSelectorTimeout: 3 * 1000
});
}
}
};
59 changes: 0 additions & 59 deletions docs/ANDROID_IOS_SETUP.md

This file was deleted.

Loading