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
trying to fix flaky spec through a more dynamic waiting approach
Jonas Jabari6082e6dd8b1e
diff --git a/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts b/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.tsindex 8298575570f..3d698c35ea8 100644--- a/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts+++ b/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts@@ -56,6 +56,7 @@ export default class IndexController extends Controller {this.handleInitialScroll();this.startPolling();this.populateRescuedEditorContent();+ this.markAsConnected();const context = await window.OpenProject.getPluginContext();this.turboRequests = context.services.turboRequests;@@ -65,6 +66,15 @@ export default class IndexController extends Controller {this.rescueEditorContent();this.removeEventListeners();this.stopPolling();+ this.markAsDisconnected();+ }++ private markAsConnected() {+ (this.element as HTMLElement).dataset.stimulusControllerConnected = 'true';+ }++ private markAsDisconnected() {+ (this.element as HTMLElement).dataset.stimulusControllerConnected = 'false';}private setLocalStorageKey() {diff --git a/spec/features/activities/work_package/activities_spec.rb b/spec/features/activities/work_package/activities_spec.rbindex 4fc189a4b6d..22860f15115 100644--- a/spec/features/activities/work_package/activities_spec.rb+++ b/spec/features/activities/work_package/activities_spec.rb@@ -366,7 +366,6 @@ RSpec.describe "Work package activity", :js, :with_cuprite, with_flag: { primeriit "shows the comment of another user without browser reload", :aggregate_failures do# simulate member creating a comment- sleep 1 # the comment needs to be created after the component is mountedfirst_journal = create(:work_package_journal, user: member, notes: "First comment by member", journable: work_package,version: 2)diff --git a/spec/support/pages/work_packages/full_work_package.rb b/spec/support/pages/work_packages/full_work_package.rbindex d131a234e92..8fd650b0c97 100644--- a/spec/support/pages/work_packages/full_work_package.rb+++ b/spec/support/pages/work_packages/full_work_package.rb@@ -58,6 +58,8 @@ module Pagesdef wait_for_activity_tabexpect(page).to have_test_selector("op-wp-activity-tab", wait: 10)+ # wait for stimulus js component to be mounted+ expect(page).to have_css('[data-test-selector="op-wp-activity-tab"][data-stimulus-controller-connected="true"]')endprivate