W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
你可能已經(jīng)注意到我們package.json
中的測試腳本提到了一個文件wdio.conf.js
。這就是WebdriverIO配置文件,它控制了我們測試套件的大部分方面。
wdio.conf.js:
const os = require('os')
const path = require('path')
const { spawn, spawnSync } = require('child_process')
// keep track of the `tauri-driver` child process
let tauriDriver
exports.config = {
specs: ['./test/specs/**/*.js'],
maxInstances: 1,
capabilities: [
{
maxInstances: 1,
'tauri:options': {
application: '../../target/release/hello-tauri-webdriver',
},
},
],
reporters: ['spec'],
framework: 'mocha',
mochaOpts: {
ui: 'bdd',
timeout: 60000,
},
// ensure the rust project is built since we expect this binary to exist for the webdriver sessions
onPrepare: () => spawnSync('cargo', ['build', '--release']),
// ensure we are running `tauri-driver` before the session starts so that we can proxy the webdriver requests
beforeSession: () =>
(tauriDriver = spawn(
path.resolve(os.homedir(), '.cargo', 'bin', 'tauri-driver'),
[],
{ stdio: [null, process.stdout, process.stderr] }
)),
// clean up the `tauri-driver` process we spawned at the start of the session
afterSession: () => tauriDriver.kill(),
}
如果你對`exports.config`對象上的屬性感興趣,我建議閱讀文檔。對于非WDIO特定的項目,有注釋解釋為什么我們在onPrepare
?、?beforeSession
?和?afterSession
?中運行命令。我們還將我們的規(guī)范設(shè)置為?"./test/specs/**/*.js"
?,所以讓我們現(xiàn)在創(chuàng)建一個規(guī)范文件。
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: