mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 07:38:01 +08:00
DEV: Fix hashtag system spec flakys (#19574)
Honestly seems like it's being in some weird loop for discourse/hashtag_autocomplete_spec.rb for this: ```ruby 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 ``` I see this many times in the full logs with `SELENIUM_VERBOSE_DRIVER_LOGS=1`: ``` COMMAND FindElements { "using": "css selector", "value": "#post_2" } Followed by: COMMAND FindChildElements { "id": "26dfe542-659b-46cc-ac8c-a6c2d9cbdf0a", "using": "css selector", "value": ".hashtag-cooked" } ``` Over and over and over, there are 58 such occurrences. I am beginning to think `within` is just poison that should be avoided.
This commit is contained in:
parent
e430f22936
commit
788bcb7736
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user