Create regression test for hierarchy toggle

https://community.openproject.com/wp/29578
pull/7079/head
Oliver Günther 6 years ago
parent a923b8fbef
commit a445aaa0cf
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 52
      modules/grids/spec/features/my/my_page_assigned_to_me_spec.rb
  2. 4
      spec/support/components/work_packages/hierarchies.rb

@ -36,6 +36,7 @@ describe 'Assigned to me embedded query on my page', type: :feature, js: true do
let!(:assigned_work_package) do
FactoryBot.create :work_package,
project: project,
subject: 'Assigned to me',
type: type,
author: user,
assigned_to: user
@ -43,6 +44,7 @@ describe 'Assigned to me embedded query on my page', type: :feature, js: true do
let!(:assigned_to_other_work_package) do
FactoryBot.create :work_package,
project: project,
subject: 'Not assigend to me',
type: type,
author: user,
assigned_to: other_user
@ -61,16 +63,61 @@ describe 'Assigned to me embedded query on my page', type: :feature, js: true do
let(:my_page) do
Pages::My::Page.new
end
let(:assigned_area) { Components::Grids::GridArea.new('.grid--area', text: 'Work packages assigned to me') }
let(:embedded_table) { Pages::EmbeddedWorkPackagesTable.new(assigned_area.area) }
let(:hierarchies) { ::Components::WorkPackages::Hierarchies.new }
before do
login_as user
end
my_page.visit!
context 'with parent work package' do
let!(:assigned_work_package_child) do
FactoryBot.create :work_package,
subject: 'Child',
parent: assigned_work_package,
project: project,
type: type,
author: user,
assigned_to: user
end
it 'can toggle hierarchy mode in embedded tables (Regression test #29578)' do
my_page.visit!
# exists as default
assigned_area.expect_to_exist
page.within(assigned_area.area) do
# expect hierarchy in child
hierarchies.expect_mode_enabled
hierarchies.expect_hierarchy_at assigned_work_package
hierarchies.expect_leaf_at assigned_work_package_child
# toggle parent
hierarchies.toggle_row assigned_work_package
hierarchies.expect_hierarchy_at assigned_work_package, collapsed: true
# disable
hierarchies.disable_via_header
hierarchies.expect_no_hierarchies
# re-enable
hierarchies.enable_via_header
hierarchies.expect_mode_enabled
# Re-enabling resets collapsed state for now
hierarchies.expect_hierarchy_at assigned_work_package, collapsed: false
hierarchies.expect_leaf_at assigned_work_package_child
end
end
end
it 'can create a new ticket with correct me values (Regression test #28488)' do
my_page.visit!
# exists as default
assigned_area = Components::Grids::GridArea.new('.grid--area', text: 'Work packages assigned to me')
assigned_area.expect_to_exist
expect(assigned_area.area)
@ -79,7 +126,6 @@ describe 'Assigned to me embedded query on my page', type: :feature, js: true do
expect(assigned_area.area)
.to have_no_selector('.subject', text: assigned_to_other_work_package.subject)
embedded_table = Pages::EmbeddedWorkPackagesTable.new(assigned_area.area)
embedded_table.click_inline_create
subject_field = embedded_table.edit_field(nil, :subject)

@ -44,6 +44,10 @@ module Components
page.find('.wp-table--table-header .icon-no-hierarchy').click
end
def disable_via_header
page.find('.wp-table--table-header .icon-hierarchy').click
end
def disable_hierarchy
::Components::WorkPackages::TableConfigurationModal.do_and_save do |modal|
modal.open_and_set_display_mode :default

Loading…
Cancel
Save