Add spec for readonly team planner card

pull/10801/head
Oliver Günther 2 years ago
parent b93d4467a4
commit 50bd23d0b4
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 37
      modules/team_planner/spec/features/team_planner_spec.rb
  2. 8
      modules/team_planner/spec/support/pages/team_planner.rb

@ -259,4 +259,41 @@ describe 'Team planner', type: :feature, js: true do
expect(page).to have_selector('.ng-option-disabled', text: "No items found")
end
end
context 'with a readonly work package' do
let(:readonly_status) { create :status, is_readonly: true }
let!(:blocked_task) do
create :work_package,
project:,
assigned_to: user,
status: readonly_status,
start_date: Time.zone.today - 1.day,
due_date: Time.zone.today + 1.day,
subject: 'A blocked task'
end
it 'disables editing on readonly tasks' do
with_enterprise_token(:team_planner_view, :readonly_work_packages)
team_planner.visit!
team_planner.wait_for_loaded
team_planner.expect_empty_state
team_planner.expect_assignee(user, present: false)
retry_block do
team_planner.click_add_user
page.find('[data-qa-selector="tp-add-assignee"] input')
team_planner.select_user_to_add user.name
end
team_planner.expect_empty_state(present: false)
team_planner.expect_assignee user
team_planner.within_lane(user) do
team_planner.expect_event blocked_task
team_planner.expect_resizable blocked_task, resizable: false
end
end
end
end

@ -129,6 +129,14 @@ module Pages
end
end
def expect_resizable(work_package, resizable: true)
if resizable
expect(page).to have_selector('.fc-event.fc-event-resizable', text: work_package.subject, wait: 10)
else
expect(page).to have_selector('.fc-event:not(.fc-event-resizable)', text: work_package.subject, wait: 10)
end
end
def add_assignee(name)
click_add_user
page.find('[data-qa-selector="tp-add-assignee"] input')

Loading…
Cancel
Save