node.js - 如何使用 Spectron 执行 getPath?
问题描述
在我的 Electron 应用程序中,我remote.app.getPath('documents'
用来获取用户当前文档目录的路径。我也使用 Spectron 并且想在我的测试中访问这个目录。
在我的 Spectron 测试中执行此功能的最佳方法是什么?
不幸remote.app
的是未定义,因此不可用,而且Application
它本身也没有任何功能。
test.beforeEach(async (t) => {
(t.context as any).app = new spectron.Application({
path: electronPath,
args: [appPath]
});
// how to call getPath here?
return (t.context as any).app.start();
});
解决方案
推荐阅读
- java - BitSet over List、Set 的用例
- ruby-on-rails - 如何使用 Rails Validations 允许和属性变量成为两个值之一?
- java - 扫描仪上的 NoSuchElementException,我该如何摆脱它?
- javascript - 有没有办法在 Safari 的光标插入符号后面发送 textarea 占位符文本?
- java - 为不同的用户重复相同的变量
- r - Shiny:将焦点设置为 modalDialog 中的输入
- javascript - Raycaster 没有检测到threejs 中的整个几何图形
- c++ - 我可以只映射一个文件并修改它而不回写吗?
- python - 需要从另一个 txt 文件在现有 txt 文件中创建一个新列
- r - 如何根据多列值(重复值和字符串值)从 tibble 中删除行