Skip to content

Commit b55c688

Browse files
committed
Fix flaky test showing NS_BINDING_ABORTED in Firefox
1 parent e703754 commit b55c688

3 files changed

Lines changed: 4 additions & 42 deletions

File tree

server/reportmanager/templates/layouts/layout_base.html

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -32,46 +32,6 @@
3232
<script src="{% static 'js/params.js' %}"/></script>
3333
<script src="{% static 'js/cookie-csrf.js' %}"/></script>
3434

35-
<script>
36-
(() => {
37-
const notify_badge_class = 'badge';
38-
const notify_api_url = '/inbox/notifications/api/unread_count/';
39-
const notify_fetch_count = '5';
40-
const notify_refresh_period = 0;
41-
const consecutive_misfires = 0;
42-
43-
function fill_notification_badge(data) {
44-
const badges = document.getElementsByClassName(notify_badge_class);
45-
for (let i = 0; i < badges.length|0; i++) {
46-
badges[i].innerHTML = data;
47-
}
48-
}
49-
50-
function fetch_api_data() {
51-
fetch(notify_api_url+'?max='+notify_fetch_count, {credentials: 'same-origin'})
52-
.then(response => {
53-
if (response.ok) {
54-
response.json()
55-
.then(data => {
56-
fill_notification_badge(data.unread_count);
57-
})
58-
if (notify_refresh_period) {
59-
setTimeout(fetch_api_data, notify_refresh_period);
60-
}
61-
} else {
62-
swal('Oops', E_SERVER_ERROR, 'error');
63-
console.debug(response);
64-
}
65-
})
66-
.catch(e => {
67-
fill_notification_badge('!');
68-
});
69-
}
70-
71-
document.addEventListener("DOMContentLoaded", fetch_api_data)
72-
})()
73-
</script>
74-
7535
{% endblock js%}
7636
{% if debug %}
7737
<script>

tests/e2e/page_objects/base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ def __init__(self, page, live_server):
1212

1313
def navigate(self):
1414
"""Navigate to this page's URL."""
15+
if self.page.url != "about:blank":
16+
self.page.wait_for_load_state("networkidle")
1517
self.page.goto(f"{self.live_server.url}{self.url}")

tests/e2e/page_objects/login.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ def login(self, email, password):
1717
self.navigate()
1818
self.username_input.fill(email)
1919
self.password_input.fill(password)
20-
self.submit_button.click()
21-
self.page.wait_for_load_state("networkidle")
20+
with self.page.expect_navigation():
21+
self.submit_button.click()
2222

2323
assert not self.page.url.endswith("/login/"), (
2424
f"Login failed: still on login page ({self.page.url})"

0 commit comments

Comments
 (0)