• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

iplweb / bpp / 1648090b-a701-457d-9667-7939c48a5f7f

29 Aug 2025 07:22PM UTC coverage: 47.085% (-0.4%) from 47.493%
1648090b-a701-457d-9667-7939c48a5f7f

push

circleci

mpasternak
Deduplikator autorów, initial commit

161 of 793 new or added lines in 16 files covered. (20.3%)

806 existing lines in 40 files now uncovered.

19529 of 41476 relevant lines covered (47.09%)

1.51 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
src/django_bpp/selenium_util.py
1
import time
4✔
2

3
from selenium.webdriver.support.expected_conditions import staleness_of
4✔
4
from selenium.webdriver.support.ui import WebDriverWait
4✔
5

6
VERY_SHORT_WAIT_TIME = 1
4✔
7
SHORT_WAIT_TIME = 5
4✔
8
LONG_WAIT_TIME = 10
4✔
9
DEFAULT_WAIT_TIME = SHORT_WAIT_TIME
4✔
10
PAGE_LOAD_WAIT_TIME = LONG_WAIT_TIME
4✔
11

12

13
def wait_for(condition_function, max_seconds=DEFAULT_WAIT_TIME):
4✔
14
    start_time = time.time()
4✔
15
    while time.time() < start_time + max_seconds:
4✔
16
        if condition_function():
4✔
17
            return True
4✔
18
        else:
19
            time.sleep(0.1)
4✔
UNCOV
20
    raise TimeoutError(f"Timeout waiting for {condition_function.__name__}")
1✔
21

22

23
class wait_for_page_load:
4✔
24
    def __init__(self, browser, max_seconds=PAGE_LOAD_WAIT_TIME):
4✔
25
        self.browser = browser
4✔
26
        self.max_seconds = max_seconds
4✔
27

28
    def __enter__(self):
4✔
29

30
        self.old_page = self.browser.find_by_tag("html").first._element
4✔
31

32
    def __exit__(self, *_):
4✔
33
        WebDriverWait(self.browser, self.max_seconds).until(
4✔
34
            lambda x: staleness_of(self.old_page)
35
        )
36

37
        WebDriverWait(self.browser, self.max_seconds).until(
4✔
38
            lambda browser: browser.execute_script("return document.readyState")
39
            == "complete"
40
        )
41

42
        WebDriverWait(self.browser, self.max_seconds).until(
4✔
43
            lambda browser: not browser.find_by_tag("body").is_empty()
44
        )
45

46

47
def wait_for_websocket_connection(browser):
4✔
48
    WebDriverWait(browser, DEFAULT_WAIT_TIME).until(
1✔
49
        lambda browser: browser.execute_script(
50
            "return bppNotifications.chatSocket.readyState"
51
        )
52
        == 1
53
    )
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc