【发布时间】:2021-11-16 21:03:50
【问题描述】:
我已经按照赛普拉斯文档中的示例代码设置了以下示例存储库,用于设置项目并将打字稿添加到信中: https://github.com/jacobdo2/cypress-ts-starter
我在commands.ts中添加示例命令:
Cypress.Commands.add("dataCy", (id: string) => cy.get(`[data-cy="${id}"]`));
以及index.ts中的声明:
/// <reference types="cypress" />
declare namespace Cypress {
interface Chainable {
/**
* Custom command to select DOM element by data-cy attribute.
* @example cy.dataCy('greeting')
*/
dataCy(value: string): Chainable<Element>;
}
}
在commands.ts:
【问题讨论】:
-
如果您按照说明操作但它们不起作用,您需要向维护人员提出。
标签: typescript cypress