【发布时间】:2021-11-16 06:11:47
【问题描述】:
我的 cypress 测试场景中有一些全局变量。
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”测试中跳过该检查,但我仍然需要在程序的其余部分运行它。我不想在每次测试中都写后果函数,因为它很麻烦而且总体上不干净。有人有什么建议吗?
【问题讨论】:
标签: javascript automation automated-tests cypress cypress-component-test-runner