mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-15 15:38:39 +00:00
Merge pull request #56182 from mihir-kandoi/pg-fix-timesheet-summary-flaky
test(projects): fix time-of-day flaky daily-timesheet-summary test
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
# Copyright (c) 2024, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from datetime import timedelta
|
||||
|
||||
import frappe
|
||||
from frappe.utils import today
|
||||
from frappe.utils import get_datetime, today
|
||||
|
||||
from erpnext.projects.doctype.timesheet.test_timesheet import make_timesheet
|
||||
from erpnext.projects.report.daily_timesheet_summary.daily_timesheet_summary import execute
|
||||
@@ -17,6 +19,18 @@ class TestDailyTimesheetSummary(ERPNextTestSuite):
|
||||
employee = make_employee("test_employee_6@salary.com", company="_Test Company")
|
||||
timesheet = make_timesheet(employee, simulate=True)
|
||||
|
||||
# make_timesheet logs at now_datetime(); run late in the day (under the site timezone)
|
||||
# the 2h log crosses midnight and falls outside the report's `to_time <= end-of-day`
|
||||
# bound. Pin the log to a fixed mid-day window on today so the assertion is
|
||||
# time-of-day independent.
|
||||
start = get_datetime(today()) + timedelta(hours=9)
|
||||
frappe.db.set_value(
|
||||
"Timesheet Detail",
|
||||
timesheet.time_logs[0].name,
|
||||
{"from_time": start, "to_time": start + timedelta(hours=2)},
|
||||
update_modified=False,
|
||||
)
|
||||
|
||||
_columns, data = execute({"from_date": today(), "to_date": today()})
|
||||
|
||||
# Row column order: [Timesheet.name, employee, employee_name, from_time, to_time,
|
||||
|
||||
Reference in New Issue
Block a user