在我的 Cypress 测试中,我试图断言元素的文本带有下划线。
我尝试使用以下断言:
homePage.getHeadingWidgetContent().should('have.css', 'text-decoration', 'underline');
Run Code Online (Sandbox Code Playgroud)
但实际情况却text-decoration是'underline solid rgba(0, 0, 0, 0.87)');
下面的断言通过了:
homePage.getHeadingWidgetContent().should('have.css', 'text-decoration', 'underline solid rgba(0, 0, 0, 0.87)');
Run Code Online (Sandbox Code Playgroud)
有没有一种方法可以断言text-decoration 包含“下划线”?
text-decoration是一组属性的简写。具体来说,您应该使用它的组成属性之一text-decoration-line。
homePage.getHeadingWidgetContent().should(
'have.css', 'text-decoration-line', 'underline'
);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1470 次 |
| 最近记录: |