赛普拉斯(Cypress
我有两个开始的测试块,但第二个测试总是失败。在JS代码中,我使用socket.io
[柏树检测到您从命令中返回承诺的
“已完成”和“取消 ”之间进行更改:
cy.wait()
您在承诺中调用的CY命令是:
cy.get()] image
我的代码
describe('Logistic > History > Orders', () => {
beforeEach(() => {
cy.intercept('GET', '/v1/zones***').as('get-zones');
cy.visit('/logistic/history');
});
it('Get the first canceled order and open modal', () => {
cy.wait('@get-zones');
cy.get('.css-6j8wv5-Input:first').click().type('san Jose{enter}');
cy.get('.css-6j8wv5-Input').eq(1).click().type('canceled{enter}');
cy.get('#date-init').type('2021-01-19');
cy.get('.order-card:first').should('exist');
cy.get('.order-card:first .view-order__text').click();
cy.contains('Order #').should('exist');
});
it('Get the first completed order and open modal', () => {
cy.wait('@get-zones');
cy.get('.css-6j8wv5-Input:first').click().type('san Jose{enter}');
cy.get('.css-6j8wv5-Input').eq(1).click().type('completed{enter}');
cy.get('#date-init').type('2021-01-19');
cy.get('.order-card:first').should('exist');
cy.get(
'div.ordershistory-container > div.ordershistory-list > div.card_container:first > div:nth-child(3) > p'
).click();
cy.contains('Order #').should('exist');
});
});
I have two blocks of tests that start similar but the second one always fails. In the JS code, I'm changing between "completed" and "canceled" with socket.io
[Cypress detected that you returned a promise from a command while also invoking one or more cy commands in that promise
The command that returned the promise was:
cy.wait()
The cy command you invoked inside the promise was:
cy.get()]
IMAGE
My code
describe('Logistic > History > Orders', () => {
beforeEach(() => {
cy.intercept('GET', '/v1/zones***').as('get-zones');
cy.visit('/logistic/history');
});
it('Get the first canceled order and open modal', () => {
cy.wait('@get-zones');
cy.get('.css-6j8wv5-Input:first').click().type('san Jose{enter}');
cy.get('.css-6j8wv5-Input').eq(1).click().type('canceled{enter}');
cy.get('#date-init').type('2021-01-19');
cy.get('.order-card:first').should('exist');
cy.get('.order-card:first .view-order__text').click();
cy.contains('Order #').should('exist');
});
it('Get the first completed order and open modal', () => {
cy.wait('@get-zones');
cy.get('.css-6j8wv5-Input:first').click().type('san Jose{enter}');
cy.get('.css-6j8wv5-Input').eq(1).click().type('completed{enter}');
cy.get('#date-init').type('2021-01-19');
cy.get('.order-card:first').should('exist');
cy.get(
'div.ordershistory-container > div.ordershistory-list > div.card_container:first > div:nth-child(3) > p'
).click();
cy.contains('Order #').should('exist');
});
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论