test: publish_progress ui test
This commit is contained in:
parent
5850176066
commit
4ece3da47d
2 changed files with 23 additions and 0 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue