0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-07 13:19:19 +08:00
discourse/plugins/discourse-rewind/spec/system/page_objects/pages/rewind.rb
Natalie Tay 737577e8b4
DEV: Move canonical tag routes to /tag/slug/id keeping /tag/name support (#37055)
Switches tag URLs from name-based (`/tag/my-tag`) to slug+id-based
(`/tag/my-tag/123`), making tag references stable across renames and
enabling translated tag names.

  | Type | Before | After |
  |------|--------|-------|
  | Browser | `/tag/my-tag` | `/tag/my-tag/123` |
  | Browser | `/tag/my-tag/l/latest` | `/tag/my-tag/123/l/latest` |
  | API | `/tag/my-tag.json` | `/tag/123.json` |

- Old `/tag/:name` URLs still work
- Browser requests get 301 redirected to canonical URLs
- API (JSON) requests return data without redirect
-  Untagged (`/tag/none`) and intersection routes remain unchanged.


Depends on https://github.com/discourse/discourse/pull/36678

---------

Co-authored-by: Krzysztof Kotlarek <kotlarek.krzysztof@gmail.com>
2026-02-11 10:21:19 +08:00

159 lines
3.7 KiB
Ruby
Vendored

# frozen_string_literal: true
module PageObjects
module Pages
class Rewind < PageObjects::Pages::Base
def visit_activity(username)
page.visit("/u/#{username}/activity")
self
end
def visit_my_activity
page.visit("/my/activity")
self
end
def has_rewind_tab?
has_selector?(".user-nav__activity-rewind")
end
def has_no_rewind_tab?
has_no_selector?(".user-nav__activity-rewind")
end
def has_rewind_notification_active?
has_css?("body.rewind-notification-active")
end
def has_no_rewind_notification_active?
has_no_css?("body.rewind-notification-active")
end
def has_rewind_header_icon?
has_css?(".rewind-header-icon")
end
def has_no_rewind_header_icon?
has_no_css?(".rewind-header-icon")
end
def click_rewind_header_icon
find(".rewind-header-icon").click
end
def click_header_tooltip_cta
find(".rewind-header-icon-tooltip-content .rewind-header-icon__button").click
end
def click_header_tooltip_preferences_link
find(".rewind-header-icon-tooltip-content .rewind-header-icon__preferences a").click
end
def open_user_menu
find("#toggle-current-user").click
end
def click_profile_tab
click_link("user-menu-button-profile")
end
def has_callout?
has_css?(".rewind-callout__container")
end
def has_no_callout?
has_no_css?(".rewind-callout__container")
end
def click_callout
find(".rewind-callout__container .rewind-callout").click
end
def has_rewind_header?
has_css?(".rewind .rewind__header")
end
def on_rewind_page?(username)
has_current_path?("/u/#{username}/activity/rewind")
end
def has_rewind_profile_link?
has_css?("#quick-access-profile a[href*='/activity/rewind']")
end
def has_no_rewind_profile_link?
has_no_css?("#quick-access-profile a[href*='/activity/rewind']")
end
def visit_rewind(username)
page.visit("/u/#{username}/activity/rewind")
self
end
def share_toggle
PageObjects::Components::DToggleSwitch.new(".rewind__share-toggle")
end
def has_share_toggle?
has_css?(".rewind__share-toggle")
end
def has_no_share_toggle?
has_no_css?(".rewind__share-toggle")
end
def has_copy_link_button?
has_css?(".rewind__copy-link-btn")
end
def has_no_copy_link_button?
has_no_css?(".rewind__copy-link-btn")
end
def click_copy_link_button
find(".rewind__copy-link-btn").click
self
end
def has_viewing_other_user_message?(username)
has_css?(".rewind-other-user", text: username)
end
def has_cannot_view_rewind_error?
has_css?(".rewind-error")
end
def has_no_cannot_view_rewind_error?
has_no_css?(".rewind-error")
end
def has_rewind_loaded?
has_css?(".rewind__scroll-wrapper")
end
def visit_my_preferences
page.visit("/my/preferences")
self
end
def has_rewind_preferences_nav?
has_css?(".user-nav__preferences-rewind")
end
def has_no_rewind_preferences_nav?
has_no_css?(".user-nav__preferences-rewind")
end
def has_most_viewed_tags_report?
has_css?(".rewind-report-page.--most-viewed-tags")
end
def has_tag_in_report?(tag)
has_css?(
"a.folder-wrapper[href='/tag/#{tag.slug}/#{tag.id}'] .most-viewed-tags__tag",
text: "##{tag.name}",
)
end
end
end
end