我的赛普拉斯测试场景中有一些全局变量。
describe('AutoLogin Test Case',function(){
beforeEach(function(){
Cypress.Cookies.preserveOnce('_session_id')
})
afterEach(function(){
cy.get('[id="ajax_working"]',{timeout:6000}).should('not.be.visible')
})
it('input login info',function(){
cy.visit('https://***********.******.com/')
cy.get('[id^=user_username]')
.type('ChrisPbacon').should('have.value','ChrisPbacon')
cy.get('[id^=user_password]')
.type('welcome123').should('have.value','welcome123')
cy.contains('Sign In Now').click()
})
})
测试用例完成后,系统将检查“after each”函数并查找“ajax_working”......我只需要在显示的“it”测试中跳过该检查,但我仍然需要运行它程序的其余部分。我不想在每次测试中都写后果函数,因为它很麻烦而且总体上不干净。有人有任何提示吗?