timezone - 运行测试时如何设置赛普拉斯的其他时区?
问题描述
cy.clock()
cy.visit('http://localhost:3333')
cy.get('#search').type('Acme Company')
cy.tick(1000)
// more test code here
// restore the clock
cy.clock().then((clock) => {
clock.restore()
})
运行测试时如何在赛普拉斯中设置时区?我在越南,我的时区是 GMT+7 当我运行测试时,我希望我的测试在时区 GMT+8 运行。
解决方案
要设置现在的时间戳,您可以使用:
const now = new Date(Date.UTC(2021, 1, 26)).getTime();
cy.clock(now);
文档中的更多信息:cy.clock() - 现在
推荐阅读
- css - 更改角材料文本框的原色
- webhooks - 从代码为 Jenkins 多分支管道配置 webhook
- java - Android 应用程序在 Android Studio 模拟器中不断崩溃
- java - diff.getYears() 返回 0。根据 LocalDate 出生日期计算年龄
- java - 如何基于另一个本地存储通过 selenium 在本地存储中正确写入数据?
- java - 如何使用 Mockito 模拟由 Spring 应用程序上下文创建的对象以进行单元测试覆盖?
- vue.js - NuxtJS 与 GlideJS 在克隆中加载组件丢失组件
- django-rest-framework - 在 django rest 中自动生成随机用户名
- ios - 我可以重复使用 Range
在不同的字符串之间还是应该使用 NSRange? - mongodb - mongodb group by where 字段不等于 max