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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
fixing specs
Jonas Jabari75867897fc8a
diff --git a/frontend/src/app/features/work-packages/services/notifications/work-package-notification.service.ts b/frontend/src/app/features/work-packages/services/notifications/work-package-notification.service.tsindex 7044fb5d375..663336810ac 100644--- a/frontend/src/app/features/work-packages/services/notifications/work-package-notification.service.ts+++ b/frontend/src/app/features/work-packages/services/notifications/work-package-notification.service.ts@@ -33,15 +33,20 @@ import { WorkPackageResource } from 'core-app/features/hal/resources/work-packagimport { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';import { HalResource } from 'core-app/features/hal/resources/hal-resource';import { TurboRequestsService } from 'core-app/core/turbo/turbo-requests.service';-+import { ConfigurationService } from 'core-app/core/config/configuration.service';@Injectable()export class WorkPackageNotificationService extends HalResourceNotificationService {+ primerizedActivitiesEnabled:boolean;+constructor(readonly injector:Injector,readonly apiV3Service:ApiV3Service,readonly turboRequests:TurboRequestsService,+ readonly configurationService:ConfigurationService,) {super(injector);++ this.primerizedActivitiesEnabled = this.configurationService.activeFeatureFlags.includes('primerizedWorkPackageActivities');}public showSave(resource:HalResource, isCreate = false) {@@ -55,12 +60,26 @@ export class WorkPackageNotificationService extends HalResourceNotificationServiprotected showCustomError(errorResource:any, resource:WorkPackageResource):boolean {if (errorResource.errorIdentifier === 'urn:openproject-org:api:v3:errors:UpdateConflict') {- // currently we do not have a programmatic way to show the primer flash messages- // so we just do a request to the server to show it- // should be refactored once we have a programmatic way to show the primer flash messages!- void this.turboRequests.request('/work_packages/show_conflict_flash_message?scheme=danger', {- method: 'GET',- });+ if (this.primerizedActivitiesEnabled) {+ // currently we do not have a programmatic way to show the primer flash messages+ // so we just do a request to the server to show it+ // should be refactored once we have a programmatic way to show the primer flash messages!+ void this.turboRequests.request('/work_packages/show_conflict_flash_message?scheme=danger', {+ method: 'GET',+ });+ } else {+ // code from before:+ this.ToastService.addError({+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access+ message: errorResource.message,+ type: 'error',+ link: {+ text: this.I18n.t('js.hal.error.update_conflict_refresh'),+ // eslint-disable-next-line @typescript-eslint/no-misused-promises+ target: () => this.apiV3Service.work_packages.id(resource).refresh(),+ },+ });+ }return true;}diff --git a/spec/features/activities/work_package/activities_spec.rb b/spec/features/activities/work_package/activities_spec.rbindex 4861e856c00..59ddbe43574 100644--- a/spec/features/activities/work_package/activities_spec.rb+++ b/spec/features/activities/work_package/activities_spec.rb@@ -980,12 +980,13 @@ RSpec.describe "Work package activity", :js, :with_cuprite, with_flag: { primeri# we need to wait a bit before triggering the update below# otherwise the update is already picked up by the initial (async) workpackage attributes update called in the connect hook# and we wouldn't test the polling based update below- sleep 2+ sleep 2 # rubocop:disable OpenProject/NoSleepInFeatureSpecswp_page.expect_attributes(subject: work_package.subject) # check if the initial update picked up the original subject# simulate another user is updating the work package subject# this btw does behave very strangely in test env and will not assign the change to the specified user- WorkPackages::UpdateService.new(user: admin, model: work_package).call(subject: "Subject updated")+ WorkPackages::UpdateService.new(user: member, model: work_package).call(subject: "Subject updated")+ work_package.journals.reload.last.update!(user: member) # manually set the user to member# activity tab should show the updated attributeactivity_tab.expect_journal_changed_attribute(text: "Subject updated")@@ -1002,15 +1003,16 @@ RSpec.describe "Work package activity", :js, :with_cuprite, with_flag: { primeri# we need to wait a bit before triggering the update below# otherwise the update is already picked up by the initial (async) workpackage attributes update called in the connect hook# and we wouldn't test the polling based update below- sleep 2+ sleep 2 # rubocop:disable OpenProject/NoSleepInFeatureSpecswp_page.expect_attributes(subject: work_package.subject) # check if the initial update picked up the original subjectwp_page.switch_to_tab(tab: :relations)# simulate another user is updating the work package subject# this btw does behave very strangely in test env and will not assign the change to the specified user- WorkPackages::UpdateService.new(user: admin, model: work_package).call(subject: "Subject updated")+ WorkPackages::UpdateService.new(user: member, model: work_package).call(subject: "Subject updated")+ work_package.journals.reload.last.update!(user: member) # manually set the user to member- sleep 2 # wait some time to really check for a stale UI state+ sleep 2 # rubocop:disable OpenProject/NoSleepInFeatureSpecs # wait some time to really check for a stale UI state# work package page is stale as the activity tab is not active and thus no polling is donewp_page.expect_attributes(subject: work_package.subject)diff --git a/spec/features/work_packages/custom_actions/custom_actions_spec.rb b/spec/features/work_packages/custom_actions/custom_actions_spec.rbindex d2c66a06caa..afca1b64aea 100644--- a/spec/features/work_packages/custom_actions/custom_actions_spec.rb+++ b/spec/features/work_packages/custom_actions/custom_actions_spec.rb@@ -134,7 +134,10 @@ RSpec.describe "Custom actions", :js, :with_cuprite,login_as adminend- it "viewing workflow buttons" do+ # this big spec just has a different expectation when primerized_work_package_activities is enabled for the very last part+ # where the a different expectation banner would be expected+ # IMO not worth the extra computation time for the intermediate state when the feature flag is active+ it "viewing workflow buttons", with_flag: { primerized_work_package_activities: false } do# create custom action 'Unassign'index_ca_page.visit!diff --git a/spec/features/work_packages/details/inplace_editor/subject_editor_spec.rb b/spec/features/work_packages/details/inplace_editor/subject_editor_spec.rbindex e3cb1a6d074..46ae1b1b632 100644--- a/spec/features/work_packages/details/inplace_editor/subject_editor_spec.rb+++ b/spec/features/work_packages/details/inplace_editor/subject_editor_spec.rb@@ -77,7 +77,16 @@ RSpec.describe "subject inplace editor", :js, :selenium doendcontext "with conflicting modification" do- it "shows a conflict when modified elsewhere" do+ it "shows a conflict when modified elsewhere", with_flag: { primerized_work_package_activities: true } do+ work_package.subject = "Some other subject!"+ work_package.save!++ field.display_element.click++ work_packages_page.expect_conflict_error_banner+ end++ it "shows a conflict when modified elsewhere", with_flag: { primerized_work_package_activities: false } dowork_package.subject = "Some other subject!"work_package.save!diff --git a/spec/support/pages/work_packages/abstract_work_package.rb b/spec/support/pages/work_packages/abstract_work_package.rbindex bcf09426480..751b601e3b7 100644--- a/spec/support/pages/work_packages/abstract_work_package.rb+++ b/spec/support/pages/work_packages/abstract_work_package.rb@@ -115,10 +115,12 @@ module Pagesdef ensure_page_loadedexpect_angular_frontend_initialized- expect(page).to have_css(".op-user-activity--user-name",- text: work_package.journals.last.user.name,- minimum: 1,- wait: 10)+ unless OpenProject::FeatureDecisions.primerized_work_package_activities_active?+ expect(page).to have_css(".op-user-activity--user-name",+ text: work_package.journals.last.user.name,+ minimum: 1,+ wait: 10)+ endenddef disable_ajax_requests