javascript - 在 testcafe 测试中模拟没有互联网连接

标签 javascript angular service-worker e2e-testing testcafe

我们有一个启用了 service worker 的 SPA。我们需要创建一个自动化测试,以查看在离线/无互联网连接期间正常功能是否仍然有效。我们的端到端测试平台是 testcafe,我们不知道如何让 testcafe 做这个。

请指导我们找到实现方法。

最佳答案

TestCafe 不提供任何API 来模拟离线模式。但是,您的想法听起来很有趣,因为某些浏览器具有开箱即用的类似离线选项。我建议您在 TestCafe GitHub repo 提交请求.如果有此功能可用,我会更新此答案。

关于javascript - 在 testcafe 测试中模拟没有互联网连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52528899/

相关文章:

javascript - 使用 ReadableStream 和 Response 从 Service Worker 的 fetch 事件返回 HTML

javascript - 通过遏制 react 组件中的提升状态

javascript - 无法检测到已更改的 ID

JavaScript this.todoList.filter 不是函数

angular - 是否可以在不从 DOM 读取的情况下在 Angular 中读取元素的文本内容?

javascript - 在 lodash 中使用双 groupBy

html - Angular 2 : Date Format Textbox ngModel doesn't work

google-chrome - 为什么 Chrome 一直在控制台中显示 "Site cannot be installed: the page is not served from a secure origin"?

java - 如何将对象的Arraylist转换为Javascript?

javascript - 如何使用 Service Worker 或缓存对象通过 JavaScript 设置缓存过期时间