W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
你可能已經(jīng)注意到我們package.json
中的測(cè)試腳本提到了一個(gè)文件wdio.conf.js
。這就是WebdriverIO配置文件,它控制了我們測(cè)試套件的大部分方面。
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(),
}
如果你對(duì)`exports.config`對(duì)象上的屬性感興趣,我建議閱讀文檔。對(duì)于非WDIO特定的項(xiàng)目,有注釋解釋為什么我們?cè)?code>onPrepare?、?beforeSession
?和?afterSession
?中運(yùn)行命令。我們還將我們的規(guī)范設(shè)置為?"./test/specs/**/*.js"
?,所以讓我們現(xiàn)在創(chuàng)建一個(gè)規(guī)范文件。
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: