describe('参数化案例,输入不同的值', function() { // 定义测试数据 var testdatas = ["北京", "上海", "南京"] // 前置-打开浏览器 before(() => { cy.visit('https://www.baidu.com') }) // 参数化 testdatas.forEach((event) => { it("百度输入框功能", function () { cy.get('#kw').type(event) .should('have.value', event) .clear() .should('have.value', '') }) }) })