Skip to content

Commit

Permalink
Refactor team_planner.add_assignee method to include retry_block
Browse files Browse the repository at this point in the history
  • Loading branch information
dombesz committed Mar 11, 2024
1 parent c3e50fb commit a99a9e9
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@
team_planner.visit!
loading_indicator_saveguard

retry_block do
team_planner.add_assignee user
end
team_planner.add_assignee user

team_planner.within_lane(user) do
team_planner.expect_event work_package
Expand Down
26 changes: 4 additions & 22 deletions modules/team_planner/spec/features/team_planner_create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,7 @@

team_planner.expect_assignee(user, present: false)

retry_block do
team_planner.click_add_user
page.find("#{test_selector('tp-add-assignee')} input")
team_planner.select_user_to_add user.name
end
team_planner.add_assignee user.name
end

it_behaves_like 'can create a new work package'
Expand Down Expand Up @@ -119,23 +115,9 @@
team_planner.expect_assignee(other_user, present: false)
team_planner.expect_assignee(third_user, present: false)

retry_block do
team_planner.click_add_user
page.find("#{test_selector('tp-add-assignee')} input")
team_planner.select_user_to_add other_user.name
end

retry_block do
team_planner.click_add_user
page.find("#{test_selector('tp-add-assignee')} input")
team_planner.select_user_to_add third_user.name
end

retry_block do
team_planner.click_add_user
page.find("#{test_selector('tp-add-assignee')} input")
team_planner.select_user_to_add user.name
end
team_planner.add_assignee other_user.name
team_planner.add_assignee third_user.name
team_planner.add_assignee user.name
end

it_behaves_like 'can create a new work package'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@
team_planner.visit!

team_planner.expect_empty_state
retry_block do
team_planner.click_add_user
page.find("#{test_selector('tp-add-assignee')} input")
team_planner.select_user_to_add user.name
end
team_planner.add_assignee user.name

# Initially, in the "Work week" view, non working days are hidden
expect(page).to have_css('.fc-day-mon')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,11 @@
work_package_view.expect_assignee(other_user, present: false)

retry_block do
work_package_view.click_add_user
page.find("#{test_selector('tp-add-assignee')} input")
work_package_view.select_user_to_add user.name
work_package_view.add_assignee user.name
end

retry_block do
work_package_view.click_add_user
page.find("#{test_selector('tp-add-assignee')} input")
work_package_view.select_user_to_add other_user.name
work_package_view.add_assignee other_user.name
end

work_package_view.expect_assignee user
Expand Down
48 changes: 8 additions & 40 deletions modules/team_planner/spec/features/team_planner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,19 +155,11 @@
team_planner.expect_assignee(user, present: false)
team_planner.expect_assignee(other_user, present: false)

retry_block do
team_planner.click_add_user
page.find("#{test_selector('tp-add-assignee')} input")
team_planner.select_user_to_add user.name
end
team_planner.add_assignee user.name

team_planner.expect_empty_state(present: false)

retry_block do
team_planner.click_add_user
page.find("#{test_selector('tp-add-assignee')} input")
team_planner.select_user_to_add other_user.name
end
team_planner.add_assignee other_user.name

team_planner.expect_assignee user
team_planner.expect_assignee other_user
Expand Down Expand Up @@ -249,21 +241,13 @@
team_planner.expect_assignee(user, present: false)
team_planner.expect_assignee(other_user, present: false)

retry_block do
team_planner.click_add_user
page.find("#{test_selector('tp-add-assignee')} input")
team_planner.select_user_to_add user.name
end
team_planner.add_assignee user.name

team_planner.expect_empty_state(present: false)
team_planner.expect_assignee(user)
team_planner.expect_assignee(other_user, present: false)

retry_block do
team_planner.click_add_user
page.find("#{test_selector('tp-add-assignee')} input")
team_planner.select_user_to_add other_user.name
end
team_planner.add_assignee other_user.name

team_planner.expect_assignee(user)
team_planner.expect_assignee(other_user)
Expand All @@ -280,11 +264,7 @@
team_planner.expect_empty_state

# Try one more time to make sure deleting the full filter didn't kill the functionality
retry_block do
team_planner.click_add_user
page.find("#{test_selector('tp-add-assignee')} input")
team_planner.select_user_to_add user.name
end
team_planner.add_assignee user.name

team_planner.expect_assignee(user)
team_planner.expect_assignee(other_user, present: false)
Expand All @@ -293,11 +273,7 @@
it 'filters possible assignees correctly' do
team_planner.visit!

retry_block do
team_planner.click_add_user
page.find("#{test_selector('tp-add-assignee')} input")
team_planner.search_user_to_add user_outside_project.name
end
team_planner.add_assignee user_outside_project.name

expect(page).to have_css('.ng-option-disabled', text: "No items found")

Expand All @@ -307,11 +283,7 @@

team_planner.expect_assignee(user)

retry_block do
team_planner.click_add_user
page.find("#{test_selector('tp-add-assignee')} input")
team_planner.search_user_to_add user.name
end
team_planner.add_assignee user.name

expect(page).to have_css('.ng-option-disabled', text: "No items found")
end
Expand Down Expand Up @@ -372,11 +344,7 @@
team_planner.expect_empty_state
team_planner.expect_assignee(user, present: false)

retry_block do
team_planner.click_add_user
page.find("#{test_selector('tp-add-assignee')} input")
team_planner.select_user_to_add user.name
end
team_planner.add_assignee user.name

team_planner.expect_empty_state(present: false)
team_planner.expect_assignee user
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@
team_planner.visit!

team_planner.add_assignee user
retry_block do
team_planner.add_assignee other_user
end
team_planner.add_assignee other_user

# Include the subproject
project_include.toggle!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@
team_planner.visit!

team_planner.add_assignee user
retry_block do
team_planner.add_assignee other_user
end
team_planner.add_assignee other_user

team_planner.within_lane(user) do
team_planner.expect_event first_wp, present: false
Expand Down Expand Up @@ -247,9 +245,7 @@
team_planner.visit!

team_planner.add_assignee user
retry_block do
team_planner.add_assignee other_user
end
team_planner.add_assignee other_user
end

it 'allows neither dragging nor resizing any wp' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@
team_planner.visit!

team_planner.expect_empty_state
retry_block do
team_planner.click_add_user
page.find("#{test_selector('tp-add-assignee')} input")
team_planner.select_user_to_add user.name
end
team_planner.add_assignee user.name

team_planner.expect_view_mode 'Work week'
expect(page).to have_css('.fc-timeline-slot-frame', count: 5)
Expand Down

0 comments on commit a99a9e9

Please sign in to comment.