///<reference types="cypress" />
const { should } = require("chai");
describe("测试动态忽略测试用例", function(){
context("test_01", function(){
it("动态跳过用例", function(){
if (Cypress.env('flag')==1){
cy.log("测试通过");
expect("foo").to.be.a('string');
expect([1, 2, 3]).to.have.members([2, 1, 3]);
}
else{
console.log("测试失败");
cy.log("测试失败") //跳过时,cy相关的命令不会被执行
this.skip();
}
});
it("测试1=1", function(){
expect(1).to.equal(1);
});
});
});
执行命令 yarn cypress:open —env flag=1