翻译工作即将结束,中文版文档即将面世,特开一题,专门对在使用 Cypress 过程中遇到的的疑难杂症进行列举,以便所有人参考。
超级赞!
目前卡在持续集成这个步骤,有点头晕
Cypress 如何处理新开页面的情况?
vue 组件化的下拉框选项点击不到,一直报
CypressError: Timed out retrying: cy.click() failed because this element is not visible:
This element '
' is not visible because its parent '' has CSS property: 'display: none'Fix this problem, or use {force: true} to disable error checking.
https://on.cypress.io/element-cannot-be-interacted-with
代码实现是这样的:
cy.get('.ivu-form-item-label').contains('关联方标识').next().click()
cy.contains('ul li', '是').click()
加了 force:true 后,不报错,但是点击不生效
@jianghubren 有 HTML 源码吗? 或者你们站点如果对外开放的话,给我站点也行,帮你调试一下
在 Linux 环境下执行 npm run cysit 的命令时,报错:
root@test:/home/ln/cypress/test-quality_testing# npm run cysit
test-quality_testing@1.0.0 cysit /home/ln/cypress/test-quality_testing
node scripts/cypress.js --env-sit
It looks like this is your first time using Cypress: 4.5.0
✖ Verifying Cypress can run /root/.cache/Cypress/4.5.0/Cypress
→ Cypress Version: 4.5.0
err Error: Cypress failed to start.
This is usually caused by a missing library or dependency.
The error below should indicate which dependency is missing.
https://on.cypress.io/required-dependencies
If you are using Docker, we provide containers with all required dependencies installed.
(Cypress:28352): Gtk-WARNING **: 14:49:34.173: cannot open display: localhost:10.0
Platform: linux (Ubuntu Linux - 18.04)
根据这个报错信息,在安装了对应的依赖后再次执行命令行时仍报错,有人遇到过这种问题吗?
最近初学 cypress ,在使用 text() 获取文本数组时,得到的是一个 object 对象,而不是一个类似于 ["xxx","xxxxx","bbbbb"] 的数组呢。请问如何得到一个数组呢。
类似https://docs.cypress.io 页面选择语言的模拟用户点击选择的操作应该如何处理?
不需要你点击,直接用select即可:
describe("cypress首页", function() {
// 登陆
beforeEach("切换语言", function() {
cy.visit("/guides/overview/why-cypress.html#In-a-nutshell");
});
it("切换语言 > 中文", function() {
cy.get("#lang-select").select("zh-cn");
cy.get(".article-title").should(($title) => {
expect($title.first()).to.contain("为什么");
});
});
});
@ 非洲赵子龙 请问 cypress 怎么定位伪元素?