Testing TestCafe with Electron:确定应用程序是否在Windows桌面上可见

Testing TestCafe with Electron:确定应用程序是否在Windows桌面上可见,testing,automation,electron,e2e-testing,testcafe,Testing,Automation,Electron,E2e Testing,Testcafe,我们的Electron应用程序开始最小化到Windows托盘通知区域,即桌面上不可见 如果我试图通过或作为获取可见性信息,检查“visible”属性总是返回true 例如,无论应用程序是最小化到通知区域还是在桌面上可见,下面的选项始终返回true: if(await Selector('button', { visibilityCheck: true }).visible) console.log("VISIBLE"); else console.log("NOT VISIB

我们的Electron应用程序开始最小化到Windows托盘通知区域,即桌面上不可见

如果我试图通过或作为获取可见性信息,检查“visible”属性总是返回true

例如,无论应用程序是最小化到通知区域还是在桌面上可见,下面的选项始终返回true

if(await Selector('button', { visibilityCheck: true }).visible)
    console.log("VISIBLE");
  else
    console.log("NOT VISIBLE");
作为一个幸运儿,我还尝试检查“聚焦”属性,但无论应用程序在桌面上的可见性如何,该属性也总是返回true(至少在“主体”上)

有人知道通过TestCafe确定应用程序在Windows桌面上是否可见的可靠方法吗

谢谢
可以使用Electron的API来完成。请参阅以下文章以获取详细信息:

以下是测试代码:

从“testcafe”导入{ClientFunction};
电子版`
.第``页;
const isDocumentHidden=ClientFunction(()=>{
const remote=require('electron')。remote;
const win=remote.getCurrentWindow();
return!win.isVisible();
});
测试('is hidden',async t=>{
log(wait isDocumentHidden());
});
我检查了你项目的代码,它按预期工作