获得了最近的需求,在这里,我需要做测试自动化的后端节点js应用程序使用谱。我想知道要达到同样的目的需要什么编程技能?
发布于 2018-09-10 03:52:34
在https://electronjs.org/spectron上查找谱文档
安装
npm install --save-dev spectron示例测试文件如下所示
const Application = require('spectron').Application
const assert = require('assert')
const electronPath = require('electron')
const path = require('path')
describe('Application launch', function () {
this.timeout(10000)
beforeEach(function () {
this.app = new Application({
path: electronPath,
args: [path.join(__dirname, '..')]
})
return this.app.start()
})
afterEach(function () {
if (this.app && this.app.isRunning()) {
return this.app.stop()
}
})
it('shows an initial window', function () {
return this.app.client.getWindowCount().then(function (count) {
assert.equal(count, 1)
})
})
})谱可以与任何测试框架一起工作。我更喜欢用摩卡。
克隆此项目以获取更多信息https://github.com/electron/spectron
https://stackoverflow.com/questions/52203930
复制相似问题