Cypress不允许配置测试

Cypress不允许配置测试,cypress,e2e-testing,Cypress,E2e Testing,我希望Cypress为下面散列中的每个项目自动生成一个it块。当我当前运行cypress时,它在第二个测试中表现良好,但忽略了带有while循环的测试。我如何解决这个问题?我不想为地图中的每个项目都写一个明确的it块 const testDataMappings = { 1: {e2eTestName: 'test-one'}, 2: {e2eTestName: 'test-two'}, 3: {e2eTestName: 'test-thr

我希望Cypress为下面散列中的每个项目自动生成一个it块。当我当前运行cypress时,它在第二个测试中表现良好,但忽略了带有while循环的测试。我如何解决这个问题?我不想为地图中的每个项目都写一个明确的it块

   const testDataMappings = { 
        1: {e2eTestName: 'test-one'},
        2: {e2eTestName: 'test-two'},
        3: {e2eTestName: 'test-three'},
    }
    
// Does not work
    describe('My Tests', function () {
        let i = 1;
        while (i < testDataMappings.length + 1) {
            let entry = testDataMappings[i];
            it("Should Do The Thing Correctly For" + entry.e2eTestName, () => {
                const standardCaseUrl = Cypress.config().baseUrl + "?profile_id=" + String(i);
                cy.visit(standardCaseUrl);
                cy.wait(5000);
                cy.get('.some-div-class-name').compareSnapshot(entry.e2eTestName, 0.0);
            });
            i +=1;
        }

// works
        describe('Another Describe block', function () {
            it('Should do the thing', () => {
                const standardCaseUrl = Cypress.config().baseUrl + "?profile_id=1";
                cy.visit(standardCaseUrl);
                cy.wait(5000); 
                cy.get('.some-div-class-name').compareSnapshot('some-snapshot-name', 0.0);
            });
        });
    });
const testDataMappings={
1:{e2eTestName:'测试一'},
2:{e2eTestName:'测试二'},
3:{e2eTestName:'测试三'},
}
//不起作用
描述('我的测试',功能(){
设i=1;
而(i{
const standardCaseUrl=Cypress.config().baseUrl+“?profile_id=“+String(i);
cy.visit(标准案例URL);
cy.wait(5000);
cy.get('.some div class name').compareSnapshot(entry.e2eTestName,0.0);
});
i+=1;
}
//工作
描述('另一个描述块',函数(){
它('应该做这件事',()=>{
const standardCaseUrl=Cypress.config().baseUrl+“?profile_id=1”;
cy.visit(标准案例URL);
cy.wait(5000);
cy.get('.some div类名').compareSnapshot('some-snapshot-name',0.0);
});
});
});

控制台日志似乎没有显示,因此对正在发生的事情没有太多的了解。

中有一个例子。该示例位于中,并使用
lodash
each
feedview
对象进行迭代,并动态生成每个提要的测试