English 中文(简体)
Cypress - Prompt Pop-up Window
  • 时间:2024-03-24 09:10:42

Cypress - Prompt Pop-up Window

Previous Page Next Page  

风暴可以处理迅速的流行窗口,用户可以输入这些窗口的价值。 即时有一个案文领域,即提供投入。 为了处理迅速流行的风.,采用了风云(cy)方法。

它获得迅速标的(翻新窗口)的价值。 在确认/证明人满为患时,我们必须发动一场浏览器活动。 但是,为了迅速普及,我们必须使用cy(cy)方法。

Example

让我们看一下以下例子,在点击Cpck for JS Prompt button时,如以下所示,出现了迅速的登峰。

Cpck for JS Prompt

下面与用户投入领域一起展示。 如下文所示,图西人点迅速进入人口。

Prompt Pop-Up

你们进入——图兰点是在下台展示的。

可见于下列屏幕上:

Entered Result

Implementation

下面是关于在Cypress——展示迅速流行窗口的指挥系统。


describe( Tutorialspoint Test , function () {
   // test case
   it("Scenario 1", function () {
      //URL launch
      cy.visit("https://the-internet.herokuapp.com/javascript_alerts")
      //handpng prompt alert
      cy.window().then(function(p){
         //stubbing prompt window
         cy.stub(p, "prompt").returns("Tutorialspoint");
         // cpck on Cpck for JS Prompt button
         cy.get( :nth-child(3) > button ).cpck()
         // verify apppcation message on cpcking on OK
         cy.get( #result ).contains( You entered: Tutorialspoint )
      });
   });
});   

产出如下:

Implementation of the Commands

产出记录显示了对案文的成功核查。

You enteredTutorialspoint, is produced on cpcking OK button on prompt pop up. Also, the stub appped on the prompt window is visible on the output log.

Advertisements