【发布时间】:2019-12-20 19:50:42
【问题描述】:
我需要编写一个自定义命令来根据通过 spec.ts 文件提供的元素值执行某些步骤。我无法弄清楚如何将值 A 和 B 传递给自定义命令,如何根据 A 或 B 存储定位器值,然后使用 then 命令打印值
Spec.ts 文件
cy.writetemp(A)
cy.writetemp(B)
自定义命令
cypress.command.add(writetemp,(A) => {
cy.get("select[name='Type']").should('have.value', 'A'), then print Apple
cy.get("select[name='Type']").should('have.value', 'B'), then print Banana
【问题讨论】:
标签: cypress