【问题标题】:Testing a chrome extension using Testcafe with switchToIframe使用带有 switchToIframe 的 Testcafe 测试 chrome 扩展
【发布时间】:2018-10-12 16:37:54
【问题描述】:

我目前在 chrome 中的 testcafe 上运行了一个扩展,方法是在 chrome 上安装扩展并运行:testcafe chrome:userProfile test.js

我的扩展中的content_script 注入了一个指向web_accessible_resource index.html 资产的iframe。但是,当我使用 t.switchToIframe 切换到 iframe 上下文时,testcafe 会返回“您要切换到的 iframe 的内容未加载”

据我所见,当它的格式为chrome-extension://[PACKAGE ID]/[PATH]) 时,testcafe-hammerhead 似乎没有重写 iframe src,所以我尝试将 url 更改为指向一个 url,即 localhost:8080/index。 html 但这也不起作用。

如果我创建一个 html 文件,使用 js 文件注入 iframe,我就可以让测试运行并与 iframe 交互。因此,我认为这与内容脚本的运行方式以及它们如何将内容注入 DOM 有关。

还有其他人遇到过这个问题/对如何为一般扩展编写测试有更好的建议吗?

谢谢

【问题讨论】:

    标签: testing iframe google-chrome-extension automated-tests testcafe


    【解决方案1】:

    很遗憾,TestCafe 不支持浏览器扩展测试。 TestCafe 是为跨浏览器 HTML5 网络应用测试而设计的,因此它需要进行大量改进以涵盖特定于浏览器的扩展 API。

    我建议您在 https://github.com/DevExpress/testcafe 存储库中创建一个问题并为其添加 +1。如果它获得足够的选票,我们可能会考虑它的实施。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-12-18
      • 2021-03-07
      • 2011-02-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多