2023-10-10 23:33:37 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require_relative "page_objects/components/custom_header_link"
|
|
|
|
|
|
|
|
RSpec.describe "Viewing Custom Header Links", system: true do
|
|
|
|
fab!(:theme) { upload_theme_component }
|
|
|
|
let!(:custom_header_link) { PageObjects::Components::CustomHeaderLink.new }
|
|
|
|
|
2024-04-26 00:57:46 -04:00
|
|
|
before do
|
|
|
|
theme.update_setting(
|
|
|
|
:custom_header_links,
|
|
|
|
[
|
|
|
|
{
|
|
|
|
text: "External link",
|
|
|
|
title: "This link will open in a new tab",
|
|
|
|
url: "https://meta.discourse.org",
|
|
|
|
view: "vdo",
|
|
|
|
target: "blank",
|
|
|
|
hide_on_scroll: "remove",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "Most Liked",
|
|
|
|
title: "Posts with the most amount of likes",
|
|
|
|
url: "/latest/?order=op_likes",
|
|
|
|
view: "vdo",
|
|
|
|
target: "self",
|
|
|
|
hide_on_scroll: "keep",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "Privacy",
|
|
|
|
title: "Our Privacy Policy",
|
|
|
|
url: "/privacy",
|
|
|
|
view: "vdm",
|
|
|
|
target: "self",
|
|
|
|
hide_on_scroll: "keep",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
theme.save!
|
|
|
|
end
|
|
|
|
|
2024-08-19 15:35:56 -04:00
|
|
|
it "should display the custom header links" do
|
|
|
|
visit("/")
|
2024-04-02 04:54:24 -04:00
|
|
|
|
2024-08-19 15:35:56 -04:00
|
|
|
expect(custom_header_link).to be_visible
|
2024-04-02 04:54:24 -04:00
|
|
|
|
2024-08-19 15:35:56 -04:00
|
|
|
expect(custom_header_link).to have_custom_header_link(
|
|
|
|
"External link",
|
|
|
|
href: "https://meta.discourse.org",
|
|
|
|
title: "This link will open in a new tab",
|
|
|
|
)
|
2024-04-02 04:54:24 -04:00
|
|
|
|
2024-08-19 15:35:56 -04:00
|
|
|
expect(custom_header_link).to have_custom_header_link(
|
|
|
|
"Most Liked",
|
|
|
|
href: "/latest/?order=op_likes",
|
|
|
|
title: "Posts with the most amount of likes",
|
|
|
|
)
|
2024-04-02 04:54:24 -04:00
|
|
|
|
2024-08-19 15:35:56 -04:00
|
|
|
expect(custom_header_link).to have_custom_header_link(
|
|
|
|
"Privacy",
|
|
|
|
href: "/privacy",
|
|
|
|
title: "Our Privacy Policy",
|
|
|
|
)
|
2023-10-10 23:33:37 -04:00
|
|
|
end
|
|
|
|
end
|