Skip to content

Commit

Permalink
Merge pull request #14030 from opf/fix/attempt_to_stablize_flickering…
Browse files Browse the repository at this point in the history
…_assignee_filter_spec

attempt to fix flickering assignee filter spec
  • Loading branch information
ulferts authored Oct 27, 2023
2 parents 2e5410a + e32fbb1 commit 18df084
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -413,11 +413,13 @@
baseline_modal.toggle_drop_modal
baseline_modal.select_filter 'yesterday'
baseline_modal.apply

wait_for_reload # Ensure page is fully loaded
end

context 'and the query is saved' do
before do
wp_table.save_as 'My Baseline Query'
wp_table.save_as('My Baseline Query', by_title: true)
end

it_behaves_like 'selecting a builtin view'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

require 'spec_helper'

RSpec.describe "Work package filtering by assignee's role", :js do
RSpec.describe "Work package filtering by assignee's role", :js, :with_cuprite do
shared_let(:project) { create(:project) }

shared_let(:project_role) { create(:project_role, permissions: %i[view_work_packages work_package_assigned save_queries]) }
Expand All @@ -54,6 +54,11 @@
project:,
assigned_to: other_user)
end
shared_let(:work_package_user_not_assignee) do
create(:work_package,
project:,
assigned_to: current_user)
end

let(:wp_table) { Pages::WorkPackagesTable.new(project) }
let(:filters) { Components::WorkPackages::Filters.new }
Expand All @@ -66,7 +71,7 @@

it "shows the work package matching the assignee's role to filter" do
wp_table.visit!
wp_table.expect_work_package_listed(work_package_user_assignee)
wp_table.expect_work_package_listed(work_package_user_assignee, work_package_user_not_assignee)

filters.open
# It does not show builtin roles such as Anonymous and NonMember or roles that don't allow the user to become an assignee
Expand All @@ -79,14 +84,16 @@
filters.expect_filter_count("2")

wp_table.expect_work_package_listed(work_package_user_assignee)
wp_table.ensure_work_package_not_listed!(work_package_user_not_assignee)

wp_table.save_as('Subject query')
wp_table.save_as('Subject query', by_title: true)

wp_table.expect_and_dismiss_toaster(message: 'Successful creation.')

# Revisit query
wp_table.visit_query Query.last
wp_table.expect_work_package_listed(work_package_user_assignee)
wp_table.ensure_work_package_not_listed!(work_package_user_not_assignee)

filters.open
# Do not show the already selected roles in the autocomplete dropdown
Expand Down
16 changes: 10 additions & 6 deletions spec/support/pages/work_packages/work_packages_table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,16 @@ def click_setting_item(label)
.new.open_and_choose(label)
end

def save_as(name)
click_setting_item 'Save as'

fill_in 'save-query-name', with: name

click_button 'Save'
def save_as(name, by_title: false)
if by_title
title_input = find('.editable-toolbar-title--input')
title_input.set(name)
title_input.send_keys(:enter)
else
click_setting_item 'Save as'
fill_in 'save-query-name', with: name
click_button 'Save'
end

expect_toast message: 'Successful creation.'
expect_title name
Expand Down

0 comments on commit 18df084

Please sign in to comment.