Appium 服務
處理 Appium 伺服器不在實際 WebdriverIO 專案的範圍內。此服務可協助您在使用 WDIO 測試執行器執行測試時順暢地執行 Appium 伺服器。它會在子程序中啟動 Appium 伺服器。
安裝
最簡單的方法是透過以下方式,將 @wdio/appium-service
保留在 package.json
中作為 devDependency:
npm install @wdio/appium-service --save-dev
有關如何安裝 WebdriverIO
的說明,請參閱此處。
設定
若要使用此服務,您需要將 appium
新增至您的服務陣列
// wdio.conf.js
export const config = {
// ...
port: 4723, // default appium port
services: ['appium'],
// ...
};
選項
以下選項可以新增至 wdio.conf.js 檔案。若要定義服務的選項,您需要以下列方式將服務新增至 services
清單
// wdio.conf.js
export const config = {
// ...
port: 4723, // default appium port
services: [
['appium', {
// Appium service options here
// ...
}]
],
// ...
};
logPath
應儲存 Appium 伺服器所有記錄的路徑。
類型:String
範例
export const config = {
// ...
services: [
['appium', {
logPath : './'
}]
],
// ...
}
command
若要使用您安裝的 Appium (例如,全域安裝),請指定應啟動的命令。
類型:String
範例
export const config = {
// ...
services: [
['appium', {
command : 'appium'
}]
],
// ...
}
args
Appium 伺服器的引數對應,直接傳遞至 appium
。
請參閱文件,了解可能的引數。引數以小駱駝式大小寫提供。例如,debugLogSpacing: true
會轉換為 --debug-log-spacing
,或者它們可以如 Appium 文件中所概述的方式提供。
類型:Object
預設值:{}
範例
export const config = {
// ...
services: [
['appium', {
args: {
// ...
debugLogSpacing: true,
platformName: 'iOS'
// ...
}
}]
],
// ...
}
注意:不建議使用別名,且不支援別名。請改用完整屬性名稱,並以小駱駝式大小寫表示。
如需有關 WebdriverIO 的詳細資訊,請參閱首頁。