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

Promote `work_packages/table/hierarchy/hierarchy_indent_spec.rb` to cuprite

Aaron Contreras6dc714f97229
diff --git a/spec/features/work_packages/table/hierarchy/hierarchy_indent_spec.rb b/spec/features/work_packages/table/hierarchy/hierarchy_indent_spec.rb
index 8d1fd8ec6a8..7803954a870 100644
--- a/spec/features/work_packages/table/hierarchy/hierarchy_indent_spec.rb
+++ b/spec/features/work_packages/table/hierarchy/hierarchy_indent_spec.rb
@@ -1,44 +1,41 @@
require 'spec_helper'
-RSpec.describe 'Work Package table hierarchy and sorting', js: true do
- let(:user) { create(:admin) }
- let(:project) { create(:project) }
+RSpec.describe 'Work Package table hierarchy and sorting', :js, :with_cuprite do
+ shared_let(:project) { create(:project) }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
let(:hierarchy) { Components::WorkPackages::Hierarchies.new }
let(:representation) { Components::WorkPackages::DisplayRepresentation.new }
let(:sort_by) { Components::WorkPackages::SortBy.new }
- let!(:wp_root) do
+ shared_let(:wp_root) do
create(:work_package,
project:,
subject: 'Parent')
end
- let!(:wp_child1) do
+ shared_let(:wp_child1) do
create(:work_package,
project:,
parent: wp_root,
subject: 'WP child 1')
end
- let!(:wp_child2) do
+ shared_let(:wp_child2) do
create(:work_package,
project:,
parent: wp_root,
subject: 'WP child 2')
end
- let!(:wp_child3) do
+ shared_let(:wp_child3) do
create(:work_package,
project:,
parent: wp_root,
subject: 'WP child 3')
end
- before do
- login_as(user)
- end
+ shared_current_user { create(:admin) }
it 'can indent hierarchies' do
wp_table.visit!
@@ -62,11 +59,10 @@ RSpec.describe 'Work Package table hierarchy and sorting', js: true do
# Remove first child
hierarchy.outdent! wp_child1
+ wait_for_network_idle
hierarchy.expect_hierarchy_at(wp_root, wp_child2)
hierarchy.expect_leaf_at(wp_child1, wp_child3)
- sleep 1
-
wp_child1.reload
expect(wp_child1.parent).to be_nil
@@ -96,27 +92,23 @@ RSpec.describe 'Work Package table hierarchy and sorting', js: true do
subject = wp_table.edit_field(wp_child3, :subject)
subject.update 'First edit'
+ wait_for_network_idle
wp_table.expect_and_dismiss_toaster message: 'Successful update.'
- # Wait a bit before moving
- sleep 2
-
# Indent last child
hierarchy.indent! wp_child3
+ wait_for_network_idle
wp_table.expect_and_dismiss_toaster message: 'Successful update.'
# Expect changed
hierarchy.expect_hierarchy_at(wp_root, wp_child2)
hierarchy.expect_leaf_at(wp_child1, wp_child3)
- # Wait a bit again
- sleep 2
-
subject = wp_table.edit_field(wp_child3, :subject)
subject.update 'Second edit'
+ wait_for_network_idle
wp_table.expect_and_dismiss_toaster message: 'Successful update.'
- sleep 2
wp_child3.reload
expect(wp_child3.subject).to eq 'Second edit'
expect(wp_child3.parent).to eq wp_child2