在Cypress中,我试图计算包含文本的元素(在本例中是li中有多少个按钮)。当使用"contains“时,返回的项目数总是等于一个,因为"contains”只给出包含搜索文本的文档中的第一个项。
cy.get('li')
.contains('button', 'Submit')
.its('length')
.then(elLength => {
// I want to test he
我有一个字段,您需要在其中为应用程序写一个名称。如果我试图通过类在Cypress中找到这个字段,我会得到一个错误:
cy.type() can only be called on a single element. Your subject contains 40 elements.
如果元素没有"id、type“等,我应该如何引用它?
<div class="app-name-option"><label>App Name</label><input class="form-control" value=
亲爱的堆栈溢出成员,我在cypress.io中测试我们的网页时遇到了一个问题--我正在使用jquery中的$().each()函数进行迭代,并试图在表行中找到一个特定的元素,并试图使它“突出显示或‘选中’。”最疯狂的是,当我尝试加入条件部分时,比如:
let number = $("#idOfSomething").text(); // Here i store the text from a dynamic label
// which get its value from db
if(
我是Cypress的新手,我正在使用他们的todo app示例,我想测试我们可以编辑一个字段的事实(双击它,键入,验证)
// use the example from Cypress for the todo app
describe('example to-do app', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/todo')
})
it('can edit a todo items', () => {
/
无法将autoId值导入jobId对象,这里的localStorage autoId是一个字符串。有人能告诉我这里的问题吗?我试图基于jobId找到表行,并检查jobRow [columnPosition] == value是否断言它.
注意:我正在尽可能地优化和减少代码行。
let tableDatacy = "Reports_Table";
let columnName= "Customer";
let checkCase = "should";
let value = "Main Customer";
在Cypress.io测试中,在应用过滤器后检查表格中显示的'data‘时,它会抛出"CypressError: Timed out read : Cannot read property 'eq’of undefined“。有人能建议如何解决以下测试中的问题吗?下面添加了表格HTML图像。
describe('Filter Test', function() {
it.only('Check if the records are filtered successfully', function() {
cy.vi
我希望像这样创建一个定制的Cypress find命令来利用data-test属性。
cypress/support/index.ts
declare global {
namespace Cypress {
interface Chainable {
/**
* Custom command to get a DOM element by data-test attribute.
* @example cy.getByTestId('element')
*/
getByTestId(selecto
我的团队正在使用react-joyride在我们的react应用程序中进行特性浏览。本质上,react-joyride在整个DOM中用非常高的z-index和半透明(rgba(0, 0, 0, 0.3))颜色覆盖一个<div>。这会使页面看起来“褪色”,并使其不可交互(其他几个<div>用于突出显示页面的一小部分并呈现工具提示)。
我正在使用@testing-library/cypress为这个特性之旅编写一个集成测试。使用cy.get(),我可以在<div>下选择DOM元素,但是findByText()在Unable to find an element
我有多个带有id features-#####和features-#####的div元素,其中#是一个动态图形。
如何让Cypress找到id features-的匹配部分的所有元素,然后以编程的方式单击第一个或第二个元素?
这是我到目前为止所做的,但是我无法找到使用regex检索所有元素的hwo,然后以编程方式处理它们。
describe('builder features component', () => {
it('should allow the user to select a features component', () =&g
我有一个聊天机器人应用程序,我想测试它与Cypress。我在看这个案子,如果机器人对客户的反应是正确的话。所以我在点击后检查,我应该得到一个div,它有类、bot-message。
cy.get('.bot-message').should('have.text','I want to send invoice to my email')
CypressError: Timed out retrying: expected
[ <div.bot-message>, 3 more... ] to have text
I want to