Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cypress断言具有.length;大于数字错误_Cypress - Fatal编程技术网

Cypress断言具有.length;大于数字错误

Cypress断言具有.length;大于数字错误,cypress,Cypress,我是Cypress的新手,我写了一个简单的测试: /// <reference types="Cypress" /> describe('brand workflow', () => { it('List brands', () => { cy.login().then(() => { cy.visit('/brands'); cy.listBrands().then((

我是Cypress的新手,我写了一个简单的测试:

/// <reference types="Cypress" />

describe('brand workflow', () => {
    it('List brands', () => {
        cy.login().then(() => {
            cy.visit('/brands');

            cy.listBrands().then(() => {
                // TODO: Test the table functions

                cy.get('[data-cy=data-table-row]').should('have.length', '25');
                cy.contains('[data-cy=pagination]', '50').click();

                cy.get('[data-cy=data-table-row]').should('have.length', '50');
                cy.contains('[data-cy=pagination]', 'All').click();

                cy.get('[data-cy=data-table-row]').should('have.length.greaterThan', '50');
            });
        });
    });
});
//
描述('品牌工作流程',()=>{
it('列出品牌',()=>{
cy.login()。然后(()=>{
cy.visit(“/品牌”);
cy.listBrands()。然后(()=>{
//TODO:测试表函数
cy.get('[data cy=data table row]')。应该('have.length','25');
cy.contains(“[data cy=pagination]”和“50”)。单击();
cy.get('[data cy=data table row]')。应该('have.length','50');
cy.contains(“[data cy=pagination]”和“All”)。单击();
cy.get('[data cy=data table row]')。应该('have.length.greaterther','50');
});
});
});
});
直到这一行,
cy.get('[data cy=data table row]')。应该('have.length.greaterThan','50')引发此错误的代码:


有人知道为什么会发生这种情况吗?

错误消息说以上参数必须是数字,请重试

cy.get('[data-cy=data-table-row]').should('have.length.greaterThan', 50);
为什么字符串参数在这里工作

cy.get('[data-cy=data-table-row]').should('have.length', '25');
我的猜测是Javascript强制长度参数的类型为字符串,
'25'=='25'
为true,但在更大的比较中,
'100'>'50'
为false