簡體   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