如何测试标题是否以全长显示而不是用带柏树的虚线显示?
How do test the title is showing in full length and not displaying with a dotted line with cypress?
我是使用 cypress 的新手。我想测试任何长度的标题文本是否完全显示完整长度而不是虚线。我测试了如下标题,但我仍然不知道如何检查长标题是否显示为虚线!!感谢您的帮助。
cy.get(selectors.Content)
.find(selectors.dataComponent('title'))
.should('be.visible')
.and('not.be.empty')
如果你想测试没有省略号,试试
cy.get(selectors.Content)
.find(selectors.dataComponent('title'))
.should('be.visible')
.and('not.be.empty')
cy.get(selectors.Content)
.find(selectors.dataComponent('title'))
.invoke('text')
.should('not.contain', '...')
或更严格,
cy.get(selectors.Content)
.find(selectors.dataComponent('title'))
.invoke('text')
.should(title => expect(title.endsWith('...')).to.eq(false))
如果你知道全长,
cy.get(selectors.Content)
.find(selectors.dataComponent('title'))
.invoke('text')
.should('have.length', 20)
我是使用 cypress 的新手。我想测试任何长度的标题文本是否完全显示完整长度而不是虚线。我测试了如下标题,但我仍然不知道如何检查长标题是否显示为虚线!!感谢您的帮助。
cy.get(selectors.Content)
.find(selectors.dataComponent('title'))
.should('be.visible')
.and('not.be.empty')
如果你想测试没有省略号,试试
cy.get(selectors.Content)
.find(selectors.dataComponent('title'))
.should('be.visible')
.and('not.be.empty')
cy.get(selectors.Content)
.find(selectors.dataComponent('title'))
.invoke('text')
.should('not.contain', '...')
或更严格,
cy.get(selectors.Content)
.find(selectors.dataComponent('title'))
.invoke('text')
.should(title => expect(title.endsWith('...')).to.eq(false))
如果你知道全长,
cy.get(selectors.Content)
.find(selectors.dataComponent('title'))
.invoke('text')
.should('have.length', 20)