我正在使用Cypress测试数据表单,但卡在了一个在页面上显示警报的步骤上。
这是测试,但它并没有起作用。
describe('Alert is displayed with warning text', () => {
it('Assert that the alert is displayed after entering data', () => {
cy.visit('/')
cy.get('input').type('some data').blur()
cy.on ('window:alert', (text) => {
cy.wrap(text).should('eq', 'alert text')
})
})
})
我该如何测试页面上弹出的警告框?