繁体   English   中英

带有 Electron 的 TestCafe 抛出“Uncaught TypeError: Cannot read property 'source' of undefined”

[英]TestCafe with Electron throwing "Uncaught TypeError: Cannot read property 'source' of undefined"

问题

当我使用 testcafe-electron-browser-provider 插件运行 TestCafe 并且测试卡在“正在加载网页”时,我在 devtools 中收到以下错误。

Uncaught TypeError: Cannot read property 'source' of undefined

任何人看到这个问题或知道如何解决它?

环境:

  • electron:“9.3.2,”
  • 节点:“12.18.2”,
  • 测试咖啡厅:“1.9.4”,
  • testcafe-browser-provider-electron:“0.0.15”
  • 操作系统:Windows 10

截图:

代码片段

错误:

backend.js:5206 Uncaught TypeError: Cannot read property 'source' of undefined
at e (backend.js:5206)
at l (hammerhead.js:15)
at t.r._onWindowMessage (hammerhead.js:7)
at n (hammerhead.js:15)
at i (hammerhead.js:8)
at hammerhead.js:7

我的 testcafe 配置文件:

module.exports = {
src: '/test/specs/e2etest.js',
mainWindowUrl: './build/index.html',
appPath: './',
};

我的 e2etest.js 文件:

import { Selector } from 'testcafe';

fixture `TestCafe Electron Trial`
         .page('../../build/index.html');

test('check title', async (t) => {
    await t.expect(Selector('title').innerText).eql('Electron Application');
});

test.skip('open file menu open project', async (t) => {
    await t.click("[data-test-id='fileControls-fileMenu']");
    await t.click(Selector('span').withText('Open project'));
    await t.click("[data-test-id='openFileDialog-browse']");
});

在测试执行期间使用浏览器的开发工具可能会导致错误。 这是一个已知问题,在TestCafe 文档中进行了描述。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM