[英]write multiple tests (it) in single .spec.ts : Cypress
我正在尝试在单个 spec.ts 文件(Angular + NX 项目)中编写多个测试(它块)。 我的问题是在执行第一个测试之前,第二个测试开始执行,这阻止了第一个测试的执行。 需要一些帮助。
在下面的示例中,第二个它与第一个一起执行。
import { login } from '../support/util';
/// <reference types="cypress-xpath" />
describe('merkur helper json-management functionality', () => {
before(() => cy.visit(Cypress.env('baseUrl')));
it('logs in and goto json-management module', async () => {
const uuid = () => Cypress._.random(0, 1e6)
const id = uuid()
const testFormName = `testname${id}`
login('sadmin', '87654321');
cy.wait(3000);
cy.visit(`${Cypress.env('CYPRESS_BASE_URL')}/#/json-management`);
cy.wait(1000);
cy.location('href').should('include', '/json-management');
cy.wait(1000);
});
it('should go into a distributor modules section', async () => {
cy.log('++++++++++++++++++++++++++++++++++++++')
});
});
您不应该在 it 块上使用 async()。 这是在柏树中阻塞的典型测试
describe('My First Test', () => {
it('Does not do much!', () => {
expect(true).to.equal(true)
})
})
您可以阅读有关文档的更多详细信息
https://docs.cypress.io/guides/getting-started/writing-your-first-test#Write-your-first-test
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.