赛普拉斯确认对话框

问题描述 投票:0回答:1

我正在为我的应用程序的一部分编写测试用例,其中涉及应用程序重新启动。Durring应用程序重新启动窗口。出现确认对话框,必须重新启动应用程序。现在我有一个问题要在赛普拉斯中模拟,所以我的问题是:

如何在赛普拉斯测试的窗口确认对话框中执行“确定”按钮操作?

谢谢您!

automated-tests cypress
1个回答
0
投票

我需要minimal, reproducible example。但是,如果在重新加载页面后没有其他外部效果。.url不变,DOM不变,等等,那么您应该声明属性。

可能是沿着这些方向的东西:

`it('reloads', () => {
  cy.visit('index.html')

  // mark our window object to "know" when it gets reloaded
  cy.window().then(w => w.beforeReload = true)

  // initially the new property is there
  cy.window().should('have.prop', 'beforeReload', true)

  cy.get('#button').click()

  // after reload the property should be gone
  cy.window().should('not.have.prop', 'beforeReload')
})`
© www.soinside.com 2019 - 2024. All rights reserved.