A platform for community discussion. Free, open, simple.
DEV: Fix (again again) the chat upload spec (#40746)
Jarek Radosz27ce679a3db4
diff --git a/plugins/chat/spec/system/chat_composer_spec.rb b/plugins/chat/spec/system/chat_composer_spec.rbindex 9ae944f3c74..d7c01158e80 100644--- a/plugins/chat/spec/system/chat_composer_spec.rb+++ b/plugins/chat/spec/system/chat_composer_spec.rb@@ -257,7 +257,8 @@ RSpec.describe "Chat composer" dochat_page.visit_channel(channel_1)file_path = file_from_fixtures("logo.png", "images").path- cdp.with_slow_upload do+ # Hold the upload request in-flight, without throttling everything.+ cdp.with_pending_requests(%r{/uploads\.json}) doattach_file("channel-file-uploader", file_path, make_visible: true)expect(page).to have_css(".chat-composer-upload--in-progress")expect(page).to have_css(".chat-composer.is-send-disabled")diff --git a/spec/system/page_objects/cdp.rb b/spec/system/page_objects/cdp.rbindex cd25775f999..c94e4125b8e 100644--- a/spec/system/page_objects/cdp.rb+++ b/spec/system/page_objects/cdp.rb@@ -152,5 +152,15 @@ module PageObjects)endend++ # Holds matching requests in-flight for the duration of the block.+ def with_pending_requests(pattern)+ page.driver.with_playwright_page do |pw_page|+ pw_page.route(pattern, ->(_route, _request) {})+ yield+ ensure+ pw_page.unroute(pattern)+ end+ endendend