A platform for community discussion. Free, open, simple.
DEV: uses capybara helper has_field (#30438)
Joffrey JAFFEUXcf26d3f2113b
diff --git a/plugins/chat/spec/system/chat_composer_draft_spec.rb b/plugins/chat/spec/system/chat_composer_draft_spec.rbindex bd06e069bd5..3a2e42e659a 100644--- a/plugins/chat/spec/system/chat_composer_draft_spec.rb+++ b/plugins/chat/spec/system/chat_composer_draft_spec.rb@@ -28,7 +28,7 @@ RSpec.describe "Chat composer draft", type: :system doit "loads the draft" dochat_page.visit_channel(channel_1)- expect(channel_page.composer.value).to eq("draft")+ expect(channel_page.composer).to have_value("draft")endcontext "when loading another channel and back" do@@ -42,15 +42,15 @@ RSpec.describe "Chat composer draft", type: :system doit "loads the correct drafts" dochat_page.visit_channel(channel_1)- expect(channel_page.composer.value).to eq("draft")+ expect(channel_page.composer).to have_value("draft")chat_page.visit_channel(channel_2)- expect(channel_page.composer.value).to eq("draft2")+ expect(channel_page.composer).to have_value("draft2")chat_page.visit_channel(channel_1)- expect(channel_page.composer.value).to eq("draft")+ expect(channel_page.composer).to have_value("draft")endend@@ -104,7 +104,7 @@ RSpec.describe "Chat composer draft", type: :system doit "loads the draft with the upload" dochat_page.visit_channel(channel_1)- expect(channel_page.composer.value).to eq("draft")+ expect(channel_page.composer).to have_value("draft")expect(page).to have_selector(".chat-composer-upload--image", count: 1)endend@@ -133,7 +133,7 @@ RSpec.describe "Chat composer draft", type: :system doit "loads the draft with replied to message" dochat_page.visit_channel(channel_1)- expect(channel_page.composer.value).to eq("draft")+ expect(channel_page.composer).to have_value("draft")expect(page).to have_selector(".chat-reply__username", text: message_1.user.username)expect(page).to have_selector(".chat-reply__excerpt", text: message_1.excerpt)end@@ -153,7 +153,7 @@ RSpec.describe "Chat composer draft", type: :system doit "loads the draft" dochat_page.visit_thread(thread_1)- expect(thread_page.composer.value).to eq("draft")+ expect(thread_page.composer).to have_value("draft")endcontext "when loading another channel and back" do@@ -168,15 +168,15 @@ RSpec.describe "Chat composer draft", type: :system doit "loads the correct drafts" dochat_page.visit_thread(thread_1)- expect(thread_page.composer.value).to eq("draft")+ expect(thread_page.composer).to have_value("draft")chat_page.visit_thread(thread_2)- expect(thread_page.composer.value).to eq("draft2")+ expect(thread_page.composer).to have_value("draft2")chat_page.visit_thread(thread_1)- expect(thread_page.composer.value).to eq("draft")+ expect(thread_page.composer).to have_value("draft")endend@@ -239,7 +239,7 @@ RSpec.describe "Chat composer draft", type: :system doit "loads the draft with the upload" dochat_page.visit_thread(thread_1)- expect(thread_page.composer.value).to eq("draft")+ expect(thread_page.composer).to have_value("draft")expect(page).to have_selector(".chat-composer-upload--image", count: 1)endenddiff --git a/plugins/chat/spec/system/page_objects/chat/components/composer.rb b/plugins/chat/spec/system/page_objects/chat/components/composer.rbindex 255fd8f11fd..a4b060ab8e7 100644--- a/plugins/chat/spec/system/page_objects/chat/components/composer.rb+++ b/plugins/chat/spec/system/page_objects/chat/components/composer.rb@@ -13,7 +13,7 @@ module PageObjectsenddef blank?- input.value.blank?+ has_value?("")enddef enabled?@@ -49,7 +49,7 @@ module PageObjectsenddef has_value?(expected)- value == expected+ has_field?(input[:id], with: expected)enddef reply_to_last_message_shortcut@@ -91,11 +91,11 @@ module PageObjectsenddef editing_message?(message)- value == message.message && message_details.editing?(message)+ has_value?(message.message) && message_details.editing?(message)enddef editing_no_message?- value == "" && message_details.has_no_message?+ blank? && message_details.has_no_message?enddef focus