Skip to content

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

DEV: Fix hashtag system spec flakys (#19574)

Martin Brennan788bcb7736f6
diff --git a/plugins/chat/spec/system/hashtag_autocomplete_spec.rb b/plugins/chat/spec/system/hashtag_autocomplete_spec.rb
index a69c783b483..ad613449436 100644
--- a/plugins/chat/spec/system/hashtag_autocomplete_spec.rb
+++ b/plugins/chat/spec/system/hashtag_autocomplete_spec.rb
@@ -60,18 +60,16 @@ describe "Using #hashtag autocompletion to search for and lookup channels",
end
expect(chat_channel_page).to have_message(id: message.id)
- within chat_channel_page.message_by_id(message.id) do
- cooked_hashtags = page.all(".hashtag-cooked", count: 3)
+ cooked_hashtags = page.all(".hashtag-cooked", count: 3)
- expect(cooked_hashtags[0]["outerHTML"]).to eq(<<~HTML.chomp)
- <a class=\"hashtag-cooked\" href=\"#{channel2.relative_url}\" data-type=\"channel\" data-slug=\"random\"><svg class=\"fa d-icon d-icon-comment svg-icon svg-node\"><use href=\"#comment\"></use></svg><span>Random</span></a>
- HTML
- expect(cooked_hashtags[1]["outerHTML"]).to eq(<<~HTML.chomp)
- <a class=\"hashtag-cooked\" href=\"#{category.url}\" data-type=\"category\" data-slug=\"raspberry-beret\"><svg class=\"fa d-icon d-icon-folder svg-icon svg-node\"><use href=\"#folder\"></use></svg><span>Raspberry</span></a>
- HTML
- expect(cooked_hashtags[2]["outerHTML"]).to eq(<<~HTML.chomp)
- <a class=\"hashtag-cooked\" href=\"#{tag.url}\" data-type=\"tag\" data-slug=\"razed\"><svg class=\"fa d-icon d-icon-tag svg-icon svg-node\"><use href=\"#tag\"></use></svg><span>razed</span></a>
- HTML
- end
+ expect(cooked_hashtags[0]["outerHTML"]).to eq(<<~HTML.chomp)
+ <a class=\"hashtag-cooked\" href=\"#{channel2.relative_url}\" data-type=\"channel\" data-slug=\"random\"><svg class=\"fa d-icon d-icon-comment svg-icon svg-node\"><use href=\"#comment\"></use></svg><span>Random</span></a>
+ HTML
+ expect(cooked_hashtags[1]["outerHTML"]).to eq(<<~HTML.chomp)
+ <a class=\"hashtag-cooked\" href=\"#{category.url}\" data-type=\"category\" data-slug=\"raspberry-beret\"><svg class=\"fa d-icon d-icon-folder svg-icon svg-node\"><use href=\"#folder\"></use></svg><span>Raspberry</span></a>
+ HTML
+ expect(cooked_hashtags[2]["outerHTML"]).to eq(<<~HTML.chomp)
+ <a class=\"hashtag-cooked\" href=\"#{tag.url}\" data-type=\"tag\" data-slug=\"razed\"><svg class=\"fa d-icon d-icon-tag svg-icon svg-node\"><use href=\"#tag\"></use></svg><span>razed</span></a>
+ HTML
end
end
diff --git a/spec/system/hashtag_autocomplete_spec.rb b/spec/system/hashtag_autocomplete_spec.rb
index 4366a156487..131c19d32fc 100644
--- a/spec/system/hashtag_autocomplete_spec.rb
+++ b/spec/system/hashtag_autocomplete_spec.rb
@@ -81,16 +81,13 @@ describe "Using #hashtag autocompletion to search for and lookup categories and
topic_page.type_in_composer("this is a #cool-cat category and a #cooltag tag")
topic_page.send_reply
expect(topic_page).to have_post_number(2)
+ cooked_hashtags = page.all(".hashtag-cooked", count: 2)
- within topic_page.post_by_number(2) do
- cooked_hashtags = page.all(".hashtag-cooked", count: 2)
-
- expect(cooked_hashtags[0]["outerHTML"]).to eq(<<~HTML.chomp)
- <a class=\"hashtag-cooked\" href=\"#{category.url}\" data-type=\"category\" data-slug=\"cool-cat\"><svg class=\"fa d-icon d-icon-folder svg-icon svg-node\"><use href=\"#folder\"></use></svg><span>Cool Category</span></a>
- HTML
- expect(cooked_hashtags[1]["outerHTML"]).to eq(<<~HTML.chomp)
- <a class=\"hashtag-cooked\" href=\"#{tag.url}\" data-type=\"tag\" data-slug=\"cooltag\"><svg class=\"fa d-icon d-icon-tag svg-icon svg-node\"><use href=\"#tag\"></use></svg><span>cooltag</span></a>
- HTML
- end
+ expect(cooked_hashtags[0]["outerHTML"]).to eq(<<~HTML.chomp)
+ <a class=\"hashtag-cooked\" href=\"#{category.url}\" data-type=\"category\" data-slug=\"cool-cat\"><svg class=\"fa d-icon d-icon-folder svg-icon svg-node\"><use href=\"#folder\"></use></svg><span>Cool Category</span></a>
+ HTML
+ expect(cooked_hashtags[1]["outerHTML"]).to eq(<<~HTML.chomp)
+ <a class=\"hashtag-cooked\" href=\"#{tag.url}\" data-type=\"tag\" data-slug=\"cooltag\"><svg class=\"fa d-icon d-icon-tag svg-icon svg-node\"><use href=\"#tag\"></use></svg><span>cooltag</span></a>
+ HTML
end
end
diff --git a/spec/system/page_objects/pages/topic.rb b/spec/system/page_objects/pages/topic.rb
index 5815fb760cb..20a9675aad0 100644
--- a/spec/system/page_objects/pages/topic.rb
+++ b/spec/system/page_objects/pages/topic.rb
@@ -89,7 +89,7 @@ module PageObjects
end
def send_reply
- within("#reply-control") { find(".save-or-cancel .create").click }
+ find("#reply-control .save-or-cancel .create").click
end
private