I would say this solution might work just fine for you Ollin Boer Bohan's answer
One other solution is to check if your element has a z-index attribute with toHaveCss and compare its z-index to other elements that exists in the same div / section