From e32fbb1e0eb4ba52475f4f1cd8ae5c7cd6313a6c Mon Sep 17 00:00:00 2001 From: ulferts Date: Fri, 27 Oct 2023 09:49:48 +0200 Subject: [PATCH] attempt to fix flickering assignee filter spec --- .../table/baseline/baseline_rendering_spec.rb | 4 +++- .../table/queries/assignees_role_filter_spec.rb | 13 ++++++++++--- .../pages/work_packages/work_packages_table.rb | 16 ++++++++++------ 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/spec/features/work_packages/table/baseline/baseline_rendering_spec.rb b/spec/features/work_packages/table/baseline/baseline_rendering_spec.rb index 5e3991ddcf80..3c3c98a9b113 100644 --- a/spec/features/work_packages/table/baseline/baseline_rendering_spec.rb +++ b/spec/features/work_packages/table/baseline/baseline_rendering_spec.rb @@ -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' diff --git a/spec/features/work_packages/table/queries/assignees_role_filter_spec.rb b/spec/features/work_packages/table/queries/assignees_role_filter_spec.rb index 7265b306b3e1..0c3a3e542f2a 100644 --- a/spec/features/work_packages/table/queries/assignees_role_filter_spec.rb +++ b/spec/features/work_packages/table/queries/assignees_role_filter_spec.rb @@ -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]) } @@ -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 } @@ -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 @@ -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 diff --git a/spec/support/pages/work_packages/work_packages_table.rb b/spec/support/pages/work_packages/work_packages_table.rb index 3966328c257a..8b1eb6d60431 100644 --- a/spec/support/pages/work_packages/work_packages_table.rb +++ b/spec/support/pages/work_packages/work_packages_table.rb @@ -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