(self)
| 5 | |
| 6 | class ProxyTests(BaseCase): |
| 7 | def test_proxy(self): |
| 8 | if self.headless or self.recorder_mode or self.browser == "safari": |
| 9 | self.goto_if_not_url("about:blank") |
| 10 | print("\n Unsupported mode for this test.") |
| 11 | self.skip("Unsupported mode for this test.") |
| 12 | settings.SKIP_JS_WAITS = True |
| 13 | self.goto("https://api.ipify.org/") |
| 14 | ip_address = self.get_text("body") |
| 15 | if "ERR" in ip_address: |
| 16 | raise Exception("Failed to determine IP Address!") |
| 17 | print("\n\nMy IP Address = %s\n" % ip_address) |
| 18 | self.goto("https://ipinfo.io/%s" % ip_address) |
| 19 | self.sleep(2) |
| 20 | self.wait_for_text(ip_address, "h1", timeout=20) |
| 21 | self.wait_for_element_present('[href="/signup"]') |
| 22 | self.wait_for_text("Hosted domains", timeout=20) |
| 23 | self.highlight("h1") |
| 24 | pop_up = '[role="dialog"] span.cursor-pointer' |
| 25 | self.click_if_visible(pop_up) |
| 26 | self.highlight("section#summary") |
| 27 | self.click_if_visible(pop_up) |
| 28 | self.highlight("section#geolocation") |
| 29 | self.click_if_visible(pop_up) |
| 30 | self.sleep(2) |
| 31 | print("Displaying Host Info:") |
| 32 | text = self.get_text("#summary").split("Hosted domains")[0] |
| 33 | rows = text.split("\n") |
| 34 | data = [] |
| 35 | for row in rows: |
| 36 | if row.strip() != "": |
| 37 | data.append(row.strip()) |
| 38 | print("\n".join(data).replace('\n"', ' "')) |
| 39 | print("\nDisplaying GeoLocation Info:") |
| 40 | text = self.get_text("#geolocation") |
| 41 | text = text.split("IP Geolocation data")[0] |
| 42 | rows = text.split("\n") |
| 43 | data = [] |
| 44 | for row in rows: |
| 45 | if row.strip() != "": |
| 46 | data.append(row.strip()) |
| 47 | print("\n".join(data).replace('\n"', ' "')) |
| 48 | self.click_if_visible(pop_up) |
| 49 | self.sleep(3) |
nothing calls this directly
no test coverage detected