DEV: prevents flakey in autocomplete hashtag (#21786)

Watching screenshots of failures it appears that sometimes the reply was stuck at: `this is a #` due to the autocomplete showing, given we only need to send a reply here? I think fill_in + click send should be more reliable here.

Note I also tweaked `send_reply` to accept a content param and use it to fill composer when given.
This commit is contained in:
Joffrey JAFFEUX 2023-05-28 14:17:39 +02:00 committed by GitHub
parent 885ab7c7bb
commit 4303d4711f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -77,10 +77,13 @@ describe "Using #hashtag autocompletion to search for and lookup categories and
it "cooks the hashtags for tag and category correctly serverside when the post is saved to the database" do it "cooks the hashtags for tag and category correctly serverside when the post is saved to the database" do
topic_page.visit_topic_and_open_composer(topic) topic_page.visit_topic_and_open_composer(topic)
expect(topic_page).to have_expanded_composer expect(topic_page).to have_expanded_composer
topic_page.type_in_composer("this is a #cool-cat category and a #cooltag tag")
topic_page.send_reply topic_page.send_reply("this is a #cool-cat category and a #cooltag tag")
expect(topic_page).to have_post_number(2) expect(topic_page).to have_post_number(2)
cooked_hashtags = page.all(".hashtag-cooked", count: 2) cooked_hashtags = page.all(".hashtag-cooked", count: 2)
expect(cooked_hashtags[0]["outerHTML"]).to eq(<<~HTML.chomp) expect(cooked_hashtags[0]["outerHTML"]).to eq(<<~HTML.chomp)

View File

@ -119,7 +119,8 @@ module PageObjects
@composer_component.has_popup_content?(content) @composer_component.has_popup_content?(content)
end end
def send_reply def send_reply(content = nil)
fill_in_composer(content) if content
find("#reply-control .save-or-cancel .create").click find("#reply-control .save-or-cancel .create").click
end end