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

fix running timer specs

Klaus Zanders7399522501c8
diff --git a/frontend/src/app/features/work-packages/components/wp-timer-button/wp-timer-button.component.ts b/frontend/src/app/features/work-packages/components/wp-timer-button/wp-timer-button.component.ts
index 0e7bb3a426e..d91c0c7efd5 100644
--- a/frontend/src/app/features/work-packages/components/wp-timer-button/wp-timer-button.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-timer-button/wp-timer-button.component.ts
@@ -120,7 +120,7 @@ export class WorkPackageTimerButtonComponent extends UntilDestroyedMixin impleme
}
activeForWorkPackage(entry:TimeEntryResource | null):boolean {
- return !!entry && entry.workPackage.href === this.workPackage.href;
+ return !!entry && entry.entity.href === this.workPackage.href;
}
clear():void {
diff --git a/frontend/src/app/shared/components/time_entries/timer/stop-existing-timer-modal.component.html b/frontend/src/app/shared/components/time_entries/timer/stop-existing-timer-modal.component.html
index 88336a031e9..3b035aecfa7 100644
--- a/frontend/src/app/shared/components/time_entries/timer/stop-existing-timer-modal.component.html
+++ b/frontend/src/app/shared/components/time_entries/timer/stop-existing-timer-modal.component.html
@@ -18,7 +18,7 @@
<br/>
<a
uiSref="work-packages.show"
- [uiParams]="{ workPackageId: active.workPackage.id }"
+ [uiParams]="{ workPackageId: active.entity.id }"
(click)="closeMe()"
>
#{{ active.workPackage.id }}: {{ active.workPackage.name }}
diff --git a/frontend/src/app/shared/components/time_entries/timer/timer-account-menu.component.html b/frontend/src/app/shared/components/time_entries/timer/timer-account-menu.component.html
index b9f6e7f0e05..85bcdb97e18 100644
--- a/frontend/src/app/shared/components/time_entries/timer/timer-account-menu.component.html
+++ b/frontend/src/app/shared/components/time_entries/timer/timer-account-menu.component.html
@@ -12,9 +12,9 @@
<a
class="op-timer-account-menu--wp-details"
uiSref="work-packages.show"
- [uiParams]="{ workPackageId: timer.workPackage.id }"
+ [uiParams]="{ workPackageId: timer.entity.id }"
>
- #{{ timer.workPackage.id }}: {{ timer.workPackage.name }}
+ #{{ timer.entity.id }}: {{ timer.entity.name }}
</a>
<div class="spot-divider"></div>
</ng-container>
diff --git a/modules/costs/spec/features/timer_spec.rb b/modules/costs/spec/features/timer_spec.rb
index 5dbfd03edc1..ba757fc6408 100644
--- a/modules/costs/spec/features/timer_spec.rb
+++ b/modules/costs/spec/features/timer_spec.rb
@@ -55,7 +55,7 @@ RSpec.describe "Work Package timer", :js, :selenium do
active_time_entries = TimeEntry.where(ongoing: true, user:)
expect(active_time_entries.count).to eq 1
timer_entry = active_time_entries.first
- expect(timer_entry.work_package).to eq work_package_a
+ expect(timer_entry.entity).to eq work_package_a
expect(timer_entry.hours).to be_nil
page.find(".op-top-menu-user").click
@@ -97,7 +97,7 @@ RSpec.describe "Work Package timer", :js, :selenium do
active_time_entries = TimeEntry.where(ongoing: true, user:)
expect(active_time_entries.count).to eq 1
timer_entry = active_time_entries.first
- expect(timer_entry.work_package).to eq work_package_a
+ expect(timer_entry.entity).to eq work_package_a
expect(timer_entry.hours).to be_nil
page.within(".spot-modal") { click_on "Stop current timer" }
@@ -122,7 +122,7 @@ RSpec.describe "Work Package timer", :js, :selenium do
active_time_entries = TimeEntry.where(ongoing: true, user:)
expect(active_time_entries.count).to eq 1
timer_entry = active_time_entries.first
- expect(timer_entry.work_package).to eq work_package_b
+ expect(timer_entry.entity).to eq work_package_b
expect(timer_entry.hours).to be_nil
end
end
diff --git a/spec/features/support/components/time_logging_modal.rb b/spec/features/support/components/time_logging_modal.rb
index ed031a45efa..943bb43e5db 100644
--- a/spec/features/support/components/time_logging_modal.rb
+++ b/spec/features/support/components/time_logging_modal.rb
@@ -76,9 +76,11 @@ module Components
end
end
+ # TODO: Make this aware of more entities
def expect_work_package(work_package)
title = "#{work_package.type.name} ##{work_package.id} #{work_package.subject}"
within modal_container do
+ expect(page).to have_field("time_entry_entity_type", with: "WorkPackage", type: :hidden)
expect(page).to have_css("opce-time-entries-work-package-autocompleter .ng-value", text: title, wait: 10)
end
end