首页 > 解决方案 > 使用 TestCafe 和 Electron,有没有办法让 Electron 应用程序自行关闭而不会挂起 TestCafe?

问题描述

我需要从 Electron 应用程序 UI 中关闭我们的 Electron 应用程序。但是,当我这样做时,TestCafe 经常挂起,因为它很可能想要关闭应用程序本身并在内部执行某种清理。

我尝试了各种解决方案,包括破解 TestCafe 源本身以及在各种 after 和 afterEach 回调中关闭 UI,但没有找到可靠的解决方案。有时 TestCafe 会优雅地关闭,有时它会因错误而挂起:

ERROR The Electron 3.0.2 / Windows 10 browser disconnected. This problem may appear when a browser hangs or is closed, or due to network issues.

有没有一种方法可以让被测试的 Electron 应用程序自行关闭而不会挂起 TestCafe?任何帮助表示赞赏。

标签: testingautomated-testselectrone2e-testingtestcafe

解决方案


推荐阅读