Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

start with feature tests

Klaus Zanders76e1062e1e0c
diff --git a/modules/costs/app/components/my/time_tracking/daily_entries_table.rb b/modules/costs/app/components/my/time_tracking/daily_entries_table.rb
index cdcdb70162c..8c4f9d4b1b0 100644
--- a/modules/costs/app/components/my/time_tracking/daily_entries_table.rb
+++ b/modules/costs/app/components/my/time_tracking/daily_entries_table.rb
@@ -53,19 +53,19 @@ module My
tooltip_direction: :e,
href: dialog_time_entries_path(onlyMe: true, date: options[:date]),
data: { "turbo-stream" => true },
- label: t("label_log_time"),
- aria: { label: t("label_log_time") }
+ label: t("button_log_time"),
+ aria: { label: t("button_log_time") }
))
end
def headers
[
- TimeEntry.can_track_start_and_end_time? ? [:time, { caption: "Time" }] : nil,
- [:hours, { caption: "Hours" }],
- [:subject, { caption: "Subject" }],
- [:project, { caption: "Project" }],
- [:activity, { caption: "Activity" }],
- [:comments, { caption: "Comments" }]
+ TimeEntry.can_track_start_and_end_time? ? [:time, { caption: TimeEntry.human_attribute_name(:time) }] : nil,
+ [:hours, { caption: TimeEntry.human_attribute_name(:hours) }],
+ [:subject, { caption: TimeEntry.human_attribute_name(:subject) }],
+ [:project, { caption: TimeEntry.human_attribute_name(:project) }],
+ [:activity, { caption: TimeEntry.human_attribute_name(:activity) }],
+ [:comments, { caption: TimeEntry.human_attribute_name(:comments) }]
].compact
end
diff --git a/modules/costs/app/components/my/time_tracking/time_entry_row.rb b/modules/costs/app/components/my/time_tracking/time_entry_row.rb
index d85fa6568ef..0ddcfdfe3a1 100644
--- a/modules/costs/app/components/my/time_tracking/time_entry_row.rb
+++ b/modules/costs/app/components/my/time_tracking/time_entry_row.rb
@@ -34,7 +34,7 @@ module My
def button_links
[
action_menu
- ].compact
+ ]
end
def action_menu
diff --git a/modules/costs/app/controllers/my/time_tracking_controller.rb b/modules/costs/app/controllers/my/time_tracking_controller.rb
index 2ed409eb2d7..dfc83cc71f7 100644
--- a/modules/costs/app/controllers/my/time_tracking_controller.rb
+++ b/modules/costs/app/controllers/my/time_tracking_controller.rb
@@ -136,5 +136,11 @@ module My
def mobile?
browser.device.mobile?
end
+
+ def default_breadcrumb; end
+
+ def show_local_breadcrumb
+ false
+ end
end
end
diff --git a/modules/costs/config/locales/en.yml b/modules/costs/config/locales/en.yml
index 6e0d3bf9f4c..8fa28fb6c10 100644
--- a/modules/costs/config/locales/en.yml
+++ b/modules/costs/config/locales/en.yml
@@ -59,12 +59,14 @@ en:
project: Project
user: User
work_package: Work package
+ subject: Subject
hours: Hours
comments: Comment
activity: Activity
spent_on: Date
start_time: Start time
end_time: Finish time
+ time: Time
models:
time_entry:
one: "Time entry"
diff --git a/modules/costs/spec/features/my_time_tracking_spec.rb b/modules/costs/spec/features/my_time_tracking_spec.rb
new file mode 100644
index 00000000000..3bad31bc4d4
--- /dev/null
+++ b/modules/costs/spec/features/my_time_tracking_spec.rb
@@ -0,0 +1,70 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+require_relative "../spec_helper"
+
+RSpec.describe "my time tracking", :js do
+ let(:time_zone) { "Etc/UTC" }
+ let(:user) do
+ create(:user,
+ preferences: { time_zone: },
+ member_with_permissions: {
+ project1 => %i[view_project view_time_entries log_own_time edit_own_time_entries],
+ project2 => %i[view_project view_time_entries log_own_time]
+ })
+ end
+
+ let(:project1) { create(:project_with_types) }
+ let(:project2) { create(:project_with_types) }
+ let(:work_package1) { create(:work_package, project: project1) }
+ let(:work_package2) { create(:work_package, project: project2) }
+ let!(:time_entry1) { create(:time_entry, user:, work_package: work_package1, spent_on: "2025-04-07", hours: 6.5) }
+ let!(:time_entry2) do
+ create(:time_entry, work_package: work_package1, user:, spent_on: "2025-04-09", hours: 1.0, start_time: (9 * 60) + 30,
+ time_zone:)
+ end
+ let!(:time_entry3) { create(:time_entry, user:, work_package: work_package1, spent_on: "2025-04-14", hours: 3.0) }
+ let!(:time_entry4) { create(:time_entry, user:, work_package: work_package2, spent_on: "2025-04-09", hours: 2.0) }
+ let!(:time_entry5) do
+ create(:time_entry, user:, work_package: work_package2, spent_on: "2025-04-09", hours: 1.0, start_time: (13 * 60) + 30,
+ time_zone:)
+ end
+ let!(:time_entry6) { create(:time_entry, user:, work_package: work_package2, spent_on: "2025-04-14", hours: 2.0) }
+
+ before do
+ login_as user
+ end
+
+ it "does something" do
+ allow(TimeEntry).to receive(:can_track_start_and_end_time?).and_return(true)
+ visit my_time_tracking_week_path(date: "2025-04-09", view_mode: "list")
+ # save_and_open_screenshot
+ end
+end