實戰練習 - 雲端瀏覽器測試
安裝模組
npm i wdio-testingbot-service --save-dev
設定環境變數
Mac
export TESTINGBOT_KEY=
export TESTINGBOT_SECRET=
Window
SET TESTINGBOT_KEY=
SET TESTINGBOT_SECRET=
更改設定檔 wdio.conf.js
capabilities: [{
maxInstances: 1,
browserName: 'MicrosoftEdge',
version: '14',
platform: 'WINDOWS',
name: 'e2e testing'
}],
services: ['testingbot'],
host: 'hub.testingbot.com',
port: 80,
user: process.env.TESTINGBOT_KEY,
key: process.env.TESTINGBOT_SECRET,
注意事項
- baseUrl 要改
- timeout 的問題
// wdio.conf.js
exports.config = {
// ...
framework: 'mocha',
mochaOpts: {
ui: 'bdd',
timeout: 20000
},
// ...
}