Skip to content

A platform for community discussion. Free, open, simple.

FIX: long press chat message test failure (#23791)

Joffrey JAFFEUX6cd4b8de6d88
diff --git a/app/assets/javascripts/discourse/app/services/capabilities.js b/app/assets/javascripts/discourse/app/services/capabilities.js
index 41dac2d3607..d62fcbe5d9c 100644
--- a/app/assets/javascripts/discourse/app/services/capabilities.js
+++ b/app/assets/javascripts/discourse/app/services/capabilities.js
@@ -30,7 +30,12 @@ function calculateCapabilities() {
capabilities.hasContactPicker =
"contacts" in navigator && "ContactsManager" in window;
- capabilities.canVibrate = "vibrate" in navigator;
+
+ capabilities.canVibrate =
+ "vibrate" in navigator &&
+ (!("userActivation" in navigator) ||
+ navigator.userActivation.hasBeenActive);
+
capabilities.isPwa =
window.matchMedia("(display-mode: standalone)").matches ||
window.navigator.standalone ||
diff --git a/plugins/chat/spec/system/chat_message/channel_spec.rb b/plugins/chat/spec/system/chat_message/channel_spec.rb
index eb056898fd6..85c4071e51a 100644
--- a/plugins/chat/spec/system/chat_message/channel_spec.rb
+++ b/plugins/chat/spec/system/chat_message/channel_spec.rb
@@ -32,7 +32,6 @@ RSpec.describe "Chat message - channel", type: :system do
it "[mobile] copies the text of a single message", mobile: true do
chat_page.visit_channel(channel_1)
- channel_page.click_composer # ensures we don't block on vibrate due to no action
channel_page.messages.copy_text(message_1)
diff --git a/plugins/chat/spec/system/chat_message/thread_spec.rb b/plugins/chat/spec/system/chat_message/thread_spec.rb
index 38e833839d3..628cbe8d1ea 100644
--- a/plugins/chat/spec/system/chat_message/thread_spec.rb
+++ b/plugins/chat/spec/system/chat_message/thread_spec.rb
@@ -35,7 +35,6 @@ RSpec.describe "Chat message - thread", type: :system do
it "[mobile] copies the text of a single message", mobile: true do
chat_page.visit_thread(thread_message_1.thread)
- thread_page.click_composer # ensures we don't block on vibrate due to no action
thread_page.messages.copy_text(thread_message_1)
diff --git a/plugins/chat/spec/system/page_objects/chat/components/message.rb b/plugins/chat/spec/system/page_objects/chat/components/message.rb
index 52e8745c37d..d0d02f7b698 100644
--- a/plugins/chat/spec/system/page_objects/chat/components/message.rb
+++ b/plugins/chat/spec/system/page_objects/chat/components/message.rb
@@ -53,7 +53,7 @@ module PageObjects
end
if page.has_css?("html.mobile-view", wait: 0)
- component.click(delay: 0.4)
+ component.click(delay: 0.6)
page.find(".chat-message-actions [data-id=\"select\"]").click
else
hover