discourse/spec/system/page_objects/pages/user_notifications.rb
Juan David Martínez Cubillos 88ce76bd16
DEV: Added the ability to use users' names in group mention notifications and mentions shown in emails (#33055)
**Description**
These changes were introduced in a previous PR but were reverted due to
a bug when several users were mentioned in a response. This PR
reintroduces the changes along with a fix to the issue.

This is part of a series of changes to allow customers to display users'
names instead of the user's username.

When a user belongs to a group that has been mentioned by another user.
It shows the name of the user that mentioned the group.

[Previous
commit](e147d2afe6)

**Before**


![imagen](https://github.com/user-attachments/assets/b62224fb-9b69-4603-be00-e7aa61d9b33c)

**After**


![imagen](https://github.com/user-attachments/assets/8495cb63-6530-4d86-a51c-f0510d48f6c7)

When a email is sent to the user when mentioned in a post 

**Before**



![imagen](https://github.com/user-attachments/assets/94e674da-085a-41cb-8145-ba6fbe3636ce)

**After**


![imagen](https://github.com/user-attachments/assets/490cb365-bf85-4745-93b9-e47048b2f02e)
2025-06-03 15:49:55 -05:00

40 lines
1 KiB
Ruby

# frozen_string_literal: true
module PageObjects
module Pages
class UserNotifications < PageObjects::Pages::Base
def visit(user)
page.visit("/u/#{user.username}/notifications")
self
end
def filter_dropdown
PageObjects::Components::SelectKit.new(".notifications-filter")
end
def set_filter_value(value)
filter_dropdown.select_row_by_value(value)
end
def find_notification(notification)
find(".notification a[href='#{notification.url}']")
end
def has_selected_filter_value?(value)
expect(filter_dropdown).to have_selected_value(value)
end
def has_notification?(notification)
page.has_css?(".notification a[href='#{notification.url}']")
end
def has_no_notification?(notification)
page.has_no_css?(".notification a[href='#{notification.url}']")
end
def has_notification_count_of?(count)
page.has_css?(".notification", count: count)
end
end
end
end