quixote icon indicating copy to clipboard operation
quixote copied to clipboard

Test pseudo elements

Open hrishikeshpotdar91 opened this issue 5 years ago • 3 comments

Edit by jamesshore: See below for a technique for testing psuedo elements.

I'm trying to fetch ::before's css of an element but i always get the following error

"Expected one element to match '.callout .alert::before', but found 0"

this is what I'm doing

callout_icon = frame.get('.callout .alert::before');

can you help me doing this the right way

hrishikeshpotdar91 avatar May 08 '19 16:05 hrishikeshpotdar91

Unfortunately, there's no way to test pseudo-elements at this time.

jamesshore avatar May 09 '19 21:05 jamesshore

I was able to test pseudo-elements like this

callout__primary = frame.get('.callout .primary');

expect(window.getComputedStyle(callout__primary.toDomElement(), '::before').getPropertyValue('content')).to.be('"\􎀼"')

This article helped me https://davidwalsh.name/pseudo-element

hrishikeshpotdar91 avatar May 10 '19 04:05 hrishikeshpotdar91

Very interesting! I'll re-open this as a feature request for the future.

jamesshore avatar May 10 '19 06:05 jamesshore