如何让 testcafe 尊重 `<base>` 标签

How to make testcafe respect the `<base>` tag

我的应用程序在某个时候将 <base> 标签注入网站,然后创建一个新的 <script> 标签,其相对 src

例如设置 <base href="http://localhost:8080/chapters/de/auth/"> 并注入 <script src="build.js" type="text/javascript" /> 导致浏览器从 http://localhost:8080/chapters/de/auth/build.js 下载脚本。

当运行同一个应用在testcafe中,结果略有不同。插入的碱基是 <base href-hammerhead-stored-value="http://localhost:8080/chapters/de/auth/" href="http://localhost:1337/Lj6CFUfNF/http://localhost:8080/chapters/de/auth/">,脚本是 <script src-hammerhead-stored-value="build.js" src="http://localhost:1337/Lj6CFUfNF!s!utf-8/http://localhost:8080/account/build.js" type="text/javascript" />

突然之前的亲戚URLbuild.js变成了http://localhost:8080/account/build.js<base>

中设置的不一致

知道如何解决这个问题吗?

我是运行

测试咖啡馆:1.1.0

问题的原因在于注入 basescript 标记的顺序。 如果 script 元素在 base 元素之前注入,则会导致错误。 请在以下背景下跟踪我们的进展 https://github.com/DevExpress/testcafe/issues/3585 关于 GitHub 的问题。