mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
Try to fix another flickering test
modules/team_planner/spec/features/query_handling_spec.rb sometimes misses the dropdown, because it does not wait long enough after adding a filter, and once the filter is applied, the page state is reset and the dropdown is closed, which leads to the error.
This commit is contained in:
@@ -32,7 +32,7 @@ require "spec_helper"
|
||||
require_relative "../support/pages/team_planner"
|
||||
require_relative "../../../../spec/features/views/shared_examples"
|
||||
|
||||
RSpec.describe "Team planner query handling", :js, with_ee: %i[team_planner_view] do
|
||||
RSpec.describe "Team planner query handling", :js, :with_cuprite, with_ee: %i[team_planner_view] do
|
||||
shared_let(:type_task) { create(:type_task) }
|
||||
shared_let(:type_bug) { create(:type_bug) }
|
||||
shared_let(:project) do
|
||||
@@ -97,7 +97,7 @@ RSpec.describe "Team planner query handling", :js, with_ee: %i[team_planner_view
|
||||
filters.open
|
||||
|
||||
filters.add_filter_by("Type", "is (OR)", [type_bug.name])
|
||||
|
||||
team_planner.clear_any_toasters
|
||||
filters.expect_filter_count("2")
|
||||
|
||||
team_planner.within_lane(user) do
|
||||
@@ -120,6 +120,7 @@ RSpec.describe "Team planner query handling", :js, with_ee: %i[team_planner_view
|
||||
# Change filter
|
||||
filters.open
|
||||
filters.add_filter_by("Type", "is (OR)", [type_bug.name])
|
||||
team_planner.clear_any_toasters
|
||||
filters.expect_filter_count("2")
|
||||
|
||||
# Save current filters
|
||||
|
||||
@@ -37,6 +37,7 @@ RSpec.shared_examples "module specific query view management" do
|
||||
# Change the query
|
||||
filters.open
|
||||
filters.add_filter_by "Subject", "contains", ["Test"]
|
||||
module_page.clear_any_toasters
|
||||
filters.expect_filter_count(initial_filter_count + 1)
|
||||
|
||||
# Save it
|
||||
@@ -48,6 +49,7 @@ RSpec.shared_examples "module specific query view management" do
|
||||
|
||||
# Change the filter again
|
||||
filters.add_filter_by "% Complete", "is", ["25"], "percentageDone"
|
||||
module_page.clear_any_toasters
|
||||
filters.expect_filter_count(initial_filter_count + 2)
|
||||
|
||||
# Save as another query
|
||||
@@ -61,8 +63,7 @@ RSpec.shared_examples "module specific query view management" do
|
||||
# Rename a query
|
||||
settings_menu.open_and_choose "Rename view"
|
||||
expect(page).to have_focus_on(".editable-toolbar-title--input")
|
||||
page.driver.browser.switch_to.active_element.send_keys("My second query (renamed)")
|
||||
page.driver.browser.switch_to.active_element.send_keys(:return)
|
||||
find_field("Name of this view").send_keys("My second query (renamed)", :return)
|
||||
module_page.expect_and_dismiss_toaster message: I18n.t("js.notice_successful_update")
|
||||
|
||||
query_title.expect_not_changed
|
||||
|
||||
@@ -23,6 +23,13 @@ module Toasts
|
||||
page.find(".op-toast--close").click
|
||||
end
|
||||
|
||||
# Clears a toaster if there is one waiting 1 second max, but do not fail if there is none
|
||||
def clear_any_toasters
|
||||
if has_button?(I18n.t("js.close_popup_title"), wait: 1)
|
||||
find_button(I18n.t("js.close_popup_title")).click
|
||||
end
|
||||
end
|
||||
|
||||
def expect_no_toaster(type: :success, message: nil, wait: 10)
|
||||
if type.nil?
|
||||
expect(page).to have_no_css(".op-toast", wait:)
|
||||
|
||||
Reference in New Issue
Block a user