gpt4 book ai didi

testing - Angular : e2e tests with Karma Scenario Test Runner using cached source?

转载 作者:行者123 更新时间:2023-11-28 20:06:22 25 4
gpt4 key购买 nike

我正在尝试使用 Karma Scenario Test Runner 设置一些 AngularJS e2e 测试。我对源文件做了一些修改,但 Karma 在测试时似乎没有使用这些最新版本。

在源文件中,我为一些元素添加了 id。 Karma 仍然找不到它们,所以我在 e2e 测试中添加了一个暂停,这样我就可以在测试运行器的当前页面上标记和“检查元素”(使用 Chrome)。源代码似乎是正确的,只是缺少最新的更改,即 ID 不存在。那么这里发生了什么?我是否需要明确告诉 Karma 文件已以某种方式更新?

最佳答案

您可以通过强制 angularjs 清除应用程序缓存来解决此问题:

app.run(function($rootScope, $templateCache) {
$rootScope.$on('$viewContentLoaded', function() {
$templateCache.removeAll();
});
});

关于testing - Angular : e2e tests with Karma Scenario Test Runner using cached source?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18187038/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com