我正在使用 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')
})
})
})
Run Code Online (Sandbox Code Playgroud)
如何测试页面上弹出的此警报?