tor-browser

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

test_1902402_myaccount_flypeach_com.py (1233B)


      1 import pytest
      2 
      3 URL = "https://myaccount.flypeach.com/login"
      4 LOGIN_CSS = "input[name=email]"
      5 
      6 
      7 async def visit_site(client):
      8    # the site briefly flashes the "use Chrome" popup before the page finishes loading,
      9    # so we need to watch for it, and check whether our intervention has hidden it.
     10    await client.make_preload_script(
     11        """
     12      delete navigator.__proto__.webdriver;
     13      new MutationObserver((mutations, observer) => {
     14        const search = document.evaluate(
     15          "//*[text()[contains(., 'Google Chrome')]]",
     16          document,
     17          null,
     18          4
     19        );
     20        const found = search.iterateNext();
     21        if (found) {
     22          const box = found.getBoundingClientRect();
     23          if (box.width || box.height) {
     24            alert("found");
     25            observer.disconnect();
     26          }
     27        }
     28      }).observe(document.documentElement, {
     29        childList: true,
     30        subtree: true,
     31      });
     32      """
     33    )
     34    await client.navigate(URL, wait="none")
     35 
     36 
     37 @pytest.mark.asyncio
     38 @pytest.mark.without_interventions
     39 async def test_regression(client):
     40    await visit_site(client)
     41    client.await_css(LOGIN_CSS, is_displayed=True, timeout=20)
     42    assert not await client.find_alert()