function getElementStyles (selector) {
  let styles = ''
  const sel = new RegExp(selector)
  
  document.styleSheets.forEach(sheet => {
    sheet.cssRules.forEach(rule => {
      if (sel.test(rule.selectorText)) {
        const cssText = rule.style.cssText
        styles += cssText.split(';').join(';\n')
      }
    })
  })
  return styles
}
Get styles from document.styleSheets

@param {String} selector

@example className usage
 getElementStyles('.anyClassName')

@example Emotion Classname
 const [className1, className2] = [...screen.getByTestId('aspectRatioBox').classList]
 const styles = getElementStyles(`.${className1}`)
 const pseudoStyles = getElementStyles(`.${className2}:before`)