mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: uses capybara helper has_field (#30438)
Checking for value of input directly is not waiting for value to be present.
This commit is contained in:
@@ -28,7 +28,7 @@ RSpec.describe "Chat composer draft", type: :system do
|
|||||||
it "loads the draft" do
|
it "loads the draft" do
|
||||||
chat_page.visit_channel(channel_1)
|
chat_page.visit_channel(channel_1)
|
||||||
|
|
||||||
expect(channel_page.composer.value).to eq("draft")
|
expect(channel_page.composer).to have_value("draft")
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when loading another channel and back" do
|
context "when loading another channel and back" do
|
||||||
@@ -42,15 +42,15 @@ RSpec.describe "Chat composer draft", type: :system do
|
|||||||
it "loads the correct drafts" do
|
it "loads the correct drafts" do
|
||||||
chat_page.visit_channel(channel_1)
|
chat_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)
|
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)
|
chat_page.visit_channel(channel_1)
|
||||||
|
|
||||||
expect(channel_page.composer.value).to eq("draft")
|
expect(channel_page.composer).to have_value("draft")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ RSpec.describe "Chat composer draft", type: :system do
|
|||||||
it "loads the draft with the upload" do
|
it "loads the draft with the upload" do
|
||||||
chat_page.visit_channel(channel_1)
|
chat_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)
|
expect(page).to have_selector(".chat-composer-upload--image", count: 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -133,7 +133,7 @@ RSpec.describe "Chat composer draft", type: :system do
|
|||||||
it "loads the draft with replied to message" do
|
it "loads the draft with replied to message" do
|
||||||
chat_page.visit_channel(channel_1)
|
chat_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__username", text: message_1.user.username)
|
||||||
expect(page).to have_selector(".chat-reply__excerpt", text: message_1.excerpt)
|
expect(page).to have_selector(".chat-reply__excerpt", text: message_1.excerpt)
|
||||||
end
|
end
|
||||||
@@ -153,7 +153,7 @@ RSpec.describe "Chat composer draft", type: :system do
|
|||||||
it "loads the draft" do
|
it "loads the draft" do
|
||||||
chat_page.visit_thread(thread_1)
|
chat_page.visit_thread(thread_1)
|
||||||
|
|
||||||
expect(thread_page.composer.value).to eq("draft")
|
expect(thread_page.composer).to have_value("draft")
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when loading another channel and back" do
|
context "when loading another channel and back" do
|
||||||
@@ -168,15 +168,15 @@ RSpec.describe "Chat composer draft", type: :system do
|
|||||||
it "loads the correct drafts" do
|
it "loads the correct drafts" do
|
||||||
chat_page.visit_thread(thread_1)
|
chat_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)
|
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)
|
chat_page.visit_thread(thread_1)
|
||||||
|
|
||||||
expect(thread_page.composer.value).to eq("draft")
|
expect(thread_page.composer).to have_value("draft")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -239,7 +239,7 @@ RSpec.describe "Chat composer draft", type: :system do
|
|||||||
it "loads the draft with the upload" do
|
it "loads the draft with the upload" do
|
||||||
chat_page.visit_thread(thread_1)
|
chat_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)
|
expect(page).to have_selector(".chat-composer-upload--image", count: 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ module PageObjects
|
|||||||
end
|
end
|
||||||
|
|
||||||
def blank?
|
def blank?
|
||||||
input.value.blank?
|
has_value?("")
|
||||||
end
|
end
|
||||||
|
|
||||||
def enabled?
|
def enabled?
|
||||||
@@ -49,7 +49,7 @@ module PageObjects
|
|||||||
end
|
end
|
||||||
|
|
||||||
def has_value?(expected)
|
def has_value?(expected)
|
||||||
value == expected
|
has_field?(input[:id], with: expected)
|
||||||
end
|
end
|
||||||
|
|
||||||
def reply_to_last_message_shortcut
|
def reply_to_last_message_shortcut
|
||||||
@@ -91,11 +91,11 @@ module PageObjects
|
|||||||
end
|
end
|
||||||
|
|
||||||
def editing_message?(message)
|
def editing_message?(message)
|
||||||
value == message.message && message_details.editing?(message)
|
has_value?(message.message) && message_details.editing?(message)
|
||||||
end
|
end
|
||||||
|
|
||||||
def editing_no_message?
|
def editing_no_message?
|
||||||
value == "" && message_details.has_no_message?
|
blank? && message_details.has_no_message?
|
||||||
end
|
end
|
||||||
|
|
||||||
def focus
|
def focus
|
||||||
|
|||||||
Reference in New Issue
Block a user