【问题标题】:Clip image did not apply in typescript cypress剪辑图像不适用于 typescript cypress
【发布时间】:2022-11-19 01:22:10
【问题描述】:

当我尝试使用此代码调整快照大小时,它不会调整控件的剪辑大小,而是捕获对快照的完全控制

   cy.xpath('//div[@id="gis-1"]').toMatchImageSnapshot({
        name:"test1",
        clip:{width: 400, height: 300,x: 20, y: 20} 
    });

在我的 cypress.json 中配置

 {
"env": {
      "dssecurity_url": "<dssecurity>",
      "connection_url": "<connection>",
      "cypress-plugin-snapshots": {
        "autoCleanUp": false,            
        "autopassNewSnapshots": true,    
        "diffLines": 3,                  
        "excludeFields": [],             
        "ignoreExtraArrayItems": false, 
        "ignoreExtraFields": false,      
        "normalizeJson": true,          
        "prettier": true,                
        "imageConfig": {
          "createDiffImage": true,       
          "resizeDevicePixelRatio": true,
          "threshold": 0.01,             
          "thresholdType": "percent"     
        },
        "screenshotConfig": {            
          "blackout": [],
          "capture": "fullPage",
          "clip": null,
          "disableTimersAndAnimations": true,
          "log": false,
          "scale": false,
          "timeout": 30000
        },
        "serverEnabled": true,           
        "serverHost": "localhost",       
        "serverPort": 2121,              
        "updateSnapshots": false,        
        "backgroundBlend": "difference"  
      }
},
    "viewportHeight": 760,
    "viewportWidth": 1200,
    "ignoreTestFiles": [
      "**/__snapshots__/*",
      "**/__image_snapshots__/*"
    ]
    

}

有谁知道如何修理它?非常感谢

【问题讨论】:

  • 请围绕您收到的错误添加更多详细信息——“它不起作用”不够具体。

标签: typescript xpath cypress snapshot


【解决方案1】:

答案就在那里:github.com/meinaart/cypress-plugin-snapshots/issues/152

再见。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-09-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-14
    • 2015-08-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多