【问题标题】:Cypress : How to verify the font color is not be as expected one赛普拉斯:如何验证字体颜色与预期不符
【发布时间】:2022-01-22 18:04:47
【问题描述】:

对于某些条件,我必须将字体颜色验证为红色。因此,我已经实现了以下断言来实现这一目标,

return cy.xpath(`xpathcondition`)
    .should('have.css','-webkit-text-fill-color','rgb(208, 25, 71)')

它对我有用。

我必须验证的同一件事对于其他一些条件不应该是红色的。谁能建议我如何实现这一目标

【问题讨论】:

    标签: typescript cucumber cypress bdd chai


    【解决方案1】:

    您可以使用not 断言。

    cy.xpath(xpathcondition).should(
      'not.have.css',
      '-webkit-text-fill-color',
      'rgb(208, 25, 71)'
    )
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-02
      • 1970-01-01
      • 2018-04-28
      • 1970-01-01
      • 1970-01-01
      • 2023-02-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多