mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-22 17:41:55 +08:00
The test being fixed in this commit was flaking with the following
error:
```
Capybara::Ambiguous:
Ambiguous match, found 2 elements matching visible css ".stream-topic-title .title a[href*='/2']"
```
The regexp match on the `href` attribute has the potential to match
multiple elements if both urls contain the `/#{topic.id}` substring. For
example, both `/t/-/2/2` and `/t/-/1/2` will satisfy the regexp.
27 lines
943 B
Ruby
Vendored
27 lines
943 B
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
describe "User activity posts", type: :system do
|
|
before_all { UserActionManager.enable }
|
|
fab!(:user)
|
|
|
|
fab!(:topic1) do
|
|
Fabricate(:topic, title: "Title with & characters and emoji :wave:").tap do |t|
|
|
Fabricate.times(2, :post, topic: t, user: user).each { |p| UserActionManager.post_created(p) }
|
|
end
|
|
end
|
|
fab!(:topic2) do
|
|
Fabricate(:topic).tap do |t|
|
|
Fabricate.times(2, :post, topic: t, user: user).each { |p| UserActionManager.post_created(p) }
|
|
end
|
|
end
|
|
|
|
it "lists posts with correctly-formatted titles" do
|
|
visit "/u/#{user.username_lower}/activity/replies"
|
|
|
|
expect(page).to have_css(".stream-topic-title .title", count: 2)
|
|
|
|
title_element = find(".stream-topic-title .title a[href*='/#{topic1.id}/']")
|
|
expect(title_element).to have_text("Title with & characters and emoji")
|
|
expect(title_element).to have_css("img.emoji[title='wave']")
|
|
end
|
|
end
|