【发布时间】:2020-10-13 02:15:53
【问题描述】:
我在赛普拉斯得到了这个测试,问题是它不会将任何值传递给 cypress.commands.add
Commands.js:
Cypress.Commands.add('createCustomer', (customer) => {
cy.wait(1000)
cy.get('input[name="id"]').clear()
cy.get('input[name="id"]').type(customer.cust_id)
cy.wait(1000)
cy.get('input[name="name"]').clear().type(customer.name);
})
索引.d.ts:
declare namespace Cypress {
interface Chainable<Subject> {
createCustomer(
cust_id: string,
name: string): Chainable<string>
}
}
Test.spec.ts
describe('Create customer 1st', () => {
it('first condition for customer', () => {
cy.createCustomer('A0001', 'Chappy Rose')
})
})
似乎 test.spec.ts 没有将值传递给 commands.js。
请帮忙。谢谢...
【问题讨论】: