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

Switch remaining specs under `features/activities` to cuprite

Aaron Contrerasa5d5b5c6aaa6
diff --git a/spec/features/activities/disabled_activity_spec.rb b/spec/features/activities/disabled_activity_spec.rb
index f79ac0aade5..c5221db8948 100644
--- a/spec/features/activities/disabled_activity_spec.rb
+++ b/spec/features/activities/disabled_activity_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Disabled activity', js: true do
+RSpec.describe 'Disabled activity', :js, :with_cuprite do
shared_let(:admin) { create(:admin) }
let(:project1) do
@@ -40,9 +40,11 @@ RSpec.describe 'Disabled activity', js: true do
let(:project3) do
create(:project, enabled_module_names: %i[activity])
end
+
let!(:work_package1) { create(:work_package, project: project1) }
let!(:work_package2) { create(:work_package, project: project2) }
let!(:work_package3) { create(:work_package, project: project3) }
+
let!(:wiki_page1) do
create(:wiki_page, wiki: project1.wiki)
end
diff --git a/spec/features/activities/project_attributes_activity_spec.rb b/spec/features/activities/project_attributes_activity_spec.rb
index b7ba1eae500..68507def74e 100644
--- a/spec/features/activities/project_attributes_activity_spec.rb
+++ b/spec/features/activities/project_attributes_activity_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Project attributes activities' do
+RSpec.describe 'Project attributes activity', :js, :with_cuprite do
let(:user) do
create(:user,
member_in_project: project,
@@ -36,8 +36,10 @@ RSpec.describe 'Project attributes activities' do
edit_wiki_pages
view_wiki_edits])
end
+
let(:parent_project) { create(:project, name: 'parent') }
let(:project) { create(:project, parent: parent_project, active: false, enabled_module_names: %w[activity]) }
+
let!(:list_project_custom_field) { create(:list_project_custom_field) }
let!(:version_project_custom_field) { create(:version_project_custom_field) }
let!(:bool_project_custom_field) { create(:bool_project_custom_field) }
@@ -52,8 +54,7 @@ RSpec.describe 'Project attributes activities' do
current_user { user }
- it 'tracks the project\'s activities', js: true do
- previous_project_attributes = project.attributes.dup
+ def generate_trackable_activity_on_project
new_project_attributes = {
name: 'a new project name',
description: 'a new project description',
@@ -74,7 +75,13 @@ RSpec.describe 'Project attributes activities' do
string_project_custom_field.attribute_name => 'a new string CF value',
date_project_custom_field.attribute_name => Date.new(2023, 1, 31)
}
+
project.update!(new_project_attributes)
+ end
+
+ it "tracks the project's activities" do
+ previous_project_attributes = project.attributes.dup
+ generate_trackable_activity_on_project
visit project_activity_index_path(project)
diff --git a/spec/features/activities/time_entry_activity_spec.rb b/spec/features/activities/time_entry_activity_spec.rb
index a3a3d68ee03..0498aff3232 100644
--- a/spec/features/activities/time_entry_activity_spec.rb
+++ b/spec/features/activities/time_entry_activity_spec.rb
@@ -28,7 +28,10 @@
require 'spec_helper'
-RSpec.describe 'TimeEntry activities', with_settings: { journal_aggregation_time_minutes: 0 } do
+RSpec.describe 'TimeEntry activity',
+ :js,
+ :with_cuprite,
+ with_settings: { journal_aggregation_time_minutes: 0 } do
let(:user) do
create(:user,
member_in_project: project,
@@ -46,13 +49,12 @@ RSpec.describe 'TimeEntry activities', with_settings: { journal_aggregation_time
let(:time_entry_activity2) { create(:time_entry_activity) }
let(:work_package) { create(:work_package, project:, type: project.types.first) }
let(:work_package2) { build(:work_package, project:, type: project.types.second) }
- let(:hours) { 5.0 }
let!(:time_entry) do
create(:time_entry,
project:,
work_package:,
spent_on: Time.zone.today,
- hours:,
+ hours: 5,
user:,
activity_id: time_entry_activity.id,
comments: 'lorem ipsum')
@@ -62,7 +64,7 @@ RSpec.describe 'TimeEntry activities', with_settings: { journal_aggregation_time
login_as user
end
- it 'tracks the time_entry\'s activities', js: true do
+ it "tracks the time_entry's activities" do
visit project_activity_index_path(project)
check 'Spent time'
@@ -75,6 +77,9 @@ RSpec.describe 'TimeEntry activities', with_settings: { journal_aggregation_time
expect(page).to have_link('Details')
click_link('Details')
end
+
+ wait_for_reload
+
expect(find_field('work_package_id_arg_1_val').value).to eq(work_package.id.to_s)
old_comments = time_entry.comments
@@ -108,6 +113,9 @@ RSpec.describe 'TimeEntry activities', with_settings: { journal_aggregation_time
expect(page).to have_selector('li', text: "Date changed from #{old_spent_on} to #{time_entry.spent_on}")
click_link('Details')
end
+
+ wait_for_reload
+
expect(find_field('work_package_id_arg_1_val').value).to eq(work_package2.id.to_s)
end
end
diff --git a/spec/features/activities/wiki_activity_spec.rb b/spec/features/activities/wiki_activity_spec.rb
index 37fa5dac01f..69ebdd0fbb6 100644
--- a/spec/features/activities/wiki_activity_spec.rb
+++ b/spec/features/activities/wiki_activity_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Wiki activities' do
+RSpec.describe 'Wiki Activity', :js, :with_cuprite do
let(:user) do
create(:user,
member_in_project: project,
@@ -44,7 +44,7 @@ RSpec.describe 'Wiki activities' do
login_as user
end
- it 'tracks the wiki\'s activities', js: true do
+ it "tracks the wiki's activities" do
# create a wiki page
visit project_wiki_path(project, 'mypage')
@@ -59,7 +59,6 @@ RSpec.describe 'Wiki activities' do
Journal.last.update_columns(created_at: Time.now - 5.days, updated_at: Time.now - 5.days)
# alter the page
- SeleniumHubWaiter.wait
click_link 'Edit'
editor.set_markdown('Second content')
@@ -105,6 +104,6 @@ RSpec.describe 'Wiki activities' do
visit project_activity_index_path(project)
expect(page)
- .to have_no_content('Wiki edits')
+ .not_to have_content('Wiki edits')
end
end