我刚刚开始在我的 React Typescript 项目中使用 Cypress。我有一些简单的测试要运行:
describe('settings page', () => {
beforeEach(() => {
cy.visit('http://localhost:3000')
});
it('starts in a waiting state, with no settings.', () => {
cy.contains('Waiting for settings...')
});
it('shows settings once settings are received', () => {
const state = cy.window().its('store').invoke('getState')
console.log(state) // different question: how do I get this to be the state and not a $Chainer?
});
});
Run Code Online (Sandbox Code Playgroud)
它在 Cypress 中运行得很好。但是我在 Webstorm 中收到 Typescript 错误,说cy
没有定义(TS 和 ESlint 错误)和describe
说all files must be …
我目前正在使用 Cypress 进行 UI 集成测试。我正在寻找在 cypress 中添加类似于标准 TestNG 的测试用例分组的方法。我在 cypress 文档中找不到任何分组功能。我确实找到了这篇文章:使用标签进行分组的链接。我正在寻找一种更简单的测试用例分组方法。
这是我的用例:我对不同的功能进行了测试,例如下面示例中的功能 1、2、3,每个功能都有不同的测试用例。我想对功能 1 等单个功能运行测试。有没有办法运行功能 1 的 test1。注意:我不是在寻找 .only 或 .skip。我想添加分组并使用 CLI 为特定组运行这些测试。以前有人从事过这些工作吗?
describe('Feature1', () => {
it('test1', () => {
})
it('test2', () => {
})
it('test3', () => {
})
})
describe('Feature2', () => {
it('test1', () => {
})
it('test2', () => {
})
it('test3', () => {
})
})
describe('Feature3', () => {
it('test1', () => {
})
it('test2', () => { …
Run Code Online (Sandbox Code Playgroud)