diff --git a/cypress/integration/socket_updates.js b/cypress/integration/socket_updates.js index 38d13a500e..9f8c55b938 100644 --- a/cypress/integration/socket_updates.js +++ b/cypress/integration/socket_updates.js @@ -65,6 +65,13 @@ context("Realtime updates", () => { cy.get("@callback").should("be.called"); }); }); + + it("Progress bar", { scrollBehavior: false }, () => { + const title = "RealTime Progress"; + cy.call("frappe.tests.ui_test_helpers.publish_progress", { title }).then(() => { + cy.contains(title).should("be.visible"); + }); + }); }); function publish_realtime(args) { diff --git a/frappe/tests/ui_test_helpers.py b/frappe/tests/ui_test_helpers.py index fd0fdbdc5b..8920872069 100644 --- a/frappe/tests/ui_test_helpers.py +++ b/frappe/tests/ui_test_helpers.py @@ -642,3 +642,19 @@ def publish_realtime( docname=docname, task_id=task_id, ) + + +@whitelist_for_tests +def publish_progress(duration=3, title=None, doctype=None, docname=None): + # This should consider session user and only show it to current user. + frappe.enqueue(slow_task, duration=duration, title=title, doctype=doctype, docname=docname) + + +def slow_task(duration, title, doctype, docname): + import time + + steps = 10 + + for i in range(steps + 1): + frappe.publish_progress(i * 10, title=title, doctype=doctype, docname=docname) + time.sleep(int(duration) / steps)