English 中文(简体)
Cypress - Screenshots and Videos
  • 时间:2024-03-24 09:08:31

Cypress - Screenshots and Videos

Previous Page Next Page  

风暴可以在屏幕和视频上进行。 首先,让我们理解“旋风”如何能够帮助掌握屏幕。

Screenshots

我们既能抓住整页,又能用“旋风”中的屏幕照相。

除此以外,“旋风”还具有内在特征,可捕捉测试失败的屏幕。 为了掌握一个特定情景的屏幕,我们使用了指挥屏幕。

Screenshot Implementation

在Cypress实施屏幕示意图如下:


describe( Tutorialspoint Test , function () {
   // test case
   it("Scenario 1", function () {
      //URL launched
      cy.visit("https://the-internet.herokuapp.com/javascript_alerts")
      //complete page screenshot with filename - CompletePage
      cy.screenshot( CompletePage )
      //screenshot of particular element
      cy.get( :nth-child(2) > button ).screenshot()
   });
});

产出如下:

Cpck for JS Confirm

执行记录显示,收集了完整的页面屏幕(档案名称为完整分类.png),并放映了某一特定内容(JS Confirm)。

These screenshots got captured inside the screenshots folder (in the plugins folder) within the project. The location where the screenshots got captured, can be modified by changing the Global configurations.

完整的Page.png文档为全页图像制作。

CompletePage.png

收集了JS Confirm的Thton Cpck的屏幕。

Screenshot of the Button

在“测试航道”栏中,参数屏幕对RunFailure设定了违约的真正价值。 由于这些原因,总是为失败测试而摄取屏幕。

此外,屏幕灯光灯光灯参数具有光压/透镜的价值。 因此,屏幕显示器在屏幕上进行。

Screenshots Folder Parameter

为了掌握不成功的屏幕,我们必须在电压中增加以下数值。 json file -


Cypress.Screenshot.defaults({
   screenshotOnRunFailure: false
})

Videos

录像带的“Cypress”通过测试进行。 这些材料储存在项目内的录像带上。

一俟气旋风暴测试与以下所述指挥进行:


node_modules/.bin/cypress run

我们获得奥塞罗语以及录像、压缩细节的位置,等等。

Location of the Video

我们在该项目的同一地点获得相应的录像。

Video Capture Feature

为了消除录像带,我们必须在电压中增加以下价值。 json file -


{
   "video": false
}
Advertisements