当我按下“运行所有规格”按钮或使用运行赛普拉斯中所有文件的运行命令时,它会按字母顺序运行所有测试文件,所以我不想要那样。
我想用我自己的规则对它们进行排序。
假设我在聊天应用程序测试中有 3 个步骤。
我想测试每一步,而不是相互绑定。我的意思是,测试自己的功能之一。我做的是如下
chat_app_connect.spec.js
describe('Server Connecting Test', () => {
it('Visit Server page', () => {
cy.visit('https://chat.page..');
});
it('Check welcome messages', () => {
cy.contains('Live Support');
cy.contains('Hello, Stranger');
});
it('Check URL and status of circle', () => {
// URL
cy.url()
.should('include', '/hello');
// Status Circle
cy.get('circle')
.should('have.class', 'positive');
});
});
Run Code Online (Sandbox Code Playgroud)
chat_connect.spec.js
import './chat_app_connect.spec.js';
describe('Chat Connecting Test', () => {
it('Type customer name', () => {
cy.get('input')
.clear()
.type('E2E Test');
});
it('Click …Run Code Online (Sandbox Code Playgroud)