tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_1994571_chick-fil-a_com.py (939B)


      1 import pytest
      2 
      3 URL = "https://www.chick-fil-a.com/careers"
      4 ICONS_CSS = ".wp-pattern-multi-column-icon-content figure>img"
      5 
      6 
      7 async def are_icons_stretched(client):
      8    await client.navigate(URL, wait="none")
      9    client.await_css(ICONS_CSS, is_displayed=True)
     10    return client.execute_script(
     11        """
     12        const icon_imgs = document.querySelectorAll(arguments[0]);
     13        for (const img of icon_imgs) {
     14          const box = img.getBoundingClientRect();
     15          const actual_ratio = box.height / box.width;
     16          const expected_ratio = img.naturalHeight / img.naturalWidth;
     17          if (!isNaN(expected_ratio) && parseInt(actual_ratio * 10) !== parseInt(expected_ratio * 10)) {
     18            return true;
     19          }
     20        }
     21        return false;
     22      """,
     23        ICONS_CSS,
     24    )
     25 
     26 
     27 @pytest.mark.asyncio
     28 @pytest.mark.without_interventions
     29 async def test_regression(client):
     30    assert not await are_icons_stretched(client)